forked from sevntu-checkstyle/sevntu.checkstyle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue sevntu-checkstyle#113: new sonar-checkstyle-extension-plugin pr…
…oject was created; checks were integrated; deploy script was updated
- Loading branch information
1 parent
1ff51ab
commit 05e2089
Showing
7 changed files
with
704 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="src" output="target/classes" path="src/main/java"> | ||
<attributes> | ||
<attribute name="optional" value="true"/> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="src" output="target/test-classes" path="src/test/java"> | ||
<attributes> | ||
<attribute name="optional" value="true"/> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"> | ||
<attributes> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> | ||
<attributes> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"> | ||
<attributes> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="output" path="target/classes"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>sevntu-checkstyle-sonar-plugin</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>net.sf.eclipsecs.core.CheckstyleBuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.m2e.core.maven2Builder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
<nature>org.eclipse.m2e.core.maven2Nature</nature> | ||
<nature>net.sf.eclipsecs.core.CheckstyleNature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>com.github.sevntu.checkstyle</groupId> | ||
<artifactId>sevntu-checkstyle-sonar-plugin</artifactId> | ||
<version>1.9.0</version> | ||
<packaging>sonar-plugin</packaging> | ||
|
||
<name>SevNTU Checkstyle Sonar Extension Plugin</name> | ||
<description>SevNTU Checkstyle extension plugin for Sonar</description> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.codehaus.sonar</groupId> | ||
<artifactId>sonar-plugin-api</artifactId> | ||
<version>2.8</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.github.sevntu.checkstyle</groupId> | ||
<artifactId>sevntu-checks</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.codehaus.sonar</groupId> | ||
<artifactId>sonar-packaging-maven-plugin</artifactId> | ||
<version>1.7</version> | ||
<extensions>true</extensions> | ||
<configuration> | ||
<pluginClass>com.github.sevntu.checkstyle.sonar.CheckstyleExtensionPlugin</pluginClass> | ||
<basePlugin>checkstyle</basePlugin> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>wagon-maven-plugin</artifactId> | ||
<version>1.0-beta-4</version> | ||
<configuration> | ||
<fromFile>${project.build.directory}/${project.build.finalName}.jar</fromFile> | ||
<url>file://${basedir}/../gh-pages/sonar/</url> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
14 changes: 14 additions & 0 deletions
14
...ar-plugin/src/main/java/com/github/sevntu/checkstyle/sonar/CheckstyleExtensionPlugin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.github.sevntu.checkstyle.sonar; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
import org.sonar.api.SonarPlugin; | ||
|
||
public final class CheckstyleExtensionPlugin extends SonarPlugin { | ||
|
||
@Override | ||
public List<?> getExtensions() { | ||
return Arrays.asList(CheckstyleExtensionRepository.class); | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
...lugin/src/main/java/com/github/sevntu/checkstyle/sonar/CheckstyleExtensionRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.github.sevntu.checkstyle.sonar; | ||
|
||
import java.io.InputStream; | ||
import java.util.List; | ||
|
||
import org.apache.commons.io.IOUtils; | ||
import org.sonar.api.rules.Rule; | ||
import org.sonar.api.rules.RuleRepository; | ||
import org.sonar.api.rules.XMLRuleParser; | ||
|
||
public final class CheckstyleExtensionRepository extends RuleRepository { | ||
|
||
private static final String REPOSITORY_KEY = "checkstyle"; | ||
|
||
private static final String REPOSITORY_NAME = "Checkstyle"; | ||
|
||
private static final String REPOSITORY_LANGUAGE = "java"; | ||
|
||
private static final String RULES_RELATIVE_FILE_PATH = "/com/github/sevntu/checkstyle/sonar/checkstyle-extensions.xml"; | ||
|
||
private XMLRuleParser xmlRuleParser; | ||
|
||
public CheckstyleExtensionRepository(XMLRuleParser xmlRuleParser) { | ||
super(REPOSITORY_KEY, REPOSITORY_LANGUAGE); | ||
setName(REPOSITORY_NAME); | ||
this.xmlRuleParser = xmlRuleParser; | ||
} | ||
|
||
@Override | ||
public List<Rule> createRules() { | ||
InputStream input = getClass().getResourceAsStream(RULES_RELATIVE_FILE_PATH); | ||
try { | ||
return xmlRuleParser.parse(input); | ||
|
||
} finally { | ||
IOUtils.closeQuietly(input); | ||
} | ||
} | ||
} |
Oops, something went wrong.