// ----------- MEASURES ON PROJECT --------------
/**
- * Find a project measure
+ * @deprecated since 5.1 Sensors should not read but only save data
*/
<G extends Serializable> Measure<G> getMeasure(Metric<G> metric);
/**
- * All measures of the project. Never return null.
+ * @deprecated since 5.1 Sensors should not read but only save data
*/
<M> M getMeasures(MeasuresFilter<M> filter);
// ----------- MEASURES ON RESOURCES --------------
/**
- * Find a measure for this project
+ * @deprecated since 5.1 Sensors should not read but only save data
*/
<G extends Serializable> Measure<G> getMeasure(Resource resource, Metric<G> metric);
String saveResource(Resource resource);
/**
- * Find all measures for this project. Never return null.
+ * @deprecated since 5.1 Sensors should not read but only save data
*/
<M> M getMeasures(Resource resource, MeasuresFilter<M> filter);
// ----------- DEPENDENCIES BETWEEN RESOURCES --------------
- /**
- * @deprecated since 5.1 use {@link #newDependency()}
- */
Dependency saveDependency(Dependency dependency);
/**
*/
package org.sonar.api.batch.sensor;
+import com.google.common.annotations.Beta;
import org.sonar.api.BatchExtension;
/**
*
* @since 5.1
*/
+@Beta
public interface Sensor extends BatchExtension {
/**
*/
package org.sonar.api.batch.sensor;
+import com.google.common.annotations.Beta;
import org.sonar.api.batch.AnalysisMode;
import org.sonar.api.batch.CpdMapping;
import org.sonar.api.batch.fs.FileSystem;
import org.sonar.api.batch.sensor.dependency.NewDependency;
import org.sonar.api.batch.sensor.duplication.NewDuplication;
import org.sonar.api.batch.sensor.highlighting.NewHighlighting;
+import org.sonar.api.batch.sensor.internal.SensorContextTester;
import org.sonar.api.batch.sensor.issue.Issue;
import org.sonar.api.batch.sensor.issue.NewIssue;
import org.sonar.api.batch.sensor.measure.Measure;
/**
* See {@link Sensor#execute(SensorContext)}
+ * In order to write unit tests you can use {@link SensorContextTester}
* @since 5.1
*/
+@Beta
public interface SensorContext {
/**
*/
package org.sonar.api.batch.sensor;
+import com.google.common.annotations.Beta;
import org.sonar.api.batch.fs.InputFile;
/**
* See {@link Sensor#describe(SensorDescriptor)}
* @since 5.1
*/
+@Beta
public interface SensorDescriptor {
/**
*/
package org.sonar.api.batch.sensor.dependency;
+import com.google.common.annotations.Beta;
/**
* @since 5.1
*/
+@Beta
public interface Dependency {
String fromKey();
*/
package org.sonar.api.batch.sensor.dependency;
+import com.google.common.annotations.Beta;
import org.sonar.api.batch.fs.InputFile;
/**
* Should not be implemented by client.
* @since 5.1
*/
+@Beta
public interface NewDependency {
NewDependency from(InputFile from);
*/
package org.sonar.api.batch.sensor.duplication;
+import com.google.common.annotations.Beta;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
* to feed tokens and let the core compute duplications.
* @since 5.1
*/
+@Beta
public interface Duplication {
public static class Block {
+++ /dev/null
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube 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.
- *
- * SonarQube 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 02110-1301, USA.
- */
-package org.sonar.api.batch.sensor.duplication;
-
-
-import com.google.common.annotations.Beta;
-
-/**
- * Experimental, do not use.
- * <p/>
- * This builder is used to define token on files. Tokens are later used to compute duplication.
- * Tokens should be declared in sequential order.
- * Example:
- * <code><pre>
- * DuplicationTokenBuilder tokenBuilder = context.duplicationTokenBuilder(inputFile)
- * .addToken(1, "public")
- * .addToken(1, "class")
- * .addToken(1, "Foo")
- * .addToken(1, "{")
- * .addToken(2, "}")
- * .done();
- * </pre></code>
- * @since 4.5
- */
-@Beta
-public interface DuplicationTokenBuilder {
-
- /**
- * Call this method to register a new token.
- * @param line Line number of the token. Line starts at 1.
- * @param image Text of the token.
- */
- DuplicationTokenBuilder addToken(int line, String image);
-
- /**
- * Call this method only once when your are done with defining tokens of the file.
- */
- void done();
-}
*/
package org.sonar.api.batch.sensor.duplication;
+import com.google.common.annotations.Beta;
import org.sonar.api.batch.fs.InputFile;
/**
* </pre></code>
* @since 5.1
*/
+@Beta
public interface NewDuplication {
/**
*/
package org.sonar.api.batch.sensor.highlighting;
+import com.google.common.annotations.Beta;
import org.sonar.api.batch.fs.InputFile;
/**
* This builder is used to define syntax highlighting (aka code coloration) on files.
* @since 5.1
*/
+@Beta
public interface NewHighlighting {
/**
* Experimental, do not use.
* <p/>
* Possible types for highlighting code. See sonar-colorizer.css
- * @since 4.5
+ * @since 5.1
*/
@Beta
public enum TypeOfText {
import java.util.Map;
/**
- * Utility class to help testing {@link Sensor}
+ * Utility class to help testing {@link Sensor}.
+ *
+ * Usage: call {@link #create(File)} to create an "in memory" implementation of {@link SensorContext} then
+ * pass it to your {@link Sensor}. You can then query elements provided by your sensor using methods {@link #allIssues()}, ...
+ *
* @since 5.1
*/
@Beta
*/
package org.sonar.api.batch.sensor.issue;
+import com.google.common.annotations.Beta;
import org.sonar.api.batch.fs.InputPath;
import org.sonar.api.batch.sensor.Sensor;
import org.sonar.api.rule.RuleKey;
*
* @since 5.1
*/
+@Beta
public interface Issue {
public enum Severity {
*/
package org.sonar.api.batch.sensor.issue;
+import com.google.common.annotations.Beta;
import org.sonar.api.batch.fs.InputDir;
import org.sonar.api.batch.fs.InputFile;
import org.sonar.api.batch.sensor.Sensor;
*
* @since 5.1
*/
+@Beta
public interface NewIssue {
/**
*/
package org.sonar.api.batch.sensor.measure;
+import com.google.common.annotations.Beta;
import org.sonar.api.batch.fs.InputFile;
import org.sonar.api.batch.measure.Metric;
* Should not be implemented by client.
* @since 5.1
*/
+@Beta
public interface Measure<G extends Serializable> {
/**
*/
package org.sonar.api.batch.sensor.measure;
+import com.google.common.annotations.Beta;
import org.sonar.api.batch.fs.InputFile;
import org.sonar.api.batch.measure.Metric;
* Should not be implemented by client.
* @since 5.1
*/
+@Beta
public interface NewMeasure<G extends Serializable> {
/**
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube 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.
+ *
+ * SonarQube 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 02110-1301, USA.
+ */
package org.sonar.api.batch.sensor.highlighting.internal;
import org.junit.Before;
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube 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.
+ *
+ * SonarQube 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 02110-1301, USA.
+ */
package org.sonar.api.batch.sensor.internal;
import org.junit.Before;