Skip to content

Creation patch for checkstyle

Roman Ivanov edited this page Nov 24, 2013 · 15 revisions

this instructions are ourdated, as Checkstyle project was moved to Github(https://github.com/checkstyle/checkstyle), so please use Issue tracker on Github and contribute by Pull Request *.

the most recent info from Checkstyle project, contributing page.

Assuming that mercurial is already installed.
1. Clone upstream

$hg clone http://checkstyle.hg.sourceforge.net:8000/hgroot/checkstyle/checkstyle

2. Add your check to this recently cloned mercurial repo. Check, that all is normal:
...checstyle$mvn clean verify 

Should give no warnings. Your local repository will look like this:
...checkstyle$ hg st
M src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/messages.properties
? src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/MethodLimitCheck.java
? src/testinputs/com/puppycrawl/tools/checkstyle/coding/InputMethodLimitCheck.java
? src/tests/com/puppycrawl/tools/checkstyle/checks/coding/MethodLimitCheckTest.java

3. Add your newly created files to commit

...checkstyle$ hg add
adding src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/MethodLimitCheck.java
adding src/testinputs/com/puppycrawl/tools/checkstyle/coding/InputMethodLimitCheck.java
adding src/tests/com/puppycrawl/tools/checkstyle/checks/coding/MethodLimitCheckTest.java

4. Commit changes to your local mercurial repo
4.1. Make sure that your name is specified in the mercurial prefrences:
$ cat  ~/.hgrc
[ui]
username = John Smith <jsmith@example.com>

4.2. Perform the commit:
...checkstyle$ hg commit -m"MethodLimitCheck was introduced"

5. Prepare patch:\
...checkstyle$ hg export tip > ~/MethodLimitCheck.patch

6. Check that all is normal:
$cd ..
$hg clone http://checkstyle.hg.sourceforge.net:8000/hgroot/checkstyle/checkstyle checkstyle.check
$hg import ~/MethodLimitCheck.patch

Now you check should be in this (checkstyle.check) your local repo.
7. To prepare checkstyle-XXX-all.jar to test from console, run:
$mvn -Pdistro package

8. Send the MethodLimitCheck.patch to Ccheckstyle upstream.