Skip to content

Commit 62562eb

Browse files
authored
Update documentation (#435)
* Replace ESH with openHAB * Replace FindBugs with SpotBugs * Fix broken links and paths Signed-off-by: Wouter Born <github@maindrain.net>
1 parent 71c0e90 commit 62562eb

4 files changed

Lines changed: 43 additions & 32 deletions

File tree

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
[![EPL-2.0](https://img.shields.io/badge/license-EPL%202-green.svg)](https://opensource.org/licenses/EPL-2.0)
66
[![Bountysource](https://www.bountysource.com/badge/tracker?tracker_id=56481698)](https://www.bountysource.com/teams/openhab/issues?tracker_ids=56481698)
77

8-
The Static Code Analysis Tools is a Maven plugin that executes the Maven plugins for FindBugs, Checkstyle and PMD and generates a merged .html report.
8+
The Static Code Analysis Tools is a Maven plugin that executes the Maven plugins for SpotBugs, Checkstyle and PMD and generates a merged .html report.
99
It is especially designed for openHAB to respect the defined coding guidelines.
1010

1111
This project contains:
1212

13-
- properties files for the PMD, Checkstyle and FindBugs Maven plugins configuration in the `src/main/resources/configuration` folder;
14-
- rule sets for the plugins in the `src/main/resources/rulesets` folder;
15-
- custom rules for PMD, CheckStyle and FindBugs and unit tests for the rules;
13+
- properties files for the PMD, Checkstyle and SpotBugs Maven plugins configuration in the `sat-plugin/src/main/resources/configuration` folder;
14+
- rule sets for the plugins in the `sat-plugin/src/main/resources/rulesets` folder;
15+
- custom rules for PMD, CheckStyle and SpotBugs and unit tests for the rules;
1616
- tool that merges the reports from the individual plugins in a summary report.
1717

1818
## Essentials
@@ -23,5 +23,5 @@ This project contains:
2323

2424
## 3rd Party
2525

26-
- The example checks provided in the `static-code-analysis-config` (`MethodLimitCheck`, `CustomClassNameLengthDetector`, `WhileLoopsMustUseBracesRule`) are based on tutorials how to use the API of Checkstyle, FindBugs and PMD. For more info, see javadoc;
26+
- The example checks provided in the `static-code-analysis-config` (`MethodLimitCheck`, `CustomClassNameLengthDetector`, `WhileLoopsMustUseBracesRule`) are based on tutorials how to use the API of Checkstyle, SpotBugs and PMD. For more info, see javadoc;
2727
- The tool that merges the individual reports is based completely on source files from the https://github.com/MarkusSprunck/static-code-analysis-report that are distributed under a custom license. More information can be found in the [LICENSE](LICENSE) file.

docs/implement-check.md

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
# Integrating Custom Check Into The Tool
22

3-
The Static Analysis Tool provides the necessary infrastructure for custom check implementations using the API of FindBugs, Checkstyle and PMD.
3+
The Static Analysis Tool provides the necessary infrastructure for custom check implementations using the API of SpotBugs, Checkstyle and PMD.
44

55
Helpful links when writing a custom check for the first time may be:
66

7-
- for [Writing custom checks in Checkstyle](http://checkstyle.sourceforge.net/writingchecks.html#Writing_Checks);
8-
- for [Writing a custom PDM rule](http://pmd.sourceforge.net/pmd-4.3.0/howtowritearule.html);
9-
- for [Writing custom bug detectors for Findbugs](https://www.ibm.com/developerworks/library/j-findbug2/).
7+
- for [Writing custom checks in Checkstyle](https://checkstyle.sourceforge.io/writingchecks.html#Writing_Checks);
8+
- for [Writing a custom PMD rule](https://pmd.github.io/latest/pmd_userdocs_extending_writing_rules_intro.html);
9+
- for [Writing custom bug detectors for SpotBugs](https://spotbugs.readthedocs.io/en/stable/implement-plugin.html).
1010

1111
In this guide we will use the Checkstyle API, because it is easy to use, supports different file extensions and languages.
1212

13-
If you haven't set up the IDE for openHAB, please visit the [openHAB IDE Setup page](https://www.openhab.org/docs/developer/development/ide.html).
13+
If you haven't set up the IDE for openHAB, please visit the [openHAB IDE Setup page](https://www.openhab.org/docs/developer/#setup-the-development-environment).
1414

1515
## Create an Eclipse project
1616

17-
After checking out the repository on your local machine execute `mvn eclipse:eclipse` in project root directory. This will generate an Eclipse project, containing the `.classpath` and `.project` files. You are ready to import the project in Eclipse.
17+
After checking out the repository on your local machine execute `mvn eclipse:eclipse` in project root directory.
18+
This will generate an Eclipse project, containing the `.classpath` and `.project` files.
19+
You are ready to import the project in Eclipse.
1820

1921
> Hint! Depending on your Java installation the static-code-analysis project might not find tools.jar. Please make sure that the folder containing the tools.jar is included in the PATH variable (for Windows) and rerun mvn eclipse:eclipse.
2022
@@ -26,11 +28,13 @@ The first answer that you would have to answer before staring is what kind of fi
2628
- for **none .java** files extend the `org.openhab.tools.analysis.checkstyle.api.AbstractStaticCheck`. We have included there some helpful methods for processing different types of files and others, take a look at the javadoc for detailed information;
2729
- for **.java** files you will most probably have to extend `com.puppycrawl.tools.checkstyle.api.AbstractCheck`.
2830

29-
And once again, please refer to the [Checkstyle documentation for writing a check](http://checkstyle.sourceforge.net/writingchecks.html), if you haven't.
31+
And once again, please refer to the [Checkstyle documentation for writing a check](https://checkstyle.sourceforge.io/writingchecks.html), if you haven't.
3032

3133
## Include Checks In The Ruleset
3234

33-
The next step is to integrate your check into the tool. You will have to add it to the ruleset. The ruleset location for Checkstyle is in the `src/main/resources/rulesets/checkstyle` folder.
35+
The next step is to integrate your check into the tool.
36+
You will have to add it to the ruleset.
37+
The ruleset location for Checkstyle is in the `sat-plugin/src/main/resources/rulesets/checkstyle` folder.
3438

3539
You will have to consider several things before adding your check there.
3640

@@ -56,13 +60,17 @@ In order to test your check the testing framework expects that you provide an ex
5660

5761
## [Optional] Execute The Check On openHAB Addons Repository
5862

59-
We would highly recommend this step. The static code analysis tool is used in the `openhab2-addons` build.
63+
We would highly recommend this step.
64+
The static code analysis tool is used in the `openhab-addons` build.
6065

61-
This is a two step process. Firstly execute `mvn clean install` from the root of the `static-code-analysis` repository. This will install the artifact into your local Maven repository. Please note that this is a snapshot version (e.g. x.y.z-SNAPSHOT, where x.y.z is the current Major.Minor.Patch version or at the moment of writing 0.1.0).
66+
This is a two step process.
67+
Firstly execute `mvn clean install` from the root of the `static-code-analysis` repository.
68+
This will install the artifact into your local Maven repository.
69+
Please note that this is a snapshot version (e.g. x.y.z-SNAPSHOT, where x.y.z is the current Major.Minor.Patch version or at the moment of writing 0.12.0).
6270

6371
The second step is to execute `mvn clean install -Dsat.version=x.y.z-SNAPSHOT` from the root of the `openhab2-addons` repository.
6472

65-
Take a look at the log as it is described in the [openHAB documentation](https://www.openhab.org/docs/developer/development/bindings.html#static-code-analysis).
73+
Take a look at the log as it is described in the [openHAB documentation](https://www.openhab.org/docs/developer/guidelines.html#static-code-analysis).
6674

6775
## Still need additional help ?
6876

docs/included-checks.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# ESH Guidelines Covered
1+
# openHAB Guidelines Covered
22

33
## A. Code Style
44

@@ -58,13 +58,13 @@ Java 5 for org.eclipse.smarthome.protocols.enocean.* | https://github.com/openha
5858
# Implemented Checks
5959

6060
## Checkstyle
61-
- [included checks](https://github.com/openhab/static-code-analysis/blob/master/src/main/resources/rulesets/checkstyle/rules.xml)
62-
- [documentation for the checks](http://checkstyle.sourceforge.net/checks.html)
61+
- [included checks](https://github.com/openhab/static-code-analysis/blob/main/sat-plugin/src/main/resources/rulesets/checkstyle/rules.xml)
62+
- [documentation for the checks](https://checkstyle.sourceforge.io/checks.html)
6363

6464
## PMD
65-
- [included rules](https://github.com/openhab/static-code-analysis/blob/master/src/main/resources/rulesets/pmd/rules.xml)
66-
- [documentation for the rules](http://pmd.sourceforge.net/pmd-4.3.0/rules/index.html)
65+
- [included rules](https://github.com/openhab/static-code-analysis/blob/main/sat-plugin/src/main/resources/rulesets/pmd/rules.xml)
66+
- [documentation for the rules](https://pmd.github.io/latest/)
6767

68-
## FindBugs
69-
- [included rules](https://github.com/openhab/static-code-analysis/blob/master/src/main/resources/rulesets/findbugs/visitors.xml)
70-
- [documentation for the rules](http://findbugs.sourceforge.net/bugDescriptions.html)
68+
## SpotBugs
69+
- [included rules](https://github.com/openhab/static-code-analysis/blob/main/sat-plugin/src/main/resources/rulesets/spotbugs/visitors.xml)
70+
- [documentation for the rules](https://spotbugs.readthedocs.io/en/stable/bugDescriptions.html)

docs/maven-plugin.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ The summary report can be found in the root target directory:
5858

5959
![Summary report](images/summary-report.PNG "Summary-report")
6060

61-
The build will fail if a problem with high priority is found by some of the Maven plugins for PMD, Checkstyle and SpotBugs. Each of the plugins has its own way to prioritize the detected problems:
61+
The build will fail if a problem with high priority is found by some of the Maven plugins for PMD, Checkstyle and SpotBugs.
62+
Each of the plugins has its own way to prioritize the detected problems:
6263

6364
- for PMD - the build will fail when a rule with Priority "1" is found;
6465
- for Checkstyle - a rule with severity="Error";
@@ -139,9 +140,11 @@ Parameters:
139140

140141
Different sets of checks can be executed on different types of projects.
141142

142-
The tool executes different checks on OSGi bundles and ESH Bindings. It uses default configuration files for SpotBugs, Checkstyle and PMD that are stored in the `src/main/resources/configuration`.
143+
The tool executes different checks on OSGi bundles and openHAB add-ons.
144+
It uses default configuration files for SpotBugs, Checkstyle and PMD that are stored in `sat-plugin/src/main/resources/configuration`.
143145

144-
If you want to use a custom set of rules you will have to set the configuration parameters for the individual MOJOs. An example configuration may look like this;
146+
If you want to use a custom set of rules you will have to set the configuration parameters for the individual MOJOs.
147+
An example configuration may look like this;
145148

146149
```
147150
<plugin>
@@ -173,12 +176,12 @@ The `visitors.xml` contains a list with SpotBugs visitors (bug detectors) and ha
173176

174177
### Individual plugin customization
175178

176-
Each of the Maven plugins that are used (for SpotBugs, Checkstyle and PMD) are configured by setting user properties that are located in the `src/main/resources/configuration` directory.
179+
Each of the Maven plugins that are used (for SpotBugs, Checkstyle and PMD) are configured by setting user properties that are located in the `sat-plugin/src/main/resources/configuration` directory.
177180

178181
You can refer to the following links for more configuration options for the specific Maven plugins:
179182

180183
- https://maven.apache.org/plugins/maven-pmd-plugin/check-mojo.html;
181-
- https://maven.apache.org/plugins-archives/maven-checkstyle-plugin-2.16/checkstyle-mojo.html;
184+
- https://maven.apache.org/plugins/maven-checkstyle-plugin/checkstyle-mojo.html;
182185
- https://spotbugs.github.io/spotbugs-maven-plugin/spotbugs-mojo.html.
183186

184187
## Reuse Checks
@@ -187,6 +190,6 @@ PMD, Checkstyle and SpotBugs come with a set of custom rules that can be used di
187190

188191
Helpful resources with lists of the available checks and information how to use them:
189192

190-
- for PMD - https://pmd.github.io/pmd-5.4.0/pmd-java/rules/index.html;
191-
- for Checkstyle - http://checkstyle.sourceforge.net/checks.html;
192-
- for SpotBugs - http://spotbugs.readthedocs.io/en/latest/implement-plugin.html.
193+
- for PMD - https://pmd.github.io/latest/pmd_rules_java.html;
194+
- for Checkstyle - https://checkstyle.sourceforge.io/checks.html;
195+
- for SpotBugs - https://spotbugs.readthedocs.io/en/latest/implement-plugin.html.

0 commit comments

Comments
 (0)