Skip to content

feat: Add semantic linting for Splunk .conf files#170

Open
jtgreen86 wants to merge 2 commits into
splunk:masterfrom
jtgreen86:feature/semantic-linting
Open

feat: Add semantic linting for Splunk .conf files#170
jtgreen86 wants to merge 2 commits into
splunk:masterfrom
jtgreen86:feature/semantic-linting

Conversation

@jtgreen86

Copy link
Copy Markdown

What this adds

Semantic linting for Splunk .conf files: context-aware configuration suggestions that go beyond syntax validation. Traditional linting only checks if stanzas and settings are valid per .spec files. This feature detects issues that are syntactically valid but problematic in practice.

Problems it catches

  • Performance anti-patterns (e.g. SHOULD_LINEMERGE = true when LINE_BREAKER would be faster)
  • Missing complementary settings (e.g. LINE_BREAKER without SHOULD_LINEMERGE = false)
  • Conflicting configurations (e.g. KV_MODE = json with INDEXED_EXTRACTIONS)
  • Risky values (e.g. TRUNCATE too low causing data loss)
  • Incomplete configurations (e.g. TIME_FORMAT without TIME_PREFIX)

Files added

File Purpose
out/semanticRules.js Rule loading and evaluation engine
out/codeActionProvider.js Quick fix code actions
resources/semantic_rules.json Rule definitions (JSON, not hardcoded)
resources/semantic_rules.schema.json JSON Schema for rule validation

Files modified

File What changed
out/extension.js Added imports, registered code action provider, integrated semantic linting into getDiagnostics()
package.json Added splunk.semanticLinting.enabled configuration setting
README.md Added semantic linting to feature list
CHANGELOG.md Added version 0.4.0 entry

Notes

  • Rules are JSON-driven and easy to extend without code changes
  • Severity levels are appropriate (Error/Warning/Information/Hint)
  • Feature can be disabled via the splunk.semanticLinting.enabled setting
  • No existing functionality was modified (syntax validation, completions, etc. unchanged)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant