Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should lint ignore png files by default? #4

Open
taliaga opened this issue May 9, 2019 · 1 comment
Open

Should lint ignore png files by default? #4

taliaga opened this issue May 9, 2019 · 1 comment

Comments

@taliaga
Copy link

taliaga commented May 9, 2019

Hi,

Using codeclimate I came across an error (see message below) that won't let me run the rest of the code-climate suite.

I tend to think .png files should be excluded by default, but I'm not sure if this should be configured in this repo or in a different one. Wdyt?

We had trouble running the sonar-python engine.

The engine's output shown below may indicate the cause of the error.

If not, please contact us so we can investigate further.

INFO: Java 1.8.0_111-internal Oracle Corporation (64-bit)
INFO: Linux 4.4.0-1061-aws amd64
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/src/app/build/libs/sonarlint-core-2.17.0.899.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/src/app/build/libs/sonarlint-cli-2.1.0.566.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
INFO: Index files
INFO: Invalid character encountered in file '/code/src/geocoding/slf/slf-components.png' at line 1 for encoding UTF-8. Please fix file content or configure the encoding to be used using property 'sonar.sourceEncoding'.
INFO: Invalid character encountered in file '/code/docs/manuals.ja/rsrc/architecture.png' at line 1 for encoding UTF-8. Please fix file content or configure the encoding to be used using property 'sonar.sourceEncoding'.
INFO: Invalid character encountered in file '/code/docs/manuals.ja/rsrc/graph_example.png' at line 1 for encoding UTF-8. Please fix file content or configure the encoding to be used using property 'sonar.sourceEncoding'.
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 1.011s
INFO: Final Memory: 4M/232M
INFO: ------------------------------------------------------------------------
ERROR: Error executing SonarLint
ERROR: Failed to open a stream on file: /code/docs/manuals.ja/rsrc/crate_datasource.png
ERROR: Caused by: /code/docs/manuals.ja/rsrc/crate_datasource.png
ERROR: 
ERROR: To see the full stack trace of the errors, re-run SonarLint with the -e switch.
ERROR: Re-run SonarLint using the -X switch to enable full debug logging.

Cheers!

@wfleming
Copy link

wfleming commented May 9, 2019

This looks like an issue with https://github.com/codeclimate/codeclimate-ss-analyzer-wrapper: that repo defines the wrapper code that is used in our various sonar plugins. It is responsible for walking the various files permitted to be analyzed and then handing them off the Sonar implementation. The sonar implementation then decides if it's a file it actually cares about, but it looks like it probably doesn't handle binary files correctly.

I don't know when we might be able to fix this, but pull requests on that repo are welcome if you're interested in looking into it. I think the logic to expand would be somewhere in https://github.com/codeclimate/codeclimate-ss-analyzer-wrapper/tree/master/src/main/java/cc/files.

Or if you'd rather just work around the issue you can adjust your Code Climate configuration to exclude pngs files.

We don't exclude pngs (or almost any file extension) by default because our default excludes are global, and we wouldn't want to preclude support for a new plugin that analyzed that file type. (E.g. I could imagine a plugin that might analyze pngs to ensure they were optimized/small enough.)

@wfleming wfleming removed their assignment Jun 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants