[MCHECKSTYLE-104] CheckstyleViolationCheckMojo: More flexible checkstyle:check-inflicted build failures
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 43/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- java
- Domain
- build-system
Research direction
Start with maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleViolationCheckMojo.java and review the related MCHECKSTYLE-113 issue. Check how the proposed maxErrors, maxWarnings, and maxInfos configuration should affect build failures, then add the documentation and test cases requested in the issue; done means thresholds can be configured independently.
Written by the indexing model from the issue text.
Description
Kaloyan Enimanev opened MCHECKSTYLE-104 and commented
Hey guys,
first of all let me thank you for the wonderful job that you all do. Our company's build process has rocketed a century forward after we replaced Ant with Maven.
We're currently trying to migrate from Maven1 to Maven2. We have a Jelly goal in our old M1 build that does similar job to "checkstyle:check" in M2, but it verifies that a project does not have more than X Checkstyle Errors and Y Checkstyle Warnings. That was not entirely possible to configure with M2, where one can choose to fail the build on more than 0 Errors or Warnings, where 0 is not a configurable value in contrast with X and Y.
I have scribbled several changes in
/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleViolationCheckMojo.java
where I basically replaced the parameter violationSeverity with 3 new parameters (maxErrors, maxWarnings, maxInfos) allowing the user a more flexible configuration of checkstyle-inflicted build failures.
Example :
The configuration
<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<failsOnError>true</failsOnError>
<maxErrors>0</maxErrors>
<maxWarnings>100</maxWarnings>
.....
</configuration>
......
will fail the build of a project that has more than 0 Checkstyle Errors or more than 100 Checkstyle Warnings.
If you find such the feature useful and want to include it in some of the next releases of maven-checkstyle-plugin I will be happy to do the additional Documentation/Test Cases.
Affects: 2.2
Attachments:
- CheckstyleViolationCheckMojo.java (7.99 kB)
Issue Links:
- MCHECKSTYLE-113 Set the number of accepted violations for checkstyle:check
1 votes, 3 watchers
- Dominant language
- Java
- Stars
- 98
- Forks
- 69
- Avg merge
- 12h 42m
- Merged PRs (30d)
- 6
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/maven-checkstyle-plugin
-
maintenance
Difficulty 2/5 1-3 hours Newbie friendliness 55/100
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 38/100
-
Update dependencies.May be free again A pull request for this issue was closed without being merged. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 55/100
-
DefaultCheckstyleExecutor should be a failure, not an errorPossibly taken @efegokdemir claimed this 36 days ago. Openbug
Difficulty 3/5 1-2 days Newbie friendliness 58/100
apache/maven-checkstyle-plugin#656 · 1 comment ·
-
Add ability to print warnings when `failOnViolation: true` and `violationSeverity: error`Possibly taken @efegokdemir claimed this 34 days ago. Openenhancement
Difficulty 3/5 1-2 days Newbie friendliness 50/100
apache/maven-checkstyle-plugin#648 · 5 comments ·
All issues in apache/maven-checkstyle-plugin
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
snowflakedb/snowflake-kafka-connector#1610 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
swagger-api/swagger-petstore#245 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
liquid-java/liquidjava#443 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
quarkiverse/quarkus-google-cloud-services#1188 ·
Maintainers usually reply within 1 day