Skip to content

Commit

Permalink
Issue checkstyle#45: checkstyle config was created, but all violation…
Browse files Browse the repository at this point in the history
…s are suppressed for now
  • Loading branch information
romani authored and tsjensen committed Mar 21, 2019
1 parent 860bb5a commit 15df6ca
Show file tree
Hide file tree
Showing 4 changed files with 175 additions and 0 deletions.
4 changes: 4 additions & 0 deletions checkstyle-sonar-plugin/checkstyle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
checkstyle.suppressions.file=checkstyle-sonar-plugin/suppressions.xml
checkstyle.header.file=https://raw.githubusercontent.com/checkstyle/checkstyle/master/config/java.header
checkstyle.regexp.header.file=https://raw.githubusercontent.com/checkstyle/checkstyle/master/config/java_regexp.header
checkstyle.importcontrol.file=checkstyle-sonar-plugin/import-control.xml
122 changes: 122 additions & 0 deletions checkstyle-sonar-plugin/import-control.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
<?xml version="1.0"?>
<!DOCTYPE import-control PUBLIC
"-//Puppy Crawl//DTD Import Control 1.2//EN"
"http://checkstyle.sourceforge.net/dtds/import_control_1_2.dtd">

<import-control pkg="com.github.sevntu.checkstyle">

<allow pkg="antlr"/>
<allow pkg="org.antlr.v4.runtime"/>
<allow pkg="com.puppycrawl.tools.checkstyle.api"/>
<allow pkg="com.puppycrawl.tools.checkstyle.checks"/>
<allow pkg="java.io"/>
<allow pkg="java.net"/>
<allow pkg="java.nio"/>
<allow pkg="java.util"/>
<allow pkg="javax.xml.parsers"/>
<allow pkg="org.apache.commons.beanutils"/>
<allow pkg="org.apache.commons.logging"/>
<allow pkg="org.xml.sax"/>
<allow pkg="com.puppycrawl.tools.checkstyle"/>
<allow pkg="java.lang.reflect"/>

<allow class="com.github.sevntu.checkstyle.Utils"/>

<!-- The local ones -->
<allow class="java.security.MessageDigest" local-only="true"/>
<allow class="java.security.NoSuchAlgorithmException" local-only="true"/>
<allow class="javax.xml.bind.DatatypeConverter" local-only="true"/>
<allow class="com.google.common.base.CaseFormat" local-only="true"/>
<allow class="com.google.common.io.Closeables" local-only="true"/>
<allow class="com.google.common.io.Flushables" local-only="true"/>
<allow class="com.google.common.collect.HashMultimap" local-only="true"/>
<allow class="com.google.common.collect.ImmutableCollection" local-only="true"/>
<allow class="com.google.common.collect.ImmutableList" local-only="true"/>
<allow class="com.google.common.collect.ImmutableMap" local-only="true"/>
<allow class="com.google.common.collect.MapDifference" local-only="true"/>
<allow class="com.google.common.collect.Maps" local-only="true"/>
<allow class="com.google.common.collect.Multimap" local-only="true"/>
<allow pkg="com.puppycrawl.tools.checkstyle.grammars" local-only="true"/>
<allow pkg="org.apache.commons.cli" local-only="true"/>

<subpackage name="utils">
<allow class="com.google.common.base.CharMatcher" local-only="true"/>
<allow class="com.google.common.collect.ImmutableCollection" local-only="true"/>
<allow class="com.google.common.collect.ImmutableMap" local-only="true"/>
</subpackage>

<subpackage name="checks">
<allow pkg="com.github.sevntu.checkstyle.checks"/>
<allow class="com.puppycrawl.tools.checkstyle.Definitions"/>
<allow class="com.google.common.io.Closeables" local-only="true"/>
<allow class="com.google.common.collect.HashMultiset" local-only="true"/>
<allow class="com.google.common.collect.HashMultimap" local-only="true"/>
<allow class="com.google.common.collect.ImmutableMap" local-only="true"/>
<allow class="com.google.common.collect.ImmutableMultiset" local-only="true"/>
<allow class="com.google.common.collect.Multimap" local-only="true"/>
<allow class="com.google.common.collect.Multiset" local-only="true"/>
<allow class="com.google.common.collect.Multiset.Entry" local-only="true"/>
<allow class="com.google.common.collect.SetMultimap" local-only="true"/>
<allow pkg="java.math"/>

<subpackage name="indentation">
<allow pkg="java.lang.reflect"/>
<allow class="com.google.common.collect.Range" local-only="true"/>
<allow class="com.google.common.collect.RangeMap" local-only="true"/>
</subpackage>
<subpackage name="header">
<allow class="java.nio.charset.Charset" local-only="true"/>
<allow class="com.google.common.io.Closeables" local-only="true"/>
</subpackage>
<subpackage name="javadoc">
<allow pkg="com.puppycrawl.tools.checkstyle.grammars.javadoc"/>
<allow pkg="java.lang.reflect"/>
<allow class="com.google.common.base.CharMatcher" local-only="true"/>
<allow class="com.google.common.collect.Multiset" local-only="true"/>
</subpackage>
<subpackage name="design">
<allow class="com.google.common.annotations.VisibleForTesting" local-only="true"/>
<allow class="com.google.common.collect.ImmutableMap" local-only="true"/>
<!-- following allows donot exists in main proejcts -->
<allow class="com.google.common.collect.ImmutableSet" local-only="true"/>
<allow class="com.google.common.base.Optional" local-only="true"/>
<allow class="com.google.common.base.Predicate" local-only="true"/>
<allow class="com.google.common.collect.Iterables" local-only="true"/>
<allow class="com.google.common.collect.Sets" local-only="true"/>
<allow class="com.google.common.collect.Lists" local-only="true"/>

</subpackage>
<subpackage name="imports">
<allow class="com.google.common.collect.HashMultimap" local-only="true"/>
</subpackage>
<subpackage name="coding">
<allow class="com.google.common.collect.ImmutableCollection" local-only="true"/>
<!-- following allows donot exists in main proejcts -->
<allow class="com.google.common.collect.Maps" local-only="true"/>
<allow class="com.google.common.collect.Lists" local-only="true"/>
</subpackage>
<subpackage name="naming">
<!-- following allows donot exists in main proejcts -->
<allow class="com.google.common.collect.Lists" local-only="true"/>
</subpackage>
<subpackage name="annotation">
<!-- following allows donot exists in main proejcts -->
<allow class="com.google.common.collect.Lists" local-only="true"/>
<allow class="com.google.common.base.CharMatcher" local-only="true"/>
<allow class="com.google.common.collect.Sets" local-only="true"/>
<allow class="com.google.common.base.Joiner" local-only="true"/>
</subpackage>
</subpackage>

<subpackage name="filters">
<allow pkg="java.lang.ref"/>
<allow class="com.google.common.io.Closeables" local-only="true"/>
<allow class="com.google.common.base.CaseFormat" local-only="true"/>
<allow class="com.google.common.collect.ImmutableCollection" local-only="true"/>
<allow class="com.google.common.collect.ImmutableMap" local-only="true"/>
<!-- check's subpackages -->
<disallow pkg="com\.puppycrawl\.tools\.checkstyle\.checks\.[^.]+" regex="true"/>
<disallow pkg="com\.puppycrawl\.tools\.checkstyle\.(ant|doclets|gui)" regex="true"/>
</subpackage>

</import-control>
35 changes: 35 additions & 0 deletions checkstyle-sonar-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
<name>Checkstyle SonarQube Plugin</name>
<description>Checkstyle is a code analyser to help programmers write Java code that adheres to a coding standard.</description>

<properties>
<checkstyle.version>7.3</checkstyle.version>
<checkstyle.plugin.version>2.17</checkstyle.plugin.version>
</properties>

<dependencies>
<dependency>
<groupId>org.codehaus.sonar</groupId>
Expand Down Expand Up @@ -122,6 +127,36 @@
</resources>

<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${checkstyle.plugin.version}</version>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>${checkstyle.version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<!-- https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html#Lifecycle_Reference
to run checkstyle validation in terminal please use command "mvn process-classes"
-->
<phase>process-classes</phase>
<goals>
<goal>check</goal>
</goals>
<configuration>
<configLocation>https://raw.githubusercontent.com/checkstyle/checkstyle/checkstyle-${checkstyle.version}/config/checkstyle_checks.xml</configLocation>
<failOnViolation>true</failOnViolation>
<linkXRef>false</linkXRef>
<propertiesLocation>checkstyle.properties</propertiesLocation>
<sourceDirectory>${project.basedir}/src</sourceDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonarsource.sonar-packaging-maven-plugin</groupId>
<artifactId>sonar-packaging-maven-plugin</artifactId>
Expand Down
14 changes: 14 additions & 0 deletions checkstyle-sonar-plugin/suppressions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0"?>

<!DOCTYPE suppressions PUBLIC
"-//Puppy Crawl//DTD Suppressions 1.1//EN"
"http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">

<suppressions>
<!-- START of legacy code, all violations will be resolved during transition to main project -->
<suppress checks=".*" files=".*[\\/]src[\\/]main[\\/]"/>
<suppress checks=".*" files=".*[\\/]src[\\/]test[\\/]"/>
<!-- END of legacy code -->


</suppressions>

0 comments on commit 15df6ca

Please sign in to comment.