
org.sonar.plugins.javascript.JavaScriptPlugin Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sonar-javascript-plugin Show documentation
Show all versions of sonar-javascript-plugin Show documentation
Enables analysis of JavaScript projects.
The newest version!
/*
* SonarQube JavaScript Plugin
* Copyright (C) 2011 SonarSource and Eriks Nukis
* [email protected]
*
* 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.javascript;
import com.google.common.collect.ImmutableList;
import org.sonar.api.PropertyType;
import org.sonar.api.SonarPlugin;
import org.sonar.api.config.PropertyDefinition;
import org.sonar.api.resources.Qualifiers;
import org.sonar.javascript.checks.AbstractJQueryCheck;
import org.sonar.plugins.javascript.core.JavaScript;
import org.sonar.plugins.javascript.core.JavaScriptSourceImporter;
import org.sonar.plugins.javascript.cpd.JavaScriptCpdMapping;
import org.sonar.plugins.javascript.lcov.CoverageSensor;
import org.sonar.plugins.javascript.unittest.jstest.JsTestSensor;
import org.sonar.plugins.javascript.unittest.jstestdriver.JsTestDriverSensor;
import java.util.List;
public class JavaScriptPlugin extends SonarPlugin {
// Global JavaScript constants
public static final String FALSE = "false";
public static final String FILE_SUFFIXES_KEY = "sonar.javascript.file.suffixes";
public static final String FILE_SUFFIXES_DEFVALUE = ".js";
public static final String PROPERTY_PREFIX = "sonar.javascript";
public static final String LCOV_REPORT_PATH = PROPERTY_PREFIX + ".lcov.reportPath";
public static final String LCOV_REPORT_PATH_DEFAULT_VALUE = "";
public static final String FORCE_ZERO_COVERAGE_KEY = "sonar.javascript.forceZeroCoverage";
public static final String FORCE_ZERO_COVERAGE_DEFAULT_VALUE = "false";
public static final String JSTESTDRIVER_REPORTS_PATH = PROPERTY_PREFIX + ".jstestdriver.reportsPath";
public static final String JSTESTDRIVER_REPORTS_PATH_DEFAULT_VALUE = "";
public static final String JSTEST_REPORTS_PATH = PROPERTY_PREFIX + ".jstest.reportsPath";
public static final String JSTEST_REPORTS_PATH_DEFAULT_VALUE = "";
public static final String JQUERY_OBJECT_ALIASES = AbstractJQueryCheck.JQUERY_OBJECT_ALIASES;
public static final String JQUERY_OBJECT_ALIASES_DEFAULT_VALUE = AbstractJQueryCheck.JQUERY_OBJECT_ALIASES_DEFAULT_VALUE;
@Override
public List getExtensions() {
return ImmutableList.of(
JavaScript.class,
JavaScriptSourceImporter.class,
JavaScriptCpdMapping.class,
JavaScriptSquidSensor.class,
JavaScriptRulesDefinition.class,
JavaScriptProfile.class,
JavaScriptCommonRulesEngine.class,
JavaScriptCommonRulesDecorator.class,
JsTestSensor.class,
JsTestDriverSensor.class,
CoverageSensor.class,
PropertyDefinition.builder(FILE_SUFFIXES_KEY)
.defaultValue(FILE_SUFFIXES_DEFVALUE)
.name("File Suffixes")
.description("Comma-separated list of suffixes for files to analyze.")
.build(),
PropertyDefinition.builder(LCOV_REPORT_PATH)
.defaultValue(LCOV_REPORT_PATH_DEFAULT_VALUE)
.name("LCOV File")
.description("Path (absolute or relative) to the file with LCOV data.")
.onQualifiers(Qualifiers.MODULE, Qualifiers.PROJECT)
.build(),
PropertyDefinition.builder(FORCE_ZERO_COVERAGE_KEY)
.defaultValue(FORCE_ZERO_COVERAGE_DEFAULT_VALUE)
.name("Force 0 coverage value")
.description("Force coverage to be set to 0 when no report is provided.")
.onQualifiers(Qualifiers.MODULE, Qualifiers.PROJECT)
.type(PropertyType.BOOLEAN)
.build(),
PropertyDefinition.builder(JavaScriptPlugin.JSTESTDRIVER_REPORTS_PATH)
.defaultValue(JavaScriptPlugin.JSTESTDRIVER_REPORTS_PATH_DEFAULT_VALUE)
.name("JSTestDriver output folder")
.description("Folder where JsTestDriver unit test reports are located.")
.onQualifiers(Qualifiers.MODULE, Qualifiers.PROJECT)
.build(),
PropertyDefinition.builder(JavaScriptPlugin.JSTEST_REPORTS_PATH)
.defaultValue(JavaScriptPlugin.JSTEST_REPORTS_PATH_DEFAULT_VALUE)
.name("JSTest output folder")
.description("Folder where JsTest unit test reports are located.")
.onQualifiers(Qualifiers.MODULE, Qualifiers.PROJECT)
.build(),
PropertyDefinition.builder(JavaScriptPlugin.JQUERY_OBJECT_ALIASES)
.defaultValue(JavaScriptPlugin.JQUERY_OBJECT_ALIASES_DEFAULT_VALUE)
.name("jQuery object aliases")
.description("Comma-separated list of names used to address jQuery object.")
.onQualifiers(Qualifiers.MODULE, Qualifiers.PROJECT)
.build()
);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy