SAP / ui5-linter

A static code analysis tool for UI5
Apache License 2.0
50 stars 4 forks source link

linter ignores ignore-pattern #407

Open ehwg opened 2 days ago

ehwg commented 2 days ago

Expected Behavior

When I run npm run ui5-lint --ignore-pattern "webapp/test/locate-reuse-libs.js" > ui5linter.txt I would expect to get everything except the reuse-libs

In the log I see.

> md.crmdg.prod.gov@0.0.1 ui5-lint
> ui5lint --format markdown webapp/test/locate-reuse-libs.js

# UI5 linter Report
## Summary

...

# UI5 linter Report
## Summary

> nn problems (nn errors, 0 warnings)  

## Findings
### webapp\test\locate-reuse-libs.js

| Severity | Line | Message |
|----------|------|---------|
| Error | `62:13` | Access of globXXXXX |

Current Behavior

I get only the results for the reuse lib:

Steps to Reproduce the Issue

You can run the command mentioned above

Context

Log Output / Stack Trace

There is nothing additionally in the verbose mode.
matz3 commented 2 days ago

Could you please share the content of your ui5-lint script in the package.json?

To me this seems to be caused by the missing separation of arguments when using npm run, see https://docs.npmjs.com/cli/v7/commands/npm-run-script#description

In that case, the correct command would be npm run ui5-lint -- --ignore-pattern "webapp/test/locate-reuse-libs.js" > ui5linter.txt

matz3 commented 41 minutes ago

Update on this one:

We were able to get the file redirect working. Worth noting is that when using the default text formatter, the output is printed into stderr. The file-specific formatters (e.g. json or markdown) print to stdout.

One issue that still remained was that not all references of a file to be ignored via --ignore-pattern were working as expected. --ignore-pattern "webapp/test/locate-reuse-libs.js" works, but --ignore-pattern "./webapp/test/locate-reuse-libs.js" did not work. This was reproducible in Git Bash on Windows.