Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add custom syntax validation in the "check" mode #11

Open
lowell80 opened this issue Apr 20, 2018 · 1 comment
Open

Add custom syntax validation in the "check" mode #11

lowell80 opened this issue Apr 20, 2018 · 1 comment
Labels
enhancement New feature or request

Comments

@lowell80
Copy link
Member

lowell80 commented Apr 20, 2018

Support looking for things that can be parsed but probably are wrong or could be a mistake. (May need to add some additional CLI args to enable/disable additional checks.)

Include:

  • Check for trailing space after a continuation (\) character. (Often will be caught with another syntax error, but not always)
  • Check for leading spaces before a key name.
  • Look for trailing comments (in the value). This one could be valid. Example: Regexes that match a literal #.
  • Detect space characters before or after stanza definitions. (May be caught by existing parser, unclear.) Need to be careful NOT to pick up subsearches in savedsearches.conf, which shows up incorrectly in the vim Splunk .conf highlighter, for example (not that I've updated in some time, or reported the issues.)

Also add unit tests for these. It's not mandatory that the parser itself find all these issues, but the check CLI tool should report these.

@lowell80 lowell80 added the enhancement New feature or request label Apr 20, 2018
@lowell80
Copy link
Member Author

Note to self: Another possible implementation option is to allow users to define these themselves using the filter expression language (not yet released). But that could be a pretty flexible means of provided extendable support for users that need such a feature. (Of course, at this time there is no means of storing such configuration settings, and how you'd get that to integrate into pre-commit, without hosting your own repo could be interesting.... but one problem at a time.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant