Skip to content

Missing identification of file syntax errors caused by missing line-continuation backslashes #149

@maketsi

Description

@maketsi

macros.conf and savedsearches.conf files (as an example) support and commonly also contain backslashes at the end of lines to indicate that the next line should be appended to the current one. But it's very easy for developer to forget one or some of those backslashes, breaking the file syntax.

This extension does not identify the missing backslash as an error, even though lack of it will break both the file syntax and the definition itself. "No problems have been detected in the workspace."

Splunk also makes it quite hard to notice the file is broken, because the defined macros and savedsearches exist and do run but are truncated, thus not doing what they should.

Example of a valid syntax:

# macros.conf
[macroname]
definition = this is \
    a long macro \
    with multiple lines \
    | and piped commands

# savedsearches.conf
[mysearchname]
search = this is \
    a very long search \
    with multiple lines \
    | and piped commands

It would be great if this extension would report the file as bad whenever the content matches this regex (without quotas): "([^\\\r\n]\r?\n[ \t]+\S+)"
Dunno whether that's the best match, but is the first one to come to mind. That's not perfect, because the continued line does not have to start with a space. But it often does. The split line also most likely won't match any of the valid field keys for that file (and may even start with a pipe) and should report an error anyway from that side.

Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions