cflint / CFLint

Static code analysis for CFML (a linter)
BSD 3-Clause "New" or "Revised" License
174 stars 84 forks source link

Allow exceptions for variable name length tests #535

Open SebastianZ opened 6 years ago

SebastianZ commented 6 years ago

People may want to generally disallow short variables, though allow one-character variable names like i for indexes.

Therefore there should be a parameter that allows to define a comma separated list of exceptions when checking variable names.

Sebastian

TheRealAgentK commented 6 years ago

Not sure I like the idea of a comma-separated list for exceptions. How do other linters, e.g. for JS handle this?

KamasamaK commented 6 years ago

I'm not aware of any other linters that even have rules related to variable name length. The closest thing I've found to accomplish that is one that allows passing a regular expression to validate names against.

Regarding this request in particular, I'm not really sure about it either.

ryaneberly commented 6 years ago

Right or wrong we have the pattern for params with csv. Example from cflint.definition.json:

            {
                "name": "ignoreUpperCaseScopes",
                "value": "CGI,URL"
            },

I would be a fan of moving to a single regex based rule.