aaschmid / gradle-cpd-plugin

Gradle plugin to find duplicate code using PMDs copy/paste detection (= CPD).
Apache License 2.0
95 stars 12 forks source link

Deprecation Message: The option skipLexicalErrors is deprecated. Use failOnError instead. #75

Open vector-jnajjar opened 1 month ago

vector-jnajjar commented 1 month ago

The newest version of CPD (from PMD 7.3.0) deprecated this option. It is read from in de.aaschmid.gradle.plugins.cpd.CpdExtension#skipLexicalErrors and written from the taskMapping in com.vector.cfg.build.cfgpmd.cpd.CfgCpdPlugin#setupTaskDefaults

Could you please update this to failOnError.

See https://github.com/pmd/pmd/blob/master/docs/pages/release_notes_old.md#deprecated-api for details.

aaschmid commented 1 month ago

Thanks. Do you have a clue how the already existing option ignoreFailures from Gradle itself acts in that regard, or can you try it?

Edit: also I am currently not sure if this is also a behavioral change as skip lexical errors has only skipped parsing errors and now all errors are considered ...

jhonnen commented 4 weeks ago

VerificationTask.ignoreFailures is not a replacement, as this would not fail the build anymore on duplicated code.

aaschmid commented 4 weeks ago

But as far as I understood failOnError does the same with!

vector-jnajjar commented 4 weeks ago

Hi Andreas,

https://docs.pmd-code.org/apidocs/pmd-core/7.3.0/net/sourceforge/pmd/cpd/CPDConfiguration.html#setSkipLexicalErrors(boolean) states that the new flag also configures whether lexical errors should fail the build or not.

But as I read https://github.com/pmd/pmd/blob/6f505b965c028c17847cbc50d6ff431af0a22f5a/pmd-cli/src/main/java/net/sourceforge/pmd/cli/internal/CliExitCode.java#L36

or https://docs.pmd-code.org/apidocs/pmd-core/7.3.0/net/sourceforge/pmd/AbstractConfiguration.html#setFailOnError(boolean)

I feel like there is a difference between fail-on-error and fail-on-violation.

aaschmid commented 4 weeks ago

Ok, I will try to add this option within the next days (PR also welcome) if I find the time...