-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathScalaPlugin.java
More file actions
103 lines (89 loc) · 4.08 KB
/
ScalaPlugin.java
File metadata and controls
103 lines (89 loc) · 4.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/*
* SonarSource Scala
* Copyright (C) 2018-2025 SonarSource SA
* mailto:info AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the Sonar Source-Available License Version 1, as published by SonarSource SA.
*
* 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 Sonar Source-Available License for more details.
*
* You should have received a copy of the Sonar Source-Available License
* along with this program; if not, see https://sonarsource.com/license/ssal/
*/
package org.sonarsource.scala.plugin;
import org.sonar.api.Plugin;
import org.sonar.api.SonarProduct;
import org.sonar.api.config.PropertyDefinition;
import org.sonar.api.resources.Qualifiers;
import org.sonarsource.scala.externalreport.scalastyle.ScalastyleRulesDefinition;
import org.sonarsource.scala.externalreport.scalastyle.ScalastyleSensor;
import org.sonarsource.scala.externalreport.scapegoat.ScapegoatRulesDefinition;
import org.sonarsource.scala.externalreport.scapegoat.ScapegoatSensor;
public class ScalaPlugin implements Plugin {
public static final String SCALA_LANGUAGE_KEY = "scala";
static final String SCALA_LANGUAGE_NAME = "Scala";
static final String SCALA_FILE_SUFFIXES_DEFAULT_VALUE = ".scala";
static final String SCALA_FILE_SUFFIXES_KEY = "sonar.scala.file.suffixes";
static final String COVERAGE_REPORT_PATHS_KEY = "sonar.scala.coverage.reportPaths";
static final String SCALA_REPOSITORY_KEY = "scala";
static final String REPOSITORY_NAME = "SonarAnalyzer";
static final String PROFILE_NAME = "Sonar way";
private static final String GENERAL = "General";
private static final String SCALA_CATEGORY = "Scala";
private static final String TEST_COVERAGE_SUBCATEGORY = "Test and Coverage";
private static final String EXTERNAL_ANALYZERS_CATEGORY = "External Analyzers";
@Override
public void define(Context context) {
context.addExtensions(
ScalaLanguage.class,
ScalaSensor.class,
ScalaRulesDefinition.class);
if (context.getRuntime().getProduct() != SonarProduct.SONARLINT) {
context.addExtensions(
ScalaProfileDefinition.class,
ScoverageSensor.class,
ScalastyleSensor.class,
ScapegoatSensor.class,
ScalastyleRulesDefinition.class,
ScapegoatRulesDefinition.class,
PropertyDefinition.builder(SCALA_FILE_SUFFIXES_KEY)
.defaultValue(SCALA_FILE_SUFFIXES_DEFAULT_VALUE)
.name("File Suffixes")
.description("List of suffixes for files to analyze.")
.subCategory(GENERAL)
.category(SCALA_CATEGORY)
.multiValues(true)
.onQualifiers(Qualifiers.PROJECT)
.build(),
PropertyDefinition.builder(COVERAGE_REPORT_PATHS_KEY)
.name("Path to Scoverage report")
.description("Path to Scoverage report file(s) (scoverage.xml). Usually in target\\scala-X.X\\scoverage-report")
.category(SCALA_CATEGORY)
.subCategory(TEST_COVERAGE_SUBCATEGORY)
.onQualifiers(Qualifiers.PROJECT)
.multiValues(true)
.build(),
PropertyDefinition.builder(ScalastyleSensor.REPORT_PROPERTY_KEY)
.name("Scalastyle Report Files")
.description("Paths (absolute or relative) to scalastyle xml files with Scalastyle issues.")
.category(EXTERNAL_ANALYZERS_CATEGORY)
.subCategory(SCALA_CATEGORY)
.onQualifiers(Qualifiers.PROJECT)
.multiValues(true)
.build(),
PropertyDefinition.builder(ScapegoatSensor.REPORT_PROPERTY_KEY)
.name("Scapegoat Report Files")
.description("Paths (absolute or relative) to scapegoat xml files using scalastyle format. For example: scapegoat-scalastyle.xml")
.category(EXTERNAL_ANALYZERS_CATEGORY)
.subCategory(SCALA_CATEGORY)
.onQualifiers(Qualifiers.PROJECT)
.multiValues(true)
.build()
);
}
}
}