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

./gradlew clean build --profile produced spurious PMD errors #2776

Closed
sjudd opened this issue Dec 31, 2017 · 3 comments
Closed

./gradlew clean build --profile produced spurious PMD errors #2776

sjudd opened this issue Dec 31, 2017 · 3 comments

Comments

@sjudd
Copy link
Collaborator

sjudd commented Dec 31, 2017

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':library:violations'.
> javax.script.ScriptException: Too many violations found, max is 0 but found 3
  /Users/judds/opensource/glide/library/src/main/java/com/bumptech/glide/load/engine/Engine.java
  ╔══════════╤═════════════════════╤══════════╤══════╤══════════════════════════════════════════════════════════════════════════════════════════════════════╗
  ║ Reporter │ Rule                │ Severity │ Line │ Message                                                                                              ║
  ╠══════════╪═════════════════════╪══════════╪══════╪══════════════════════════════════════════════════════════════════════════════════════════════════════╣
  ║ PMD      │ UnusedPrivateMethod │ WARN     │ 255  │ Avoid unused private methods such as 'loadFromCache(Key,boolean)'.                                   ║
  ║          │                     │          │      │                                                                                                      ║
  ║          │                     │          │      │                                                                                                      ║
  ║          │                     │          │      │ Best Practices https://pmd.github.io/pmd-6.0.0/pmd_rules_java_bestpractices.html#unusedprivatemethod ║
  ╟──────────┼─────────────────────┼──────────┼──────┼──────────────────────────────────────────────────────────────────────────────────────────────────────╢
  ║ PMD      │ UnusedPrivateMethod │ WARN     │ 243  │ Avoid unused private methods such as 'loadFromActiveResources(Key,boolean)'.                         ║
  ║          │                     │          │      │                                                                                                      ║
  ║          │                     │          │      │                                                                                                      ║
  ║          │                     │          │      │ Best Practices https://pmd.github.io/pmd-6.0.0/pmd_rules_java_bestpractices.html#unusedprivatemethod ║
  ╟──────────┼─────────────────────┼──────────┼──────┼──────────────────────────────────────────────────────────────────────────────────────────────────────╢
  ║ PMD      │ UnusedPrivateMethod │ WARN     │ 238  │ Avoid unused private methods such as 'logWithTimeAndKey(String,long,Key)'.                           ║
  ║          │                     │          │      │                                                                                                      ║
  ║          │                     │          │      │                                                                                                      ║
  ║          │                     │          │      │ Best Practices https://pmd.github.io/pmd-6.0.0/pmd_rules_java_bestpractices.html#unusedprivatemethod ║
  ╚══════════╧═════════════════════╧══════════╧══════╧══════════════════════════════════════════════════════════════════════════════════════════════════════╝
  
  Summary of /Users/judds/opensource/glide/library/src/main/java/com/bumptech/glide/load/engine/Engine.java
  ╔══════════╤══════╤══════╤═══════╤═══════╗
  ║ Reporter │ INFO │ WARN │ ERROR │ Total ║
  ╠══════════╪══════╪══════╪═══════╪═══════╣
  ║ PMD      │ 0    │ 3    │ 0     │ 3     ║
  ╟──────────┼──────┼──────┼───────┼───────╢
  ║          │ 0    │ 3    │ 0     │ 3     ║
  ╚══════════╧══════╧══════╧═══════╧═══════╝
  
  
  Summary
  ╔══════════╤══════╤══════╤═══════╤═══════╗
  ║ Reporter │ INFO │ WARN │ ERROR │ Total ║
  ╠══════════╪══════╪══════╪═══════╪═══════╣
  ║ PMD      │ 0    │ 3    │ 0     │ 3     ║
  ╟──────────┼──────┼──────┼───────┼───────╢
  ║          │ 0    │ 3    │ 0     │ 3     ║
  ╚══════════╧══════╧══════╧═══════╧═══════╝


* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org
@sjudd sjudd changed the title ./gradlew clean build --parallel produced spurious PMD errors ./gradlew clean build --profile produced spurious PMD errors Dec 31, 2017
@sjudd
Copy link
Collaborator Author

sjudd commented Dec 31, 2017

Not reproducible with just ./gradlew build, so --profile is doing something strange...

sjudd added a commit to sjudd/glide that referenced this issue Dec 31, 2017
@TWiStErRob
Copy link
Collaborator

Do you have the --profile output still? Check if there's a javac in it. I think PMD may be missing a dependency on "compileDebugWithJavac" so that it can pull in classpath += files("${project.buildDir}/intermediates/classes/debug/"), see pmd/pmd#819

@TWiStErRob
Copy link
Collaborator

TWiStErRob commented Jan 1, 2018

You don't need --profile to reproduce this issue: gradlew :l:clean :l:pmd, currently gives me:

1	com\bumptech\glide\RequestBuilder.java	873	Avoid unused private methods such as 'buildRequest(Target,RequestListener,RequestOptions)'.
2	com\bumptech\glide\load\engine\Engine.java	238	Avoid unused private methods such as 'logWithTimeAndKey(String,long,Key)'.
3	com\bumptech\glide\load\engine\Engine.java	243	Avoid unused private methods such as 'loadFromActiveResources(Key,boolean)'.
4	com\bumptech\glide\load\engine\Engine.java	255	Avoid unused private methods such as 'loadFromCache(Key,boolean)'.
5	com\bumptech\glide\request\RequestOptions.java	1153	Avoid unused private methods such as 'scaleOnlyTransform(DownsampleStrategy,Transformation)'.
6	com\bumptech\glide\request\RequestOptions.java	1159	Avoid unused private methods such as 'optionalScaleOnlyTransform(DownsampleStrategy,Transformation)'.

(the first one is probably introduced when I refactored that class in #2777)

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