npm-groovy-lint icon indicating copy to clipboard operation
npm-groovy-lint copied to clipboard

--ignorepattern no longer works from the command line

Open cr3 opened this issue 1 year ago • 7 comments

Since 10.0.0, npm-groovy-lint --ignorepattern '**/node_modules/**/*'... no longer ignores the given pattern. This seems to be caused by revno b73117a, " Refactor input args + New rules + fixes (#224)", which contains this change:

     // Ignore pattern
     if (options.ignorepattern) {
-        result.codenarcArgs.push(`-excludes=${options.ignorepattern}`);
+        result.codenarcArgs.push(`-excludes="${options.ignorepattern}"`);
         result.codeNarcExcludes = options.ignorepattern;
     }

It seems that this results in narc trying to exclude "**/node_modules/**/*", including the double quotes. This is because the single arg -excludes="**/node_modules/**/*" is being passed to the java-caller such that narc is interpreting the excludes as everything after the = character.

cr3 avatar Aug 25 '22 19:08 cr3

Are you using 10.1.0 ?

I can't reproduce the issue :/ I tried in lib/example of this repo (there is a test case for that)

npm-groovy-lint' lints 13 files

npm-groovy-lint --ignorepattern '**/fake_node_modules/**' lints 12 files

npm-groovy-lint --ignorepattern "**/fake_node_modules/**" lints 12 files

npm-groovy-lint --ignorepattern **/fake_node_modules/** lints 12 files

npm-groovy-lint --ignorepattern **/fake_node_modules/**/* lints 12 files

npm-groovy-lint --ignorepattern '**/fake_node_modules/**/*' lints 12 files

npm-groovy-lint --ignorepattern "**/fake_node_modules/**/*" lints 12 files

image

What version of npm-groovy-lint & os & node.js version are you using ?

nvuillam avatar Aug 25 '22 20:08 nvuillam

npm-groovy-lint==10.1.0 and node==v16.13.1.

npm-groovy-lint --ignorepattern '**/node_modules/**/*' --loglevel warning --failon warning --no-insight --javaexecutable=/usr/bin/java --noserver
...
myproject/node_modules/@react-native-community/cli-platform-android/native_modules.gradle
  75    warning  The type ArrayList should be replaced with an interface or more general parent class  ImplementationAsType
...

Could the problem be the --noserver part because I noticed something about "server" in the source that did some substitution for =" to =.

cr3 avatar Aug 25 '22 20:08 cr3

Same :/

npm-groovy-lint --noserver -> 13 linted files

npm-groovy-lint --ignorepattern '**/fake_node_modules/**/*' --noserver -> 12 linted files

What command line do you use ? bash ? powershell ? cmd ?

nvuillam avatar Aug 25 '22 20:08 nvuillam

I saw you forked the repo

To try to reproduce and debug, you can use

npm link
npm run groovy:run-server-from-source

In the console of the groovy server you'll see the sent arguments

image

nvuillam avatar Aug 25 '22 20:08 nvuillam

I get "permission denied" when running the commands you suggested:

% npm link

up to date, audited 3 packages in 828ms

found 0 vulnerabilities
% npm run groovy:run-server-from-source

> [email protected] groovy:run-server-from-source
> npm run dev:kill-server && groovy -cp "lib/java/CodeNarc-3.1.0.jar;lib/java/groovy/lib/groovy-3.0.9.jar;lib/java/groovy/lib/groovy-templates-3.0.9.jar;lib/java/groovy/lib/groovy-xml-3.0.9.jar;lib/java/groovy/lib/groovy-json-3.0.9.jar;lib/java/groovy/lib/groovy-ant-3.0.9.jar;lib/java/groovy/lib/ant-1.10.11.jar;lib/java/groovy/lib/ant-launcher-1.10.11.jar;lib/java/slf4j-api-1.7.9.jar;lib/java/log4j-slf4j-impl-2.18.0.jar;lib/java/log4j-api-2.18.0.jar;lib/java/log4j-core-2.18.0.jar;lib/java/GMetrics-2.1.0.jar" groovy/src/main/com/nvuillam/CodeNarcServer.groovy --server


> [email protected] dev:kill-server
> npm-groovy-lint --killserver

sh: 1: npm-groovy-lint: Permission denied

cr3 avatar Aug 26 '22 15:08 cr3

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

If you think this issue should stay open, please remove the O: stale 🤖 label or comment on the issue.

github-actions[bot] avatar Sep 26 '22 02:09 github-actions[bot]

Can you try with sudo ?

nvuillam avatar Sep 26 '22 04:09 nvuillam

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

If you think this issue should stay open, please remove the O: stale 🤖 label or comment on the issue.

github-actions[bot] avatar Oct 27 '22 01:10 github-actions[bot]