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

Commit

Permalink
Updating parameter names, deprecating old names
Browse files Browse the repository at this point in the history
  • Loading branch information
Pablissimo committed Feb 4, 2017
1 parent 31bc889 commit b7984a4
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 33 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -5,7 +5,7 @@
<groupId>com.pablissimo.sonar</groupId>
<artifactId>sonar-typescript-plugin</artifactId>
<packaging>sonar-plugin</packaging>
<version>0.99.1-SNAPSHOT</version>
<version>1.0.0</version>

<name>TypeScript</name>
<description>Analyse TypeScript projects</description>
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/com/pablissimo/sonar/TsLintSensor.java
Expand Up @@ -23,8 +23,7 @@ public class TsLintSensor implements Sensor {
private TsLintExecutor executor;
private TsLintParser parser;

public TsLintSensor(Settings settings, PathResolver resolver,
TsLintExecutor executor, TsLintParser parser) {
public TsLintSensor(Settings settings, PathResolver resolver, TsLintExecutor executor, TsLintParser parser) {
this.settings = settings;
this.resolver = resolver;
this.executor = executor;
Expand Down
91 changes: 61 additions & 30 deletions src/main/java/com/pablissimo/sonar/TypeScriptPlugin.java
Expand Up @@ -5,42 +5,46 @@
@Properties({
@Property(
key = TypeScriptPlugin.SETTING_TS_LINT_ENABLED,
deprecatedKey = TypeScriptPlugin.SETTING_TS_LINT_ENABLED_PREV,
type = PropertyType.BOOLEAN,
defaultValue = "true",
name = "Enable TSLint",
description = "Run TSLint on SonarQube analysis",
name = "Enable tslint",
description = "Specifies whether to run tslint on SonarQube analysis",
project = true
),
@Property(
key = TypeScriptPlugin.SETTING_TS_LINT_PATH,
deprecatedKey = TypeScriptPlugin.SETTING_TS_LINT_PATH_PREV,
defaultValue = "",
name = "Path to TSLint",
description = "Path to installed Node TSLint",
name = "Path to tslint",
description = "Path to installed copy of tslint to use to analyse the project",
project = true,
global = true
),
@Property(
key = TypeScriptPlugin.SETTING_TS_RULE_CONFIGS,
deprecatedKey = TypeScriptPlugin.SETTING_TS_RULE_CONFIGS_PREV,
name = "TsLint Rule-Collections",
description = "A collection of configurations for mapping TsLint rules to Sonar rules",
description = "A collection of configurations for mapping tslint rules to Sonar rules",
project = false,
global = true,
fields = {
@PropertyField(
key = "name",
name = "rule collection name",
name = "Rule collection name",
type = PropertyType.STRING
),
@PropertyField(
key = "config",
name = "rule configs & parameters",
name = "Rule configuration (see documentation)",
type = PropertyType.TEXT,
indicativeSize = 120
)
}
),
@Property(
key = TypeScriptPlugin.SETTING_EXCLUDE_TYPE_DEFINITION_FILES,
deprecatedKey = TypeScriptPlugin.SETTING_EXCLUDE_TYPE_DEFINITION_FILES_PREV,
type = PropertyType.BOOLEAN,
defaultValue = "true",
name = "Exclude .d.ts files",
Expand All @@ -50,23 +54,26 @@
),
@Property(
key = TypeScriptPlugin.SETTING_LCOV_REPORT_PATH,
deprecatedKey = TypeScriptPlugin.SETTING_LCOV_REPORT_PATH_PREV,
type = PropertyType.STRING,
name = "LCOV report path",
description = "LCOV report path",
description = "Path to the LCOV report for code coverage, if one is available",
project = true,
global = false
),
@Property(
key = TypeScriptPlugin.SETTING_FORCE_ZERO_COVERAGE,
deprecatedKey = TypeScriptPlugin.SETTING_FORCE_ZERO_COVERAGE_PREV,
defaultValue = "false",
type = PropertyType.BOOLEAN,
name = "Force 0 coverage",
description = "Force coverage to be set to 0 when no report is provided.",
name = "Force zero coverage if unspecified for file",
description = "Forces coverage of a file to be set to 0% when no report is provided for it",
project = true,
global = false
),
@Property(
key = TypeScriptPlugin.SETTING_TS_LINT_CONFIG_PATH,
deprecatedKey = TypeScriptPlugin.SETTING_TS_LINT_CONFIG_PATH_PREV,
defaultValue = "tslint.json",
type = PropertyType.STRING,
name = "Path to tslint.json rule configuration file",
Expand All @@ -76,65 +83,89 @@
),
@Property(
key = TypeScriptPlugin.SETTING_TS_LINT_RULES_DIR,
deprecatedKey = TypeScriptPlugin.SETTING_TS_LINT_RULES_DIR_PREV,
defaultValue = "",
type = PropertyType.STRING,
name = "Custom rules dir",
description = "Path to any custom rules directory to be supplied to TsLint",
description = "Path to any custom rules directory to be supplied to tslint",
project = true,
global = false
),
@Property(
key = TypeScriptPlugin.SETTING_TS_LINT_TIMEOUT,
deprecatedKey = TypeScriptPlugin.SETTING_TS_LINT_TIMEOUT_PREV,
defaultValue = "60000",
type = PropertyType.INTEGER,
name = "Max TsLint wait time (milliseconds)",
description = "Maximum time to wait for TsLint execution to finish before aborting (in milliseconds)",
name = "Max TsLint wait time (milliseconds) per analysed file",
description = "Maximum time to wait for tslint execution to finish before aborting (in milliseconds) per file sent to tslint",
project = true,
global = false
),
@Property(
key = TypeScriptPlugin.SETTING_TS_LINT_TYPECHECK,
deprecatedKey = TypeScriptPlugin.SETTING_TS_LINT_TYPECHECK_PREV,
defaultValue = "false",
type = PropertyType.BOOLEAN,
name = "Forces tslint to run a type-check",
description = "Equivalent to --type-check tslint argument - requires tslintconfigpath also set",
description = "Equivalent to --type-check tslint argument - requires " + TypeScriptPlugin.SETTING_TS_LINT_PROJECT_PATH + " to also be set",
project = true,
global = false
),
@Property(
key = TypeScriptPlugin.SETTING_TS_LINT_PROJECT_PATH,
deprecatedKey = TypeScriptPlugin.SETTING_TS_LINT_PROJECT_PATH_PREV,
defaultValue = "",
type = PropertyType.STRING,
name = "Path to tsconfig.json file, if required",
description = "Required if tslinttypecheck parameter specified, the path to the tsconfig.json file that describes the files to lint and build",
description = "Required if " + TypeScriptPlugin.SETTING_TS_LINT_TYPECHECK + " setting specified, the path to the tsconfig.json file that describes the files to lint and build",
project = true,
global = false
),
@Property(
key = TypeScriptPlugin.SETTING_TS_LINT_OUTPUT_PATH,
deprecatedKey = TypeScriptPlugin.SETTING_TS_LINT_OUTPUT_PATH_PREV,
defaultValue = "",
type = PropertyType.STRING,
name = "Path to TSLint JSON output file",
description = "If set, the contents of this file will be used to discover linting issues rather than the plugin running tslint itself",
name = "Path to tslint JSON output file",
description = "If set, the contents of this file will parsed for linting issues rather than the plugin running tslint itself",
project = true,
global = false
)
})
public class TypeScriptPlugin implements Plugin {
public static final String SETTING_EXCLUDE_TYPE_DEFINITION_FILES = "sonar.ts.excludetypedefinitionfiles";
public static final String SETTING_FORCE_ZERO_COVERAGE = "sonar.ts.forceZeroCoverage";
public static final String SETTING_IGNORE_NOT_FOUND = "sonar.ts.ignoreNotFound";
public static final String SETTING_TS_LINT_ENABLED = "sonar.ts.tslintenabled";
public static final String SETTING_TS_LINT_PATH = "sonar.ts.tslintpath";
public static final String SETTING_TS_LINT_CONFIG_PATH = "sonar.ts.tslintconfigpath";
public static final String SETTING_TS_LINT_TIMEOUT = "sonar.ts.tslinttimeout";
public static final String SETTING_TS_LINT_RULES_DIR = "sonar.ts.tslintrulesdir";
public static final String SETTING_LCOV_REPORT_PATH = "sonar.ts.lcov.reportpath";
public static final String SETTING_TS_RULE_CONFIGS = "sonar.ts.ruleconfigs";
public static final String SETTING_TS_LINT_TYPECHECK = "sonar.ts.tslinttypecheck";
public static final String SETTING_TS_LINT_PROJECT_PATH = "sonar.ts.tslintprojectpath";
public static final String SETTING_TS_LINT_OUTPUT_PATH = "sonar.ts.tslintoutputpath";
// Deprecated settings
public static final String SETTING_EXCLUDE_TYPE_DEFINITION_FILES_PREV = "sonar.ts.excludetypedefinitionfiles";
public static final String SETTING_FORCE_ZERO_COVERAGE_PREV = "sonar.ts.forceZeroCoverage";
public static final String SETTING_IGNORE_NOT_FOUND_PREV = "sonar.ts.ignoreNotFound";
public static final String SETTING_TS_LINT_ENABLED_PREV = "sonar.ts.tslintenabled";
public static final String SETTING_TS_LINT_PATH_PREV = "sonar.ts.tslintpath";
public static final String SETTING_TS_LINT_CONFIG_PATH_PREV = "sonar.ts.tslintconfigpath";
public static final String SETTING_TS_LINT_TIMEOUT_PREV = "sonar.ts.tslinttimeout";
public static final String SETTING_TS_LINT_RULES_DIR_PREV = "sonar.ts.tslintrulesdir";
public static final String SETTING_LCOV_REPORT_PATH_PREV = "sonar.ts.lcov.reportpath";
public static final String SETTING_TS_RULE_CONFIGS_PREV = "sonar.ts.ruleconfigs";
public static final String SETTING_TS_LINT_TYPECHECK_PREV = "sonar.ts.tslinttypecheck";
public static final String SETTING_TS_LINT_PROJECT_PATH_PREV = "sonar.ts.tslintprojectpath";
public static final String SETTING_TS_LINT_OUTPUT_PATH_PREV = "sonar.ts.tslintoutputpath";

// Current settings
public static final String SETTING_EXCLUDE_TYPE_DEFINITION_FILES = "sonar.ts.excludeTypeDefinitionFiles";

public static final String SETTING_FORCE_ZERO_COVERAGE = "sonar.ts.coverage.forceZeroIfUnspecified";
public static final String SETTING_IGNORE_NOT_FOUND = "sonar.ts.coverage.ignoreNotFound";
public static final String SETTING_LCOV_REPORT_PATH = "sonar.ts.coverage.lcovReportpath";

public static final String SETTING_TS_LINT_ENABLED = "sonar.ts.tslint.enabled";
public static final String SETTING_TS_LINT_PATH = "sonar.ts.tslint.path";
public static final String SETTING_TS_LINT_CONFIG_PATH = "sonar.ts.tslint.configPath";
public static final String SETTING_TS_LINT_TIMEOUT = "sonar.ts.tslint.timeout";
public static final String SETTING_TS_LINT_RULES_DIR = "sonar.ts.tslint.rulesDir";
public static final String SETTING_TS_RULE_CONFIGS = "sonar.ts.tslint.ruleConfigs";
public static final String SETTING_TS_LINT_TYPECHECK = "sonar.ts.tslint.typeCheck";
public static final String SETTING_TS_LINT_PROJECT_PATH = "sonar.ts.tslint.projectPath";
public static final String SETTING_TS_LINT_OUTPUT_PATH = "sonar.ts.tslint.outputPath";


@Override
public void define(Context ctx) {
// Core components - the actual sensors doing the work or configuring
Expand Down

0 comments on commit b7984a4

Please sign in to comment.