Checkstyle java.nio.charset.StandardCharsets instead of com.google.common.base.Charsets 75/41075/5
authorMichael Vorburger <vorburger@redhat.com>
Wed, 29 Jun 2016 22:24:16 +0000 (00:24 +0200)
committerRobert Varga <nite@hq.sk>
Tue, 19 Jul 2016 12:00:31 +0000 (12:00 +0000)
http://blog2.vorburger.ch/2016/06/how-to-use-checkstyle-to-enforce-using.html

Change-Id: Ibdc5520a7700f548e735c569ee8a3c1c9426dcd1
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
checkstyle/src/main/resources/odl_checks.xml
odlparent/pom.xml

index 701b0aa9b8a2c2f6a101953af3f85f2d7c2de049..e1eefa04ea2b55b2e2bf815504059523e1d01089 100644 (file)
 
           -->
 
+        <!-- Checks for API conventions and the like -->
+        <module name="com.github.sevntu.checkstyle.checks.coding.ForbidCertainImportsCheck">
+            <property name="packageNameRegexp" value=".*" />
+            <property name="forbiddenImportsRegexp" value="com.google.common.base.Charsets" />
+            <property name="forbiddenImportsExcludesRegexp" value="" />
+            <message key="forbid.certain.imports" value="Use ''java.nio.charset.StandardCharsets'' instead of ''{0}''" />
+        </module>
     </module>
 </module>
index 0a8601aac2d7f9f68dd236205cbb62e78adf56d3..9867fcb16aab104a5c673ac98877f063e0dc75fa 100644 (file)
               <artifactId>odl-license</artifactId>
               <version>0.1.0-SNAPSHOT</version>
             </dependency>
+            <dependency>
+              <groupId>com.github.sevntu.checkstyle</groupId>
+              <artifactId>sevntu-checkstyle-maven-plugin</artifactId>
+              <version>1.21.0</version>
+            </dependency>
           </dependencies>
           <configuration>
             <configLocation>odl_checks.xml</configLocation>
       <url>${nexus.site.url}/${project.artifactId}/</url>
     </site>
   </distributionManagement>
+
 </project>