accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mmil...@apache.org
Subject [accumulo-website] branch tour updated: Add checkstyle import control for API
Date Thu, 07 Nov 2019 20:26:09 GMT
This is an automated email from the ASF dual-hosted git repository.

mmiller pushed a commit to branch tour
in repository https://gitbox.apache.org/repos/asf/accumulo-website.git


The following commit(s) were added to refs/heads/tour by this push:
     new 9f39df5  Add checkstyle import control for API
9f39df5 is described below

commit 9f39df5ad557570d6b256f64ccbc27c6028c1923
Author: Mike Miller <mmiller@apache.org>
AuthorDate: Thu Nov 7 15:25:21 2019 -0500

    Add checkstyle import control for API
---
 README.md          |  2 +-
 checkstyle.xml     | 26 ++++++++++++++++++++++++++
 import-control.xml | 32 ++++++++++++++++++++++++++++++++
 pom.xml            | 17 +++++++++++++++++
 4 files changed, 76 insertions(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 72c7849..b040e53 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@ go through the tour edit [Main.java] and use the following maven command to
run
 will execute Main.java with all of the correct dependencies on the classpath.
 
 ```commandline
-mvn -q clean compile exec:exec
+mvn -q clean verify exec:exec
 ```
 
 The above command will compile the project and run a MiniAccumuloCluster.
diff --git a/checkstyle.xml b/checkstyle.xml
new file mode 100644
index 0000000..8631397
--- /dev/null
+++ b/checkstyle.xml
@@ -0,0 +1,26 @@
+<?xml version="1.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.
+-->
+<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN" "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
+<module name="Checker">
+  <property name="charset" value="UTF-8"/>
+  <module name="TreeWalker">
+    <!--check that only Accumulo public APIs are imported-->
+    <module name="ImportControl">
+      <property name="file" value="import-control.xml"/>
+    </module>
+  </module>
+</module>
+
diff --git a/import-control.xml b/import-control.xml
new file mode 100644
index 0000000..5ff313c
--- /dev/null
+++ b/import-control.xml
@@ -0,0 +1,32 @@
+<?xml version="1.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.
+-->
+<!DOCTYPE import-control PUBLIC
+    "-//Checkstyle//DTD ImportControl Configuration 1.4//EN"
+    "https://checkstyle.org/dtds/import_control_1_4.dtd">
+
+<!-- This checkstyle rule is configured to ensure only use of Accumulo API -->
+<import-control pkg="tour" strategyOnMismatch="allowed">
+    <!-- API packages -->
+    <allow pkg="org.apache.accumulo.core.client"/>
+    <allow pkg="org.apache.accumulo.core.data"/>
+    <allow pkg="org.apache.accumulo.core.security"/>
+    <allow pkg="org.apache.accumulo.core.iterators"/>
+    <allow pkg="org.apache.accumulo.minicluster"/>
+    <allow pkg="org.apache.accumulo.hadoop.mapreduce"/>
+
+    <!-- disallow everything else coming from accumulo -->
+    <disallow pkg="org.apache.accumulo"/>
+</import-control>
diff --git a/pom.xml b/pom.xml
index 8813d13..1a92132 100644
--- a/pom.xml
+++ b/pom.xml
@@ -40,6 +40,23 @@
           <cleanupDaemonThreads>false</cleanupDaemonThreads>
         </configuration>
       </plugin>
+      <plugin>
+        <!-- This was added to ensure project only uses public API -->
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-checkstyle-plugin</artifactId>
+        <version>3.1.0</version>
+        <executions>
+          <execution>
+            <id>check-style</id>
+            <goals>
+              <goal>check</goal>
+            </goals>
+            <configuration>
+              <configLocation>checkstyle.xml</configLocation>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
     </plugins>
    </build>
     <dependencies>


Mime
View raw message