Skip to content
This repository has been archived by the owner on Aug 24, 2019. It is now read-only.

Commit

Permalink
Release 0.5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Gilles Grousset committed Mar 3, 2016
2 parents 12b2a7a + 097b37a commit 74b05cf
Show file tree
Hide file tree
Showing 11 changed files with 757 additions and 8 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ A SonarQube 5.0 dashboard of the iOS open source project [GreatReader](https://g

| Feature | Supported | Details |
|---------------|----------|:-----------:|
| Complexity |NO | |
| Complexity |NO | Uses [Lizard](https://github.com/terryyin/lizard) |
| Design |NO | |
| Documentation |YES | |
| Duplications |YES | |
Expand Down Expand Up @@ -50,6 +50,9 @@ Binary packages are available in the release section.

###Release history

####0.5.1
- Complexity with Lizard !

####0.5.0 (detached from octo project)
- Detached from octo project (to hard to maintain compatibility)
- Removed deprecated API usages for Sonarube 5.3 support
Expand Down
2 changes: 1 addition & 1 deletion build-and-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if [ "$?" != 0 ]; then
fi

# Deploy new verion of plugin in Sonar dir
rm -rf $SONARQUBE_HOME/extensions/plugins/sonar-objective-c-*
rm -rf $SONARQUBE_HOME/extensions/plugins/*sonar-objective-c-*
cp target/*.jar $SONARQUBE_HOME/extensions/plugins
rm $SONARQUBE_HOME/extensions/plugins/*sources.jar

Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
</parent>

<groupId>org.codehaus.sonar-plugin.objectivec</groupId>
<artifactId>sonar-objective-c-plugin</artifactId>
<version>0.5.0</version>
<artifactId>backelite-sonar-objective-c-plugin</artifactId>
<version>0.5.1</version>

<packaging>sonar-plugin</packaging>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.sonar.api.Properties;
import org.sonar.api.Property;
import org.sonar.api.SonarPlugin;
import org.sonar.plugins.objectivec.complexity.LizardSensor;
import org.sonar.plugins.objectivec.coverage.CoberturaSensor;
import org.sonar.plugins.objectivec.colorizer.ObjectiveCColorizerFormat;
import org.sonar.plugins.objectivec.core.ObjectiveC;
Expand All @@ -43,7 +44,8 @@
@Properties({
@Property(key = CoberturaSensor.REPORT_PATTERN_KEY, defaultValue = CoberturaSensor.DEFAULT_REPORT_PATTERN, name = "Path to unit test coverage report(s)", description = "Relative to projects' root. Ant patterns are accepted", global = false, project = true),
@Property(key = OCLintSensor.REPORT_PATH_KEY, defaultValue = OCLintSensor.DEFAULT_REPORT_PATH, name = "Path to oclint pmd formatted report", description = "Relative to projects' root.", global = false, project = true),
@Property(key = FauxPasSensor.REPORT_PATH_KEY, defaultValue = FauxPasSensor.DEFAULT_REPORT_PATH, name = "Path to fauxpas json formatted report", description = "Relative to projects' root.", global = false, project = true)
@Property(key = FauxPasSensor.REPORT_PATH_KEY, defaultValue = FauxPasSensor.DEFAULT_REPORT_PATH, name = "Path to fauxpas json formatted report", description = "Relative to projects' root.", global = false, project = true),
@Property(key = LizardSensor.REPORT_PATH_KEY, defaultValue = LizardSensor.DEFAULT_REPORT_PATH, name = "Path to lizard report", description = "Relative to projects' root.", global = false, project = true)
})
public class ObjectiveCPlugin extends SonarPlugin {

Expand All @@ -65,7 +67,9 @@ public List<Class<? extends Extension>> getExtensions() {
FauxPasSensor.class,
FauxPasRulesDefinition.class,
FauxPasProfile.class,
FauxPasProfileImporter.class
FauxPasProfileImporter.class,

LizardSensor.class
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,7 @@ private void saveMeasures(InputFile inputFile, SourceFile squidFile) {
context.saveMeasure(inputFile, CoreMetrics.FILES, squidFile.getDouble(ObjectiveCMetric.FILES));
context.saveMeasure(inputFile, CoreMetrics.LINES, squidFile.getDouble(ObjectiveCMetric.LINES));
context.saveMeasure(inputFile, CoreMetrics.NCLOC, squidFile.getDouble(ObjectiveCMetric.LINES_OF_CODE));
context.saveMeasure(inputFile, CoreMetrics.FUNCTIONS, squidFile.getDouble(ObjectiveCMetric.FUNCTIONS));
context.saveMeasure(inputFile, CoreMetrics.STATEMENTS, squidFile.getDouble(ObjectiveCMetric.STATEMENTS));
context.saveMeasure(inputFile, CoreMetrics.COMPLEXITY, squidFile.getDouble(ObjectiveCMetric.COMPLEXITY));
context.saveMeasure(inputFile, CoreMetrics.COMMENT_LINES, squidFile.getDouble(ObjectiveCMetric.COMMENT_LINES));
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/*
* Sonar Objective-C Plugin
* Copyright (C) 2012 OCTO Technology, Backelite
* dev@sonar.codehaus.org
*
* 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.objectivec.complexity;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.sonar.api.batch.SensorContext;
import org.sonar.api.batch.fs.FileSystem;
import org.sonar.api.measures.Measure;
import org.sonar.api.resources.Project;

import java.io.File;
import java.util.List;
import java.util.Map;

/**
* This class is used to save the measures created by the lizardReportParser in the sonar database
*
* @author Andres Gil Herrera
* @since 28/05/15.
*/
public class LizardMeasurePersistor {

private static final Logger LOGGER = LoggerFactory.getLogger(LizardMeasurePersistor.class);

private final Project project;
private final SensorContext sensorContext;
private final FileSystem fileSystem;

public LizardMeasurePersistor(final Project project, final SensorContext sensorContext, final FileSystem fileSystem) {
this.project = project;
this.sensorContext = sensorContext;
this.fileSystem = fileSystem;
}

/**
*
* @param measures Map containing as key the name of the file and as value a list containing the measures for that file
*/
public void saveMeasures(final Map<String, List<Measure>> measures) {

if (measures == null) {
return;
}

for (Map.Entry<String, List<Measure>> entry : measures.entrySet()) {
final org.sonar.api.resources.File file = org.sonar.api.resources.File.fromIOFile(new File(fileSystem.baseDir(), entry.getKey()), project);

if (sensorContext.getResource(file) != null) {
for (Measure measure : entry.getValue()) {
try {
LOGGER.debug("Save measure {} for file {}", measure.getMetric().getName(), file);
sensorContext.saveMeasure(file, measure);
} catch (Exception e) {
LOGGER.error(" Exception -> {} -> {}", entry.getKey(), measure.getMetric().getName(), e);
}
}
}
}
}

}
Loading

0 comments on commit 74b05cf

Please sign in to comment.