wdl icon indicating copy to clipboard operation
wdl copied to clipboard

Add new lint rule detecting malformed lint directives

Open a-frantz opened this issue 5 months ago • 4 comments

First, a definition of lint directive:

          \"lint directives\" are special comments that begin with `#@ except:` followed by a \
         comma-delimited list of rule IDs. These comments are used to disable specific lint rules \
         for a specific section of the document. When a lint directive is encountered in the \
         preamble, it will disable the specified rules for the entire document.

The space between #@ and except: (and the inclusion of the colon) are currently required. Do we want to loosen that requirement? Allow #@except: or something? My gut says "no" but perhaps worth a discussion. I do think we want to warn users if they have something resembling a lint directive that isn't being parsed as one.

Some brainstorming here (i.e. not 100% certain of the following and there may be checks we want that aren't included):

If a comment starts with #@ it should be a well-formed lint directive. We may expand lint directives to include keywords other than except:, so this rule should be written in a way that can be easily updated.

We already have an UnknownRule check (pending the merging of #162 ) so that's covered.

Right now we are agnostic about whitespace between rule IDs (but the comma is required). I propose we add a lint for ensuring a single space follows each comma. IMO this makes the list easier to read. Lint directives should still work without that space though. No tabs should be allowed in a lint directive.

a-frantz avatar Sep 12 '24 16:09 a-frantz