Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[MCHECKSTYLE-104] CheckstyleViolationCheckMojo: More flexible checkstyle:check-inflicted build failures

Open
#443 2 comments 0 reactions 0 assignees View on GitHub

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

enhancement priority:major

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:

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apache/maven-checkstyle-plugin

All issues in apache/maven-checkstyle-plugin

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.