Skip to content

Commit

Permalink
Issue #21: Report Component
Browse files Browse the repository at this point in the history
  • Loading branch information
Luolc committed Jul 11, 2017
1 parent 1fcd310 commit da622e2
Show file tree
Hide file tree
Showing 8 changed files with 201 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,6 @@ replay_pid*

# Apple MacOS hidden file
.DS_Store

# The regression test Groovy script
diff.groovy
5 changes: 5 additions & 0 deletions config/import-control.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,9 @@
<subpackage name="git">
<allow pkg="org.eclipse.jgit"/>
</subpackage>

<subpackage name="report">
<allow class="java.net.URL"/>
<allow pkg="org.apache.commons.io"/>
</subpackage>
</import-control>
51 changes: 51 additions & 0 deletions diff-tool/projects-to-test-on.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# List of GIT repositories to clone / pull for checking with Checkstyle
# File format: REPO_NAME|[github|git|hg]|REPO_GIT_URL|[COMMIT_ID]|[EXCLUDE FOLDERS]
# Please note that bash comments works in this file

# Few projects that delivers set of unusual Java constructions that shall be correctly handled by AST visitor
# 'InputAllEscapedUnicodeCharacters' must be skipped because it is too big and slows down JXR
checkstyle|git|https://github.com/checkstyle/checkstyle.git|master|**/checkstyle/src/test/resources-noncompilable/**/*,**/InputAllEscapedUnicodeCharacters.java
sevntu-checkstyle|git|https://github.com/sevntu-checkstyle/sevntu.checkstyle|master||

openjdk7|hg|http://hg.openjdk.java.net/jdk7/jdk7/jdk/|||
openjdk8|hg|http://hg.openjdk.java.net/jdk8/jdk8/jdk/|default|**/test/tools/pack200/typeannos/TypeUseTarget.java
#All details at checkstyle/checkstyle#3033: TypeUseTarget till checkstyle/checkstyle#3238 ; ModalDialogActivationTest till JDK-8166015 ; 'jxc/8073519/**' not compilable by design ; ', jhsdb/**' - checkstyle do not support unicode identifiers
openjdk9|hg|http://hg.openjdk.java.net/jdk9/jdk9/jdk/|default|**/test/tools/pack200/typeannos/TypeUseTarget.java,**/test/java/awt/Focus/ModalDialogActivationTest/ModalDialogActivationTest.java,**/test/javax/xml/bind/jxc/8073519/**,**/test/sun/tools/jhsdb/**
guava|git|https://github.com/google/guava|v18.0||

findbugs|git|https://github.com/findbugsproject/findbugs|3.0.1||
pmd|git|https://github.com/pmd/pmd|pmd_releases/5.3.0|**/pmd/pmd-java/src/test/**/*
lombok-ast|git|https://github.com/rzwitserloot/lombok.ast|v0.2|**/lombok-ast/test/**/*

spring-framework|git|https://github.com/spring-projects/spring-framework|v4.1.6.RELEASE||
hibernate-orm|git|https://github.com/hibernate/hibernate-orm|4.2.19.Final|**/hibernate-orm/documentation/**/*
elasticsearch|git|https://github.com/elastic/elasticsearch|v1.5.2||
java-design-patterns|git|https://github.com/iluwatar/java-design-patterns|dd855a376bc025aa61f6816584f79eb9854fe5d7||
MaterialDesignLibrary|git|https://github.com/navasmdc/MaterialDesignLibrary|1.3||
Hbase|git|https://github.com/apache/hbase|1.1.0.1||
Orekit|git|https://github.com/CS-SI/Orekit|942785a5c79b5470baec3d41cab18f3adc78280e||

# Those projects are quite old and have lot of legacy code
apache-ant|git|https://github.com/apache/ant|ANT_194|**/apache-ant/src/tests/**/*,**/apache-ant/src/etc/testcases/
apache-jsecurity|git|https://github.com/apache/jsecurity|c2ac5b90a467aedb04b52ae50a99e83207d847b3||
android-launcher|git|https://github.com/android/platform_packages_apps_launcher|android-2.1_r2.1p2||
apache-struts|git|https://github.com/apache/struts.git|master|**/apache-struts/**/resources/**/*

