You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openmeetings.apache.org by se...@apache.org on 2020/04/26 22:09:14 UTC
[openmeetings] 01/01: OPENMEETINGS-2307 Add checkstyle check with
only checking for unused imports. Remove unused imports.
This is an automated email from the ASF dual-hosted git repository.
sebawagner pushed a commit to branch feature/OPENMEETINGS-2307-enable-checkstyle-with-simplest-rule-set
in repository https://gitbox.apache.org/repos/asf/openmeetings.git
commit fa3110def03bea60be2bc80271c56e626cbe36d2
Author: Sebastian Wagner <se...@apache.org>
AuthorDate: Mon Apr 27 10:08:31 2020 +1200
OPENMEETINGS-2307 Add checkstyle check with only checking for unused imports. Remove unused imports.
---
openmeetings-core/pom.xml | 1 +
.../org/apache/openmeetings/core/remote/KRoom.java | 1 -
.../core/remote/TestRecordingFlowMocked.java | 3 --
.../core/remote/TestRoomFlowMocked.java | 2 --
openmeetings-db/pom.xml | 1 +
openmeetings-install/pom.xml | 1 +
openmeetings-screenshare/pom.xml | 1 +
openmeetings-server/pom.xml | 1 +
openmeetings-service/pom.xml | 1 +
openmeetings-util/pom.xml | 1 +
openmeetings-web/pom.xml | 1 +
openmeetings-webservice/pom.xml | 1 +
pom.xml | 36 ++++++++++++++++++++++
src/config/openmeetings_checkstyle.xml | 33 ++++++++++++++++++++
14 files changed, 78 insertions(+), 6 deletions(-)
diff --git a/openmeetings-core/pom.xml b/openmeetings-core/pom.xml
index 3e985b6..2c794d6 100644
--- a/openmeetings-core/pom.xml
+++ b/openmeetings-core/pom.xml
@@ -32,6 +32,7 @@
<properties>
<site.basedir>${project.parent.basedir}</site.basedir>
<autoModuleName>apache.openmeetings.core</autoModuleName>
+ <checkstyle.config.location>${project.parent.basedir}/src/config/openmeetings_checkstyle.xml</checkstyle.config.location>
</properties>
<build>
<plugins>
diff --git a/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/KRoom.java b/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/KRoom.java
index 7d7a47a..54f0f21 100644
--- a/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/KRoom.java
+++ b/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/KRoom.java
@@ -34,7 +34,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.openmeetings.core.util.WebSocketHelper;
import org.apache.openmeetings.db.dao.record.RecordingChunkDao;
-import org.apache.openmeetings.db.dao.record.RecordingDao;
import org.apache.openmeetings.db.entity.basic.Client;
import org.apache.openmeetings.db.entity.basic.Client.Activity;
import org.apache.openmeetings.db.entity.basic.Client.StreamDesc;
diff --git a/openmeetings-core/src/test/java/org/apache/openmeetings/core/remote/TestRecordingFlowMocked.java b/openmeetings-core/src/test/java/org/apache/openmeetings/core/remote/TestRecordingFlowMocked.java
index f141dc5..7664645 100644
--- a/openmeetings-core/src/test/java/org/apache/openmeetings/core/remote/TestRecordingFlowMocked.java
+++ b/openmeetings-core/src/test/java/org/apache/openmeetings/core/remote/TestRecordingFlowMocked.java
@@ -29,7 +29,6 @@ import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import java.util.Locale;
-import java.util.logging.StreamHandler;
import org.apache.openmeetings.db.dao.label.LabelDao;
import org.apache.openmeetings.db.dao.record.RecordingDao;
@@ -48,8 +47,6 @@ import org.kurento.client.MediaPipeline;
import org.kurento.client.Transaction;
import org.mockito.BDDMockito;
import org.mockito.Mock;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.stubbing.Answer;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
diff --git a/openmeetings-core/src/test/java/org/apache/openmeetings/core/remote/TestRoomFlowMocked.java b/openmeetings-core/src/test/java/org/apache/openmeetings/core/remote/TestRoomFlowMocked.java
index 9c24c67..5f5061d 100644
--- a/openmeetings-core/src/test/java/org/apache/openmeetings/core/remote/TestRoomFlowMocked.java
+++ b/openmeetings-core/src/test/java/org/apache/openmeetings/core/remote/TestRoomFlowMocked.java
@@ -43,8 +43,6 @@ import org.kurento.client.MediaPipeline;
import org.kurento.client.Transaction;
import org.mockito.BDDMockito;
import org.mockito.Mock;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.stubbing.Answer;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
diff --git a/openmeetings-db/pom.xml b/openmeetings-db/pom.xml
index 3cf2a4c..da702f1 100644
--- a/openmeetings-db/pom.xml
+++ b/openmeetings-db/pom.xml
@@ -32,6 +32,7 @@
<properties>
<site.basedir>${project.parent.basedir}</site.basedir>
<autoModuleName>apache.openmeetings.db</autoModuleName>
+ <checkstyle.config.location>${project.parent.basedir}/src/config/openmeetings_checkstyle.xml</checkstyle.config.location>
</properties>
<dependencies>
<dependency>
diff --git a/openmeetings-install/pom.xml b/openmeetings-install/pom.xml
index dc88f9f..c351031 100644
--- a/openmeetings-install/pom.xml
+++ b/openmeetings-install/pom.xml
@@ -32,6 +32,7 @@
<properties>
<site.basedir>${project.parent.basedir}</site.basedir>
<autoModuleName>apache.openmeetings.install</autoModuleName>
+ <checkstyle.config.location>${project.parent.basedir}/src/config/openmeetings_checkstyle.xml</checkstyle.config.location>
</properties>
<dependencies>
<dependency>
diff --git a/openmeetings-screenshare/pom.xml b/openmeetings-screenshare/pom.xml
index 4ca8964..20a786b 100644
--- a/openmeetings-screenshare/pom.xml
+++ b/openmeetings-screenshare/pom.xml
@@ -38,6 +38,7 @@
<site.basedir>${project.parent.basedir}</site.basedir>
<jnlp.out.dir>${project.build.directory}/jnlp</jnlp.out.dir>
<autoModuleName>apache.openmeetings.screenshare</autoModuleName>
+ <checkstyle.config.location>${project.parent.basedir}/src/config/openmeetings_checkstyle.xml</checkstyle.config.location>
</properties>
<dependencies>
<dependency>
diff --git a/openmeetings-server/pom.xml b/openmeetings-server/pom.xml
index 73efd0a..722c848 100644
--- a/openmeetings-server/pom.xml
+++ b/openmeetings-server/pom.xml
@@ -41,6 +41,7 @@
<root.webapp>webapps/ROOT</root.webapp>
<server-file.dir>web-server</server-file.dir>
<autoModuleName>apache.openmeetings.server</autoModuleName>
+ <checkstyle.config.location>${project.parent.basedir}/src/config/openmeetings_checkstyle.xml</checkstyle.config.location>
</properties>
<url>https://openmeetings.apache.org</url>
<scm>
diff --git a/openmeetings-service/pom.xml b/openmeetings-service/pom.xml
index 10f406b..1c88578 100644
--- a/openmeetings-service/pom.xml
+++ b/openmeetings-service/pom.xml
@@ -32,6 +32,7 @@
<properties>
<site.basedir>${project.parent.basedir}</site.basedir>
<autoModuleName>apache.openmeetings.service</autoModuleName>
+ <checkstyle.config.location>${project.parent.basedir}/src/config/openmeetings_checkstyle.xml</checkstyle.config.location>
</properties>
<dependencies>
<dependency>
diff --git a/openmeetings-util/pom.xml b/openmeetings-util/pom.xml
index 2deba16..8ce6edc 100644
--- a/openmeetings-util/pom.xml
+++ b/openmeetings-util/pom.xml
@@ -32,6 +32,7 @@
<properties>
<site.basedir>${project.parent.basedir}</site.basedir>
<autoModuleName>apache.openmeetings.util</autoModuleName>
+ <checkstyle.config.location>${project.parent.basedir}/src/config/openmeetings_checkstyle.xml</checkstyle.config.location>
</properties>
<build>
<plugins>
diff --git a/openmeetings-web/pom.xml b/openmeetings-web/pom.xml
index 056a195..3752a28 100644
--- a/openmeetings-web/pom.xml
+++ b/openmeetings-web/pom.xml
@@ -33,6 +33,7 @@
<old-backups.dir>${project.build.directory}/test-data</old-backups.dir>
<site.basedir>${project.parent.basedir}</site.basedir>
<autoModuleName>apache.openmeetings.web</autoModuleName>
+ <checkstyle.config.location>${project.parent.basedir}/src/config/openmeetings_checkstyle.xml</checkstyle.config.location>
</properties>
<profiles>
<profile>
diff --git a/openmeetings-webservice/pom.xml b/openmeetings-webservice/pom.xml
index 669889f..9038ca0 100644
--- a/openmeetings-webservice/pom.xml
+++ b/openmeetings-webservice/pom.xml
@@ -32,6 +32,7 @@
<properties>
<site.basedir>${project.parent.basedir}</site.basedir>
<autoModuleName>apache.openmeetings.webservice</autoModuleName>
+ <checkstyle.config.location>${project.parent.basedir}/src/config/openmeetings_checkstyle.xml</checkstyle.config.location>
</properties>
<build>
<plugins>
diff --git a/pom.xml b/pom.xml
index 47fadf0..cce59d1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -126,6 +126,7 @@
<jacoco.binary.path>${project.basedir}/../target/jacoco.exec</jacoco.binary.path>
<db_user></db_user>
<db_pass></db_pass>
+ <checkstyle.config.location>${project.basedir}/src/config/openmeetings_checkstyle.xml</checkstyle.config.location>
</properties>
<url>https://openmeetings.apache.org</url>
<inceptionYear>2012</inceptionYear>
@@ -804,6 +805,25 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <version>3.1.1</version>
+ <configuration>
+ <configLocation>${checkstyle.config.location}</configLocation>
+ <includeTestSourceDirectory>true</includeTestSourceDirectory>
+ <encoding>UTF-8</encoding>
+ <consoleOutput>true</consoleOutput>
+ <failsOnError>true</failsOnError>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
<pluginManagement>
<plugins>
@@ -1086,6 +1106,22 @@
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <version>3.1.1</version>
+ <configuration>
+ <skip>${om.quick.build}</skip>
+ <includeTestSourceDirectory>true</includeTestSourceDirectory>
+ </configuration>
+ <reportSets>
+ <reportSet>
+ <reports>
+ <report>checkstyle</report>
+ </reports>
+ </reportSet>
+ </reportSets>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<reportSets>
<reportSet>
diff --git a/src/config/openmeetings_checkstyle.xml b/src/config/openmeetings_checkstyle.xml
new file mode 100644
index 0000000..fc4e9de
--- /dev/null
+++ b/src/config/openmeetings_checkstyle.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<!--
+ Licensed 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
+ "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
+ "https://checkstyle.org/dtds/configuration_1_3.dtd">
+
+<!--
+ Checkstyle configuration that checks OpenMeetings Java Source files.
+ We are not checking much yet, but rather one by one.
+ Authors: Sebastian Wagner
+ -->
+
+<module name = "Checker">
+
+ <property name="fileExtensions" value="java" />
+
+ <module name="TreeWalker" >
+ <module name="UnusedImports"></module>
+ </module>
+
+</module>