apache / apache/maven-checkstyle-plugin

[MCHECKSTYLE-444] Support exclusion of generated (test) resources

Open
#356 2 comments 0 reactions 0 assignees View on GitHub
bug priority:major
Dominant language
Java
Stars
97
Forks
67
Avg merge
14h 50m
Merged PRs (30d)
6

Description

**[Stephan Schroevers](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=stephan202)** opened **[MCHECKSTYLE-444](https://issues.apache.org/jira/browse/MCHECKSTYLE-444?redirect=false)** and commented

In the context of MCHECKSTYLE-412 a new `excludeGeneratedSources` option was introduced. This feature does not exclude generated {_}resources{_}, however. Generated resources are not uncommon:
1. The [license-maven-plugin](https://github.com/mojohaus/license-maven-plugin) attaches a `THIRD-PARTY.txt` file.
2. The [hisrc-basicjaxb plugin](https://github.com/patrodyne/hisrc-basicjaxb) attaches a `META-INF/sun-jaxb.episode` file, located in a directory that also contains generated sources ((!)).

As a result, if one sets

```xml
true
**/*
```

Then the plugin will flag `THIRD-PARTY.txt` files (not completely unexpected) as well as XJC-generated Java files (very unexpected).

Possible fixes:
1. Update the `excludeGeneratedSources` flag to also cover (test) resource directories.
2. Introduce an analogous `excludeGeneratedResources` flag.

(The first option may seem less flexible, but would be less surprising i.c.w. plugins that generate sources and resources into the same directory, as in example (2) above.)

I'm open to contributing a PR for this change; it would be nice to first hear from the maintainers whether they prefer approach (1) or (2).

---

**Affects:** 3.3.1

**Issue Links:**
- [MCHECKSTYLE-412](https://issues.apache.org/jira/browse/MCHECKSTYLE-412) Add option to exclude generated sources/test-sources from default source/test-source directories

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing the existing excludeGeneratedSources option and how generated source, test-source, and resource directories are selected. Compare the two proposed approaches, then verify the chosen behavior with cases covering generated resources and shared generated source/resource directories; done means those resources are no longer unexpectedly checked.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.