cflint / CFLint

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

Rule COMPONENT_INVALID_NAME does not support camelCase as intended #696

Open CreativeNotice opened 3 years ago

CreativeNotice commented 3 years ago

When attempting to use camelCase for the ComponentNameChecker.case parameter I noticed it's still applying the PascalCase logic. Digging into the code it looks like the issue is an incomplete method isInvalidComponent() in ValidName.java.

Note the lack of use of the defined caseOk variable. Compare to the method just preceding isInvalid() which does utilize a similarly named variable.

{
    "rule": [],
    "excludes": [],
    "includes": [],
    "inheritParent": false,
    "parameters": {
        "ComponentNameChecker.case": "camelCase"
    }
}

Component name salesOrder is not a valid name. Please use camelCase and start with a capital letter. cflint(COMPONENT_INVALID_NAME) [1, 1]

I'm happy to tackle putting a PR together though can't tackle it immediately. If anyone else wants to tackle first, or perhaps the core team has some ideas on this one, please mention them below.

KamasamaK commented 3 years ago

Just be sure to include a new test and proper message (remove "and start with a capital letter") with your fix and your PR should be approved.