From: gmungoc Date: Thu, 25 Aug 2016 16:11:15 +0000 (+0100) Subject: JAL-1854 initial checkstyle config X-Git-Tag: Release_2_10_0~78 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=a568079da73307926d3ce729816556036c51e189;hp=45a15211723195c363f1798dd9f0907ea6c28f08;p=jalview.git JAL-1854 initial checkstyle config --- diff --git a/.checkstyle b/.checkstyle new file mode 100644 index 0000000..c2a7260 --- /dev/null +++ b/.checkstyle @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/resources/checkstyle/README.txt b/resources/checkstyle/README.txt new file mode 100644 index 0000000..7ad1268 --- /dev/null +++ b/resources/checkstyle/README.txt @@ -0,0 +1,65 @@ +Checkstyle for Jalview +---------------------- + +http://checkstyle.sourceforge.net/ +GNU LGPL + +To get the Eclipse Checkstyle plugin +------------------------------------ + - Help | Eclipse Marketplace + - search for checkstyle + - install eclipse-cs checkstyle plugin +The current version is 6.19.1 (August 2016). + +Config +------ + + File Jalview/.checkstyle holds configuration for the "JalviewCheckstyle" ruleset. + This includes confining its scope to src/*.java and resources/*.properties. + This can be modified interactively through the checkstyle properties editor. + + Checkstyle config files in resources/checkstyle: + checkstyle.xml : main configuration file with selected checkstyle modules + checkstyle-suppress.xml : rules to exclude certain checks / files + import-control.xml : package import rules + + Checkstyle error messages can be customised. I've done this for TypeName as an example. + +How to use checkstyle +--------------------- + + Option 1: enable it for the Jalview project + - right-click on project | Checkstyle | Activate Checkstyle + - notice CheckstyleNature gets added to the .project file + - don't commit this file unless we all agree to! + - Checkstyle will run as you recompile changed code + - checking the whole project can be slow and may hang - not recommended for now + + Option 2: on selected code + - right-click on a class or package and Checkstyle | Check code with checkstyle + +Checkstyle rules +---------------- + Documented at http://checkstyle.sourceforge.net/checks.html + Should be self-documenting in checkstyle.xml + Open for discussion: + - which rules to use + - what naming and layout standards to apply + - settings for complexity metrics + - whether any rules should report error instead of warning + +Gotchas +------- + Sometimes checkstyle needs a kick before it will refresh its findings. + A whitespace edit in checkstyle.xml usually does this. There may be better ways. + + Invalid configuration files may result in checkstyle failing with an error reported + in the Eclipse log file. + Help | Installation Details | Configuration takes you to a screen with a + 'View Error Log' button. + + Sometimes checkstyle can fail silently. Try 'touching' (editing) config files, failing + that, carefully check / back out / redo any recent changes to its config. + + Putting inside a checkstyle causes it to be ignored! + \ No newline at end of file diff --git a/resources/checkstyle/checkstyle-suppress.xml b/resources/checkstyle/checkstyle-suppress.xml new file mode 100644 index 0000000..0c1d2ee --- /dev/null +++ b/resources/checkstyle/checkstyle-suppress.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/resources/checkstyle/checkstyle.xml b/resources/checkstyle/checkstyle.xml new file mode 100644 index 0000000..46d4bd7 --- /dev/null +++ b/resources/checkstyle/checkstyle.xml @@ -0,0 +1,560 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/checkstyle/import-control.xml b/resources/checkstyle/import-control.xml new file mode 100644 index 0000000..36a29f0 --- /dev/null +++ b/resources/checkstyle/import-control.xml @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file