cflint / CFLint

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

CFlint via -stdin no longer works/runs #699

Closed Edge-MarcG closed 3 years ago

Edge-MarcG commented 3 years ago

I've been using CFLint via VS Code and the plugin created by KamasamaK (https://github.com/KamasamaK/vscode-cflint) for quite some time successfully, however very recently the linter just stopped working altogether. I did quite a bit of debugging/troubleshooting and the way the plugin was designed to work, it would run on save/on load, but you could also run it manually and when running it manually, there were further options to specify generating the linter output in one of the formats CFlint supports and a target to place the output. None of these options work any longer at all.

In my troubleshooting, I discovered that with the developer debugger tools open in VSCode, when you run it to output to JSON for example, it shows you the command that it attempts to run to have the file linted and the output generated to JSON, An example of the command is as follows (note: this is abbreviated to remove full paths to the jar and the file being linted):

java.exe -jar \CFLint-1.5.0-all.jar -stdin \MyCFC.cfc -q -e -json -jsonfile \cflint-results-MyCFC-1611540759554.json

This command never generates any output at all in the target folder that it should have.

I then opened a command prompt window and attempted to run the same command from there and the linter starts, but then just hangs and does absolutely nothing else. In reviewing the command line parameters for CFLint, I found that it also supports using "-file" instead of "-stdin" and when I run the exact same command using "-file", the linter runs successfully and generates the expected output file. I have tested this on a few different systems, a couple that are Win10, one that is Server 2008 R2, and I observed the same exact behavior of the linter NOT running with "-stdin", but running fine with "-file".

I have logged an issue on the VS code plugin, seeking input and understanding as to why "-stdin" was used instead of "-file" (https://github.com/KamasamaK/vscode-cflint/issues/27) and am awaiting a response, but the fact that independent of the plugin I am seeing the behavior at the command line of "-stdin" just not running would seem to indicate some other issue with the core Linter itself.

As some additional notes, I did revert and try both 1.4.0 and 1.4.1 of the jar and the same behavior occurred there. I also attempted to use OpenJDK 8 as well, thinking maybe something with the Oracle JDK 8 was causing the issue, but that made no impact on the linter simply not running when doing -stdin.

Thanks again.

KamasamaK commented 3 years ago

Using -stdin means that the command will wait for stdin, so it will seem to hang. The path passed is just for reference in the output, but doesn't actually read that file. Using -file or -folder is correct for general usage.

Edge-MarcG commented 3 years ago

Thanks for the clarification on this, this issue is considered closed.