Skip to content

Commit 9408745

Browse files
authored
Merge pull request #136 from Vodorok/master
Checkstyle plugin now runs with build.
2 parents 7fa3007 + febddca commit 9408745

File tree

7 files changed

+128
-476
lines changed

7 files changed

+128
-476
lines changed

docs/checkstyle.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Checkstyle for CodeChecker Eclipse plugin
2+
3+
## Maven
4+
### Usage
5+
Maven is configured to automatically run checksytle plugin during the build, no other action is needed. The current configuration won't fail the build, only emit warnings.
6+
7+
__Adhering to to these style checks is mandatory.__
8+
9+
In the future the the severity level will be changed to error, and will fail the build.
10+
11+
The `checkstyle.xml` file that defines the checks to be used is under `/eclipse-plugin/eclipse/cc.codechecker.eclipse.parent/`
12+
13+
The Maven checkstyle plugin also configured in this folders pom.xml under the build section.
14+
15+
## Eclipse IDE
16+
17+
* ### Installation:
18+
* Install`Checkstyle Plug-in` from Eclipse marketplace.
19+
20+
* ### Confugration:
21+
* To configure Checkstyle plug-in go to `preferences > Checkstyle`.
22+
* Add the checkstyle.xml with `new` as an `External configuration file`, and specify a name also.
23+
![Config Pages][conf]
24+
* _This step is optional:`Set as Default` the new configuration_
25+
* Under the project preferences tick `Checkstyle active for this project`
26+
and make sure that the __configuration you added__ is being used.
27+
![Config Pages][projconf]
28+
29+
* ### Usage:
30+
* Checkstyle automatically monitors the project for imperfections.
31+
* The lines containing checkstyle problems are yellowed.
32+
* There is a view (Checkstyle violations) that can be opened.
33+
* There is a right click context item. (Apply Checkstyle fixes).
34+
35+
## Codacy
36+
37+
[Codacy](https://app.codacy.com/project/CodeChecker/CodeCheckerEclipsePlugin/dashboard) is set to use the same checkers as the project.
38+
39+
[conf]: img/checkstyle/ide_config.png "Configuration"
40+
[projconf]: img/checkstyle/ide_proj_conf.png "Project Configuration"

docs/developer.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# Developer documentation
12

23
## Troubleshooting
34

@@ -37,3 +38,6 @@ The loglevel is specified as follows:
3738
log4j.appender.log.threshold=ERROR
3839

3940
After modifying the jar file, you will need to restart eclipse for the changes to take effect.
41+
42+
## Checkstyle
43+
Checkstyle is configured for this project. See related [documentation](checkstyle.md) for more information.

docs/img/checkstyle/ide_config.png

125 KB
Loading

docs/img/checkstyle/ide_proj_conf.png

68.8 KB
Loading
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<?xml version="1.0"?>
2+
<!DOCTYPE module PUBLIC
3+
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
4+
"https://checkstyle.org/dtds/configuration_1_3.dtd">
5+
6+
7+
<module name="Checker">
8+
<property name="severity" value="warning"/>
9+
<module name="TreeWalker">
10+
<module name="AvoidStarImport"/>
11+
<module name="AvoidStaticImport"/>
12+
<module name="ConstantName"/>
13+
<module name="DeclarationOrder"/>
14+
<module name="DefaultComesLast"/>
15+
<module name="EmptyBlock"/>
16+
<module name="EmptyCatchBlock"/>
17+
<module name="EmptyStatement"/>
18+
<module name="EqualsAvoidNull"/>
19+
<module name="EqualsHashCode"/>
20+
<module name="ExplicitInitialization"/>
21+
<module name="FallThrough"/>
22+
<module name="GenericWhitespace"/>
23+
<module name="HideUtilityClassConstructor"/>
24+
<module name="IllegalCatch"/>
25+
<module name="IllegalImport"/>
26+
<module name="IllegalInstantiation"/>
27+
<module name="IllegalThrows"/>
28+
<module name="IllegalToken"/>
29+
<module name="IllegalTokenText"/>
30+
<module name="IllegalType"/>
31+
<module name="ImportOrder">
32+
<property name="groups" value="/^javax?\./,org,com"/>
33+
<property name="ordered" value="true"/>
34+
<property name="separated" value="true"/>
35+
<property name="option" value="above"/>
36+
<property name="sortStaticImportsAlphabetically" value="true"/>
37+
</module>
38+
<module name="Indentation"/>
39+
<module name="InnerAssignment"/>
40+
<module name="JavadocMethod"/>
41+
<module name="JavadocStyle"/>
42+
<module name="JavadocType"/>
43+
<module name="LocalVariableName"/>
44+
<module name="MagicNumber"/>
45+
<module name="MemberName"/>
46+
<module name="MethodCount"/>
47+
<module name="MethodName"/>
48+
<module name="MissingSwitchDefault"/>
49+
<module name="ModifiedControlVariable"/>
50+
<module name="ModifierOrder"/>
51+
<module name="MultipleStringLiterals"/>
52+
<module name="MultipleVariableDeclarations"/>
53+
<module name="MutableException"/>
54+
<module name="SimplifyBooleanExpression"/>
55+
<module name="SimplifyBooleanReturn"/>
56+
<module name="SuperClone"/>
57+
<module name="UnusedImports"/>
58+
<module name="VariableDeclarationUsageDistance"/>
59+
</module>
60+
<module name="JavadocPackage"/>
61+
</module>

eclipse-plugin/eclipse/cc.codechecker.eclipse.parent/pom.xml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,29 @@
7272
</environments>
7373
</configuration>
7474
</plugin>
75+
<plugin>
76+
<groupId>org.apache.maven.plugins</groupId>
77+
<artifactId>maven-checkstyle-plugin</artifactId>
78+
<version>3.0.0</version>
79+
<executions>
80+
<execution>
81+
<id>validate</id>
82+
<phase>validate</phase>
83+
<configuration>
84+
<configLocation>checkstyle.xml</configLocation>
85+
<encoding>UTF-8</encoding>
86+
<consoleOutput>true</consoleOutput>
87+
<failsOnError>false</failsOnError>
88+
<violationSeverity>warning</violationSeverity>
89+
<failOnViolation>false</failOnViolation>
90+
<linkXRef>false</linkXRef>
91+
</configuration>
92+
<goals>
93+
<goal>check</goal>
94+
</goals>
95+
</execution>
96+
</executions>
97+
</plugin>
7598
</plugins>
7699
</build>
77100
</project>

0 commit comments

Comments
 (0)