]> source.dussan.org Git - vaadin-framework.git/commitdiff
Trigger a checkstyle error if importing the wrong Element class (#13287)
authorLeif Åstrand <leif@vaadin.com>
Tue, 25 Mar 2014 07:03:52 +0000 (09:03 +0200)
committerVaadin Code Review <review@vaadin.com>
Tue, 25 Mar 2014 11:33:17 +0000 (11:33 +0000)
Change-Id: Ief15e88c9c6fe5fd88dbf9f12783ac2f5ae617c6

checkstyle/import-control.xml [new file with mode: 0644]
checkstyle/vaadin-checkstyle.xml
common.xml

diff --git a/checkstyle/import-control.xml b/checkstyle/import-control.xml
new file mode 100644 (file)
index 0000000..076dbd8
--- /dev/null
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+<!DOCTYPE import-control PUBLIC
+    "-//Puppy Crawl//DTD Import Control 1.1//EN"
+    "http://www.puppycrawl.com/dtds/import_control_1_1.dtd">
+
+<import-control pkg="com.vaadin">
+    <allow pkg=".*" regex="true" />
+    <disallow class="com.google.gwt.user.client.Element" />
+</import-control>
\ No newline at end of file
index bcbbaf91712b536c917b287613ac228d23a99377..ca572fe1a5f9e904fff0b52095c820e1e917a0e9 100644 (file)
         <module name="IllegalImport" /> <!-- defaults to sun.* packages -->
         <module name="RedundantImport" />
         <module name="UnusedImports" />
+        <module name="ImportControl">
+            <property name="file" value="${checkstyle.importControl.file}" />
+            <property name="severity" value="error" />
+        </module>
 
 
         <!-- Checks for Size Violations. -->
index cef335035d23cc8f18167635829a3ab293a1cf4e..59e32136b4f443ace3e64530fa3f6c6c8bc5b01e 100644 (file)
     <property name="cs.dir" location="${vaadin.basedir}/checkstyle" />
     <property name="cs.xml" location="${cs.dir}/vaadin-checkstyle.xml" />
     <property name="cs.header-file" location="${cs.dir}/header" />
+    <property name="cs.import-control-file" location="${cs.dir}/import-control.xml" />
     <taskdef resource="checkstyletask.properties" uri="antlib:com.puppycrawl.tools.checkstyle" classpathref="taskdefs.classpath" />
 
     <target name="checkstyle">
             </fileset>
             <formatter type="xml" toFile="${result.dir}/checkstyle-errors.xml" />
             <property key="checkstyle.header.file" file="${cs.header-file}" />
+            <property key="checkstyle.importControl.file" file="${cs.import-control-file}" />
         </cs:checkstyle>
     </target>
 </project>