apache / apache/maven-checkstyle-plugin

[MCHECKSTYLE-394] Add support for scanning only changed files

Open
#306 1 comment 0 reactions 0 assignees View on GitHub
maintenance priority:minor
Dominant language
Java
Stars
97
Forks
67
Avg merge
14h 50m
Merged PRs (30d)
6

Description

**[Radek Antoniuk](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=warden)** opened **[MCHECKSTYLE-394](https://issues.apache.org/jira/browse/MCHECKSTYLE-394?redirect=false)** and commented

[Gradle plugin offers quite easy setup with git-ls](https://ebaytech.berlin/checkstyle-on-changed-files-with-gradle-1619e49dbe4e) to scan only the changed files for violations.

[The example githook here is obviously unacceptable](https://github.com/checkstyle/contribution/blob/master/hooks/git-pre-commit-hook.pl) as it requires the JAR file to be present somewhere which is redundant when checkstyle is configured in project's POM.

Would it be possible to add similar configurability to maven plugin to support something like:

 

```java
mvn -Dcheckstyle.includes='path/to/class.java' checkstyle:check
```

 

For some reason, the below thing works, but the above thing doesn't:

```
mvn -Dcheckstyle.includes='**/src/**/*.java' checkstyle:check
```

---
No further details from [MCHECKSTYLE-394](https://issues.apache.org/jira/browse/MCHECKSTYLE-394?redirect=false)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the two `mvn ... checkstyle:check` commands shown in the issue, comparing a single Java path with the working glob pattern. Trace the Maven plugin's handling of `checkstyle.includes`; done means a configured project can scan only the requested changed-file path without requiring a separate Checkstyle JAR.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.