# Projects which contain a lot of labmda expressions
infinispan|git|https://github.com/infinispan/infinispan|7.2.5.Final||
protonpack|git|https://github.com/poetix/protonpack|protonpack-1.7||
jOOL|git|https://github.com/jOOQ/jOOL|version-0.9.7||
RxJava|git|https://github.com/ReactiveX/RxJava|v1.0.9||

# Few projects with excludes to decrease a number of checked files (usefull for some checks which specify overly strong code style policy)
checkstyle-with-excludes|git|https://github.com/checkstyle/checkstyle.git|master|**/checkstyle-with-excludes/src/test/**/*,**/checkstyle-with-excludes/src/it/resources/**/*,**/resources-noncompilable/**/*
sevntu-checkstyle-with-excludes|git|https://github.com/sevntu-checkstyle/sevntu.checkstyle|master|**/sevntu-checkstyle-with-excludes/sevntu-checks/src/test/**/*
findbugs-with-excldues|git|https://github.com/findbugsproject/findbugs|3.0.1|**/findbugs-with-excldues/eclipsePlugin-test/**/*,**/findbugs-with-excldues/findbugsTestCases/**/*,**/findbugs-with-excldues/JSR305-testCases/**/*,**/findbugs-with-excldues/findbugsTestCasesOS/**/*
hibernate-orm-with-excludes|git|https://github.com/hibernate/hibernate-orm|4.2.19.Final|**/hibernate-orm-with-excludes/documentation/**/*,**/hibernate-orm-with-excludes/**/src/test/**/*

# Guava with excldues to generate reports only for those files which are not excluded in Guava's pom.xml for checkstyle-maven-plugin
# See https://github.com/checkstyle/checkstyle/wiki/How-to-generate-Checkstyle-report-for-Google-Guava-project
guava-mvnstyle|git|https://github.com/google/guava|master|**/guava-mvnstyle/**/test/**/*,**/guava-mvnstyle/guava-gwt/src-super/**/*,**/guava-mvnstyle/guava-gwt/test-super/**/*,**/guava-mvnstyle/guava-tests/**/*

# custom javadoc tags
nbia-dcm4che-tools|git|https://github.com/thprakash/nbia-dcm4che-tools|c3591e6f0f84827586db25abded6708e5386ef1a||
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
</properties>

<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.4.12</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-jxr</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
////////////////////////////////////////////////////////////////////////////////

package com.github.checkstyle.regression.report;

/**
* @author LuoLiangchen
*/
public class DiffGroovyWrapper {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
////////////////////////////////////////////////////////////////////////////////

package com.github.checkstyle.regression.report;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;

import org.apache.commons.io.FileUtils;

/**
* Downloads the 'diff.groovy' script from contribution repository.
* @author LuoLiangchen
*/
public final class ScriptDownloader {
/** Prevents instantiation. */
private ScriptDownloader() {
}

/**
* Downloads the 'diff.groovy' script from contribution repository and save it to
* the given destination. The file at {@code dest} will be overwritten if it already exists.
* @param dest the path of the script to save
* @throws IOException failure of downloading or saving
*/
public static void downloadGroovyScript(String dest) throws IOException {
final String url = "https://raw.githubusercontent.com/checkstyle/"
+ "contribution/master/checkstyle-tester/diff.groovy";
final InputStream response = new URL(url).openStream();
FileUtils.copyInputStreamToFile(response, new File(dest));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
////////////////////////////////////////////////////////////////////////////////

/**
* Contains the regression test runner and the report deployer.
* @author LuoLiangchen
*/
package com.github.checkstyle.regression.report;
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
////////////////////////////////////////////////////////////////////////////////

package com.github.checkstyle.regression.report;

import static com.github.checkstyle.regression.internal.TestUtils.assertUtilsClassHasPrivateConstructor;

import org.junit.Test;

public class ScriptDownloaderTest {
@Test
public void testIsProperUtilsClass() throws Exception {
assertUtilsClassHasPrivateConstructor(ScriptDownloader.class);
}

@Test
public void testDownloadGroovyScriptNoFailure() throws Exception {
ScriptDownloader.downloadGroovyScript("diff-tool/diff.groovy");
}
}

0 comments on commit da622e2

Please sign in to comment.