Skip to content

Commit

Permalink
made plugin compatible for Sonar 3+
Browse files Browse the repository at this point in the history
  • Loading branch information
fmueller committed Jan 19, 2013
1 parent 403e220 commit d1ca881
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 61 deletions.
64 changes: 3 additions & 61 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.codehaus.sonar-plugins</groupId>
<artifactId>parent</artifactId>
<version>13</version>
<version>16</version>
</parent>

<artifactId>sonar-scala-plugin</artifactId>
Expand Down Expand Up @@ -62,7 +62,7 @@
</repositories>

<properties>
<sonar.version>2.9</sonar.version>
<sonar.version>3.0</sonar.version>
<sonar.pluginKey>scala</sonar.pluginKey>
<sonar.pluginName>Scala</sonar.pluginName>
<sonar.pluginClass>org.sonar.plugins.scala.ScalaPlugin</sonar.pluginClass>
Expand Down Expand Up @@ -135,65 +135,7 @@
<plugin>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>2.9</version>
</plugin>

<!--
This plugin's configuration is used to store Eclipse m2e settings
only. It has no influence on the Maven build itself.
-->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
<versionRange>[2.15.2,)</versionRange>
<goals>
<goal>testCompile</goal>
<goal>compile</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.codehaus.sonar</groupId>
<artifactId>
sonar-packaging-maven-plugin
</artifactId>
<versionRange>[1.1,)</versionRange>
<goals>
<goal>check-dependencies</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>com.mycila.maven-license-plugin</groupId>
<artifactId>maven-license-plugin</artifactId>
<versionRange>[1.9.0,)</versionRange>
<goals>
<goal>check</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
<version>${sonar.version}</version>
</plugin>
</plugins>
</pluginManagement>
Expand Down
42 changes: 42 additions & 0 deletions src/main/java/org/sonar/plugins/scala/ScalaDefaultProfile.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Sonar Scala Plugin
* Copyright (C) 2011 Felix Müller
* felix.mueller.berlin@googlemail.com
*
* This program 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 3 of the License, or (at your option) any later version.
*
* This program 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 program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
*/
package org.sonar.plugins.scala;

import org.sonar.api.profiles.AnnotationProfileParser;
import org.sonar.api.profiles.ProfileDefinition;
import org.sonar.api.profiles.RulesProfile;
import org.sonar.api.utils.ValidationMessages;
import org.sonar.plugins.scala.language.Scala;

import java.util.Collections;

public class ScalaDefaultProfile extends ProfileDefinition {

private final AnnotationProfileParser annotationProfileParser;

public ScalaDefaultProfile(AnnotationProfileParser annotationProfileParser) {
this.annotationProfileParser = annotationProfileParser;
}

@Override
public RulesProfile createProfile(ValidationMessages messages) {
return annotationProfileParser.parse(Scala.INSTANCE.getKey(), "sonar", Scala.INSTANCE.getKey(), Collections.EMPTY_LIST, messages);
}
}
1 change: 1 addition & 0 deletions src/main/java/org/sonar/plugins/scala/ScalaPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public List<Class<? extends Extension>> getExtensions() {
extensions.add(ScalaSourceImporterSensor.class);
extensions.add(ScalaColorizerFormat.class);
extensions.add(BaseMetricsSensor.class);
extensions.add(ScalaDefaultProfile.class);
return extensions;
}

Expand Down

0 comments on commit d1ca881

Please sign in to comment.