CFLint icon indicating copy to clipboard operation
CFLint copied to clipboard

CFLint not finding default .cflintrc file

Open homestar9 opened this issue 5 years ago • 2 comments

Hello, I seem to have run into a problem with version 1.4.1 and the VS Code plugin where CFLint isn't finding my project root .cflintrc config file.

I opened an issue originally at the plugin repo, but was told the issue may be specific to CF Lint.

I opened the VS Code console and see the following debug output:

[Extension Host] [2019-03-24 12:56:23] C:\ProgramData\Oracle\Java\javapath\java.exe -jar D:\Dropbox\Settings\CFLint\CFLint-1.4.1-all.jar -stdin d:\Repositories\test-repo\models\agent\AgentForm.cfc -q -e -json -stdout

homestar9 avatar Apr 19 '19 20:04 homestar9

I've run into this as well, but it's more like CFLint is failing to apply the configuration in the file. If the file doesn't match the JSON schema or isn't valid JSON, it spits out a "Could not read config file" error: https://github.com/cflint/CFLint/blob/09723e3706b53c8507d26fbb05d69886f3d4b67d/src/main/java/com/cflint/CFLint.java#L276 And even when it doesn't, I can't get this config to alter the CFLint report:

{
    "rule": [ ],
    "excludes": [{
        "code": "UNUSED_METHOD_ARGUMENT"
    }, {
        "code": "ARGUMENT_TOO_SHORT"
    }, {
        "code": "UNUSED_METHOD_ARGUMENT"
    }],
    "includes": [],
    "inheritParent": true,
    "parameters": { }
}

michaelborn avatar Jul 23 '19 12:07 michaelborn

CFLint seems extremely picky about the .cflintrc file format, much more so than I remember from previous versions.

Given this .cflintrc file, CFLint ignores the lowercase rule name because it doesn't recognize it. (Note: no warning in the output that I can see.) It properly drops any FUNCTION_HINT_MISSING warnings, though, indicating it has indeed found the .cflintrc file.

{
	"excludes": [{
		"code": component_hint_missing"
	},{
		"code": "FUNCTION_HINT_MISSING"
	}]
}

But this .cflintrc file fails completely - dropping both rules and failing to apply any config at all, due to the uppercase CODE key. (And thus not matching the schema.) Once again, there is no warning in the output to indicate a misconfigured .cflintrc file.

{
	"excludes": [{
		"code": "COMPONENT_HINT_MISSING"
	},{
		"CODE": "FUNCTION_HINT_MISSING"
	}]
}

And as far as the includes config goes, CFLint ignores it completely. What is going on?

{
	"includes": [{
		"code": "COMPONENT_HINT_MISSING"
	},{
		"code": "FUNCTION_HINT_MISSING"
	}],
	"excludes": []
}

What's the chance we can support case-insensitive rule names, for starters? And output warnings when a config file is invalid, or a rule name is not found?

michaelborn avatar Aug 22 '19 00:08 michaelborn