You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ra...@apache.org on 2018/04/26 13:32:15 UTC

[cloudstack] branch master updated: [CLOUDSTACK-10254] checkstyle: add package name declaration validation (#2422)

This is an automated email from the ASF dual-hosted git repository.

rafael pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/master by this push:
     new 46bd94c  [CLOUDSTACK-10254] checkstyle: add package name declaration validation (#2422)
46bd94c is described below

commit 46bd94c6a206c6ccc8832369d4726b5b17620208
Author: Marc-Aurèle Brothier <m...@brothier.org>
AuthorDate: Thu Apr 26 15:32:08 2018 +0200

    [CLOUDSTACK-10254] checkstyle: add package name declaration validation (#2422)
    
    * checktyle: verify package name matches directory structure
    
    * fix new checkstyle findings on directory with package name mismatch
---
 .../engine/subsystem/api/storage/disktype/QCOW2.java     | 16 ----------------
 .../engine/subsystem/api/storage/disktype/Unknown.java   | 16 ----------------
 .../engine/subsystem/api/storage/disktype/VHD.java       | 16 ----------------
 .../engine/subsystem/api/storage/disktype/VHDX.java      | 16 ----------------
 .../engine/subsystem/api/storage/disktype/VMDK.java      | 16 ----------------
 .../subsystem/api/storage/disktype/VolumeDiskType.java   | 16 ----------------
 .../api/storage/disktype/VolumeDiskTypeBase.java         | 16 ----------------
 .../api/storage/disktype/VolumeDiskTypeHelper.java       | 16 ----------------
 .../java/org/apache/cloudstack/storage/EndPoint.java     | 16 ----------------
 .../apache/cloudstack/storage/datastore/DataStore.java   | 16 ----------------
 .../storage/datastore/TemplateInDataStore.java           | 16 ----------------
 pom.xml                                                  | 14 +++++++++++---
 tools/checkstyle/pom.xml                                 |  2 +-
 tools/checkstyle/src/main/resources/cloud-style.xml      |  4 ++--
 14 files changed, 14 insertions(+), 182 deletions(-)

diff --git a/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/disktype/QCOW2.java b/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/disktype/QCOW2.java
deleted file mode 100644
index b248758..0000000
--- a/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/disktype/QCOW2.java
+++ /dev/null
@@ -1,16 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
diff --git a/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/disktype/Unknown.java b/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/disktype/Unknown.java
deleted file mode 100644
index b248758..0000000
--- a/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/disktype/Unknown.java
+++ /dev/null
@@ -1,16 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
diff --git a/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/disktype/VHD.java b/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/disktype/VHD.java
deleted file mode 100644
index b248758..0000000
--- a/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/disktype/VHD.java
+++ /dev/null
@@ -1,16 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
diff --git a/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/disktype/VHDX.java b/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/disktype/VHDX.java
deleted file mode 100644
index b248758..0000000
--- a/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/disktype/VHDX.java
+++ /dev/null
@@ -1,16 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
diff --git a/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/disktype/VMDK.java b/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/disktype/VMDK.java
deleted file mode 100644
index b248758..0000000
--- a/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/disktype/VMDK.java
+++ /dev/null
@@ -1,16 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
diff --git a/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/disktype/VolumeDiskType.java b/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/disktype/VolumeDiskType.java
deleted file mode 100644
index b248758..0000000
--- a/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/disktype/VolumeDiskType.java
+++ /dev/null
@@ -1,16 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
diff --git a/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/disktype/VolumeDiskTypeBase.java b/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/disktype/VolumeDiskTypeBase.java
deleted file mode 100644
index b248758..0000000
--- a/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/disktype/VolumeDiskTypeBase.java
+++ /dev/null
@@ -1,16 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
diff --git a/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/disktype/VolumeDiskTypeHelper.java b/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/disktype/VolumeDiskTypeHelper.java
deleted file mode 100644
index b248758..0000000
--- a/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/disktype/VolumeDiskTypeHelper.java
+++ /dev/null
@@ -1,16 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
diff --git a/engine/storage/src/main/java/org/apache/cloudstack/storage/EndPoint.java b/engine/storage/src/main/java/org/apache/cloudstack/storage/EndPoint.java
deleted file mode 100644
index b248758..0000000
--- a/engine/storage/src/main/java/org/apache/cloudstack/storage/EndPoint.java
+++ /dev/null
@@ -1,16 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
diff --git a/engine/storage/src/main/java/org/apache/cloudstack/storage/datastore/DataStore.java b/engine/storage/src/main/java/org/apache/cloudstack/storage/datastore/DataStore.java
deleted file mode 100644
index b248758..0000000
--- a/engine/storage/src/main/java/org/apache/cloudstack/storage/datastore/DataStore.java
+++ /dev/null
@@ -1,16 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
diff --git a/engine/storage/src/main/java/org/apache/cloudstack/storage/datastore/TemplateInDataStore.java b/engine/storage/src/main/java/org/apache/cloudstack/storage/datastore/TemplateInDataStore.java
deleted file mode 100644
index b248758..0000000
--- a/engine/storage/src/main/java/org/apache/cloudstack/storage/datastore/TemplateInDataStore.java
+++ /dev/null
@@ -1,16 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
diff --git a/pom.xml b/pom.xml
index 6c4f828..2e61773 100644
--- a/pom.xml
+++ b/pom.xml
@@ -108,7 +108,8 @@
     <cs.target.dir>target</cs.target.dir>
     <cs.daemon.version>1.1.0</cs.daemon.version>
     <cs.jna.version>4.0.0</cs.jna.version>
-    <cs.checkstyle.version>2.17</cs.checkstyle.version>
+    <cs.checkstyle.version>3.0.0</cs.checkstyle.version>
+    <cs.checkstyle-lib.version>8.7</cs.checkstyle-lib.version>
     <cs.mycila.license.version>2.11</cs.mycila.license.version>
     <cs.findbugs.version>3.0.3</cs.findbugs.version>
     <cs.javadoc.version>2.10.3</cs.javadoc.version>
@@ -619,6 +620,11 @@
               <artifactId>checkstyle</artifactId>
               <version>${project.version}</version>
             </dependency>
+            <dependency>
+              <groupId>com.puppycrawl.tools</groupId>
+              <artifactId>checkstyle</artifactId>
+              <version>${cs.checkstyle-lib.version}</version>
+            </dependency>
           </dependencies>
           <executions>
             <execution>
@@ -634,9 +640,11 @@
             <configLocation>cloud-style.xml</configLocation>
             <consoleOutput>true</consoleOutput>
             <includeTestSourceDirectory>true</includeTestSourceDirectory>
-            <sourceDirectory>${project.basedir}</sourceDirectory>
+            <sourceDirectories>
+              <sourceDirectory>${project.basedir}</sourceDirectory>
+            </sourceDirectories>
             <includes>**\/*.java</includes>
-            <excludes>**\/deps\/,**\/test\/,**\/target\/,**\/bin\/,**\/*.xml,**\/*.ini,**\/*.sh,**\/*.bat,**\/apidoc\/</excludes>
+            <excludes>**\/deps\/,**\/test\/,**\/target\/,**\/bin\/,**\/*.xml,**\/*.ini,**\/*.sh,**\/*.bat,**\/XmlToHtmlConverter*,**\/generated-sources\/**\/*</excludes>
           </configuration>
         </plugin>
         <plugin>
diff --git a/tools/checkstyle/pom.xml b/tools/checkstyle/pom.xml
index 10fcda9..a763994 100644
--- a/tools/checkstyle/pom.xml
+++ b/tools/checkstyle/pom.xml
@@ -31,7 +31,7 @@
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-checkstyle-plugin</artifactId>
-          <version>2.13</version>
+          <version>3.0.0</version>
           <executions>
             <execution>
               <phase>none</phase>
diff --git a/tools/checkstyle/src/main/resources/cloud-style.xml b/tools/checkstyle/src/main/resources/cloud-style.xml
index 47ea1fb..6aaef17 100644
--- a/tools/checkstyle/src/main/resources/cloud-style.xml
+++ b/tools/checkstyle/src/main/resources/cloud-style.xml
@@ -21,7 +21,6 @@
     <module name="LineLength">
       <property name="max" value="1024" />
     </module>
-
     <module name="RedundantImport" />
     <module name="UnusedImports" />
     <module name="MemberName">
@@ -36,12 +35,13 @@
 	<module name="ConstantName">
 	  <property name="format" value="^[a-zA-Z][a-zA-Z0-9_]*$"/>
 	</module>
-
     <module name="PackageName" />
+    <module name="PackageDeclaration"><property name="matchDirectoryStructure" value="true"/></module>
     <module name="ParameterName" />
     <module name="TypeName" />
     <module name="AvoidStarImport" />
   </module>
+
   <module name="RegexpSingleline">
     <!-- \s matches whitespace character, $ matches end of line. -->
     <property name="format" value="\s+$" />

-- 
To stop receiving notification emails like this one, please contact
rafael@apache.org.