Skip to content

Commit

Permalink
Merge pull request #136 from Vodorok/master
Browse files Browse the repository at this point in the history
Checkstyle plugin now runs with build.
  • Loading branch information
gyorb authored Nov 29, 2018
2 parents 7fa3007 + febddca commit 9408745
Show file tree
Hide file tree
Showing 7 changed files with 128 additions and 476 deletions.
40 changes: 40 additions & 0 deletions docs/checkstyle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Checkstyle for CodeChecker Eclipse plugin

## Maven
### Usage
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.

__Adhering to to these style checks is mandatory.__

In the future the the severity level will be changed to error, and will fail the build.

The `checkstyle.xml` file that defines the checks to be used is under `/eclipse-plugin/eclipse/cc.codechecker.eclipse.parent/`

The Maven checkstyle plugin also configured in this folders pom.xml under the build section.

## Eclipse IDE

* ### Installation:
* Install`Checkstyle Plug-in` from Eclipse marketplace.

* ### Confugration:
* To configure Checkstyle plug-in go to `preferences > Checkstyle`.
* Add the checkstyle.xml with `new` as an `External configuration file`, and specify a name also.
![Config Pages][conf]
* _This step is optional:`Set as Default` the new configuration_
* Under the project preferences tick `Checkstyle active for this project`
and make sure that the __configuration you added__ is being used.
![Config Pages][projconf]

* ### Usage:
* Checkstyle automatically monitors the project for imperfections.
* The lines containing checkstyle problems are yellowed.
* There is a view (Checkstyle violations) that can be opened.
* There is a right click context item. (Apply Checkstyle fixes).

## Codacy

[Codacy](https://app.codacy.com/project/CodeChecker/CodeCheckerEclipsePlugin/dashboard) is set to use the same checkers as the project.

[conf]: img/checkstyle/ide_config.png "Configuration"
[projconf]: img/checkstyle/ide_proj_conf.png "Project Configuration"
4 changes: 4 additions & 0 deletions docs/developer.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Developer documentation

## Troubleshooting

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

After modifying the jar file, you will need to restart eclipse for the changes to take effect.

## Checkstyle
Checkstyle is configured for this project. See related [documentation](checkstyle.md) for more information.
Binary file added docs/img/checkstyle/ide_config.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/checkstyle/ide_proj_conf.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">


<module name="Checker">
<property name="severity" value="warning"/>
<module name="TreeWalker">
<module name="AvoidStarImport"/>
<module name="AvoidStaticImport"/>
<module name="ConstantName"/>
<module name="DeclarationOrder"/>
<module name="DefaultComesLast"/>
<module name="EmptyBlock"/>
<module name="EmptyCatchBlock"/>
<module name="EmptyStatement"/>
<module name="EqualsAvoidNull"/>
<module name="EqualsHashCode"/>
<module name="ExplicitInitialization"/>
<module name="FallThrough"/>
<module name="GenericWhitespace"/>
<module name="HideUtilityClassConstructor"/>
<module name="IllegalCatch"/>
<module name="IllegalImport"/>
<module name="IllegalInstantiation"/>
<module name="IllegalThrows"/>
<module name="IllegalToken"/>
<module name="IllegalTokenText"/>
<module name="IllegalType"/>
<module name="ImportOrder">
<property name="groups" value="/^javax?\./,org,com"/>
<property name="ordered" value="true"/>
<property name="separated" value="true"/>
<property name="option" value="above"/>
<property name="sortStaticImportsAlphabetically" value="true"/>
</module>
<module name="Indentation"/>
<module name="InnerAssignment"/>
<module name="JavadocMethod"/>
<module name="JavadocStyle"/>
<module name="JavadocType"/>
<module name="LocalVariableName"/>
<module name="MagicNumber"/>
<module name="MemberName"/>
<module name="MethodCount"/>
<module name="MethodName"/>
<module name="MissingSwitchDefault"/>
<module name="ModifiedControlVariable"/>
<module name="ModifierOrder"/>
<module name="MultipleStringLiterals"/>
<module name="MultipleVariableDeclarations"/>
<module name="MutableException"/>
<module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/>
<module name="SuperClone"/>
<module name="UnusedImports"/>
<module name="VariableDeclarationUsageDistance"/>
</module>
<module name="JavadocPackage"/>
</module>
23 changes: 23 additions & 0 deletions eclipse-plugin/eclipse/cc.codechecker.eclipse.parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,29 @@
</environments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>validate</id>
<phase>validate</phase>
<configuration>
<configLocation>checkstyle.xml</configLocation>
<encoding>UTF-8</encoding>
<consoleOutput>true</consoleOutput>
<failsOnError>false</failsOnError>
<violationSeverity>warning</violationSeverity>
<failOnViolation>false</failOnViolation>
<linkXRef>false</linkXRef>
</configuration>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Loading

0 comments on commit 9408745

Please sign in to comment.