Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/blundell/createyourowncheckstylecheck
How to write a custom CheckStyle check and incorporate it into your Maven project
https://github.com/blundell/createyourowncheckstylecheck
Last synced: about 2 months ago
JSON representation
How to write a custom CheckStyle check and incorporate it into your Maven project
- Host: GitHub
- URL: https://github.com/blundell/createyourowncheckstylecheck
- Owner: blundell
- Created: 2012-12-21T17:25:07.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2020-10-20T08:42:24.000Z (about 4 years ago)
- Last Synced: 2024-10-31T17:44:37.957Z (about 2 months ago)
- Language: Java
- Homepage: http://blog.blundellapps.com/create-your-own-checkstyle-check/
- Size: 27.3 KB
- Stars: 25
- Watchers: 4
- Forks: 17
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
CreateYourOwnCheckStyleCheck
============================Contains two projects
- **TestProject** contains the poorly written Java code that will have checkstyle ran on it
- **BlundellCheckstyle** contains the custom checkstyle checks that have been written
How it works
- **TestProject** uses the maven-checkstyle-plugin
- the maven-checkstyle-plugin has a dependency on **BlundellCheckStyle**
- **BlundellCheckstyle** is where we create the custom checks
- the maven-checkstyle-plugin then uses a *checkstyle-configuration.xml* file to declare what checks we want checkstyle to run
- within checkstyle-configuration.xml we declare our custom checks from **BlundellCheckStyle**How to run checkstyle
- from a Terminal
- run mvn install
- go into the TestProject folder
- run mvn checkstyle:checkstyle
- open up target/site/checkstyle.html to see style errorsCurrent Limitations
- in *checkstyle-configuration.xml* we have to use the full package of the check *com.blundell.checks.AntiHungarian*
- this can be fixed by declaring a *checkstyle-packages.xml* **this currently doesn't work***checkstyle-packages.xml* would looks something like this:
```xml
```
and you would add it to the maven-checkstyle-plugin declaration// There are multiple ways to try this, I haven't found one that works
// so I do not want to document it herethen your checkstyle-configuration.xml would not need the package:
```xml
```