KamasamaK / vscode-cflint

An extension to integrate CFLint into Visual Studio Code.
MIT License
17 stars 9 forks source link

cflintrc excludes not working #3

Closed rsmolkin closed 6 years ago

rsmolkin commented 7 years ago

Most likely this has to do with Info and Warnings. Are they treated differently with excludes?

If I do this in vscode config:

"cflint.ignoreInfo": true,
"cflint.ignoreWarnings": true

they Info and Warning messages disappear. But I don't want to turn all of them off, just the rules I picked in excludes...

I've tried this with 1.2.3 and 1.2.0 jar files, at first I thought maybe it was related to the issue you mentioned in 1.2.2 that hasn't been resolved yet.

But when I add a .cflintrc file with the following, it seems to continue to report all those rules.

{
  "rule" : [ ],
  "excludes" : [
    {"code": "VAR_HAS_PREFIX_OR_POSTFIX"},
    {"code": "MISSING_VAR"},
    {"code": "VAR_INVALID_NAME"},
    {"code": "MISSING_VAR"},
    {"code": "FUNCTION_TOO_COMPLEX"},
    {"code": "VAR_IS_TEMPORARY"},
    {"code": "SCOPE_ALLCAPS_NAME"}
  ], 
  "includes": [ ],
  "inheritParent" : true
}

EDITED: Fixed formatting (KamasamaK)

KamasamaK commented 7 years ago

Can you please describe what you mean by "not working"? Is it not showing any results when you have this .cflintrc file or is it just ignoring the excludes?

You should remove the ignoreInfo and ignoreWarnings settings for the purposes of testing. Those settings are unrelated to the .cflintrc and are filters applied after CFLint generates its results.

Please provide all of your cflint settings for VS Code. Also, where is your .cflintrc file placed in relation to the file being linted?

rsmolkin commented 7 years ago

If I switch the jar file to 1.2.0 it does run with the .cflintrc present.

I removed the ingoreInfo and ifnoreWarnings settings, so that defaults to false again.

Now it outputs all the warning and info messages, even though I put those rules in excludes. For example:

severity: 'Warning' message: 'FUNCTION_TOO_COMPLEX: Function is too complex. Consider breaking the function into smaller functions.' at: '1,1' source: 'cflint'

KamasamaK commented 7 years ago

Ok. I still need what's requested in my third paragraph above. Also, please open Help > Toggle Developer Tools and copy/paste the command being executed on the CFLint jar file.

rsmolkin commented 7 years ago

Ok, the command that runs as shown in Developer Tools is: [Extension Host] [08:18:40] C:\ProgramData\Oracle\Java\javapath\java.exe -jar C:\www\CFLint-1.2.0-all.jar -stdin c:\www\scoring\SrJr\scoringadmin\score_group.cfm -q -e -json -stdout -configfile c:\www\scoring\.cflintrc

The cflint file is at the root of the project (c:\www\scoring\.cflintrc)

This is the only setting I have in User Settings for cflint: // A path to the CFLint standalone JAR file (CFLint-*-all.jar). "cflint.jarPath": "C:\\www\\CFLint-1.2.0-all.jar"

EDIT: Fixed formatting issues due to unescaped backslashes (KamasamaK)

KamasamaK commented 7 years ago

Thanks. I do not immediately see anything wrong. Due to your comment in cflint/CFLint#485 that it doesn't even work directly from the command line, it would probably be best to move the focus there.

sebduggan commented 6 years ago

I'm seeing the same problem. If I run the command output in the dev tools directly from the command line, it just hangs and doesn't produce a result.

If I remove the -configfile argument, it works fine; and if I keep the -configfile and change -stdin to -file, it works fine while using the specified .cflintrc.

It seems there's an issue in CFLint itself (I'm using 1.2.3) when you combine -stdin and -configfile. I'll raise this with the CFLint project, but is there a reason you can't specify either -file or -folder in the extension, depending on which you need to use? I know it's easier just to use -stdin for both, but it seems this would fix the issue...

KamasamaK commented 6 years ago

I can confirm that -stdin does work, even with -configfile, and there are many other people who can use this extension fine. The reason that is used instead of -file is to be able to pass the full text of the document into stdin since in the case where the user has enabled onChange in runModes it will not have been saved to disk.

Please try using v1.2.0 instead since v1.2.2+ has an issue as indicated in the README.

sebduggan commented 6 years ago

Thanks - I'd missed that bit of the readme. Works fine now!