apache / apache/maven-checkstyle-plugin

Maven checkstyle does not support comma separated list for custom import order

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

Description

### Affected version

3.6.1-SNAPSHOT

### Bug description

The custom import order rule https://checkstyle.sourceforge.io/checks/imports/customimportorder.html has deprecated the `###` as a delimiter for the order of packages in the custom import order.

A comma separated list can be passed but is not supported by maven checkstyle:
```





```

Fails with
```
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-site-plugin:3.20.0:site (default-site) on project MCHECKSTYLE-357: Error generating maven-checkstyle-plugin:3.6.1-SNAPSHOT:checkstyle report: Failed during checkstyle configuration: cannot initialize module TreeWalker - cannot initialize module CustomImportOrder - Cannot set property 'customImportOrderRules' to 'STATIC, STANDARD_JAVA_PACKAGE, THIRD_PARTY_PACKAGE': InvocationTargetException: Unexpected rule: STATIC, STANDARD_JAVA_PACKAGE, THIRD_PARTY_PACKAGE -> [Help 1]
```

For a minimal example you can edit `src/it/MCHECKSTYLE-357/pom.xml` to use the new syntax and then run it with
`mvn invoker:run -Dinvoker.test=MCHECKSTYLE-357` to see the above error.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the minimal example in src/it/MCHECKSTYLE-357/pom.xml and run mvn invoker:run -Dinvoker.test=MCHECKSTYLE-357 to reproduce the CustomImportOrder failure. Read the plugin code involved in processing customImportOrderRules, then verify that the comma-separated configuration runs successfully through the integration test.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.