Skip to content

Commit

Permalink
inline Constants.java
Browse files Browse the repository at this point in the history
  • Loading branch information
saberduck committed May 23, 2024
1 parent df89a16 commit 9f0b868
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 72 deletions.
5 changes: 0 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,6 @@
<artifactId>css</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>shared</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.sonarsource.analyzer-commons</groupId>
<artifactId>sonar-analyzer-commons</artifactId>
Expand Down
4 changes: 0 additions & 4 deletions sonar-plugin/bridge/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@
<groupId>${project.groupId}</groupId>
<artifactId>javascript-checks</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>shared</artifactId>
</dependency>
<dependency>
<groupId>org.sonarsource.api.plugin</groupId>
<artifactId>sonar-plugin-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
*/
package org.sonar.plugins.javascript.bridge;

import static org.sonar.plugins.javascript.shared.Constants.JAVASCRIPT_LANGUAGE_KEY;
import static org.sonar.plugins.javascript.shared.Constants.TYPESCRIPT_LANGUAGE_KEY;
import static org.sonar.plugins.javascript.shared.Constants.YAML_LANGUAGE_KEY;

import java.io.IOException;
import java.util.Locale;
import java.util.Scanner;
Expand Down Expand Up @@ -68,7 +64,7 @@ public static FilePredicate getYamlPredicate(FileSystem fs) {
return fs
.predicates()
.and(
fs.predicates().hasLanguage(YAML_LANGUAGE_KEY),
fs.predicates().hasLanguage("yaml"),
inputFile -> {
try (Scanner scanner = new Scanner(inputFile.inputStream(), inputFile.charset().name())) {
while (scanner.hasNextLine()) {
Expand All @@ -91,7 +87,7 @@ public static FilePredicate getYamlPredicate(FileSystem fs) {
}

public static FilePredicate getJsTsPredicate(FileSystem fs) {
return fs.predicates().hasLanguages(JAVASCRIPT_LANGUAGE_KEY, TYPESCRIPT_LANGUAGE_KEY);
return fs.predicates().hasLanguages("js", "ts");
}

private static boolean isVueTsFile(InputFile file) {
Expand All @@ -102,6 +98,6 @@ private static boolean isVueTsFile(InputFile file) {
}

public static boolean isTypeScriptFile(InputFile file) {
return (TYPESCRIPT_LANGUAGE_KEY.equals(file.language()) || isVueTsFile(file));
return ("ts".equals(file.language()) || isVueTsFile(file));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import static org.sonar.api.utils.log.LoggerLevel.WARN;
import static org.sonar.plugins.javascript.bridge.AnalysisMode.DEFAULT_LINTER_ID;
import static org.sonar.plugins.javascript.nodejs.NodeCommandBuilderImpl.NODE_EXECUTABLE_PROPERTY;
import static org.sonar.plugins.javascript.shared.Constants.JAVASCRIPT_LANGUAGE_KEY;

import java.io.File;
import java.io.IOException;
Expand Down Expand Up @@ -198,7 +197,7 @@ void test_init() throws Exception {
"key",
singletonList("config"),
Collections.singletonList(InputFile.Type.MAIN),
JAVASCRIPT_LANGUAGE_KEY
"js"
)
);
bridgeServer.initLinter(
Expand Down Expand Up @@ -232,7 +231,7 @@ void should_get_answer_from_server_for_ts_request() throws Exception {
JsAnalysisRequest request = new JsAnalysisRequest(
inputFile.absolutePath(),
inputFile.type().toString(),
JAVASCRIPT_LANGUAGE_KEY,
"js",
null,
true,
singletonList(tsConfig.absolutePath()),
Expand Down Expand Up @@ -260,7 +259,7 @@ private static JsAnalysisRequest createRequest(DefaultInputFile inputFile) {
return new JsAnalysisRequest(
inputFile.absolutePath(),
inputFile.type().toString(),
JAVASCRIPT_LANGUAGE_KEY,
"js",
null,
true,
null,
Expand All @@ -286,7 +285,7 @@ void should_get_answer_from_server_for_program_based_requests() throws Exception
JsAnalysisRequest request = new JsAnalysisRequest(
"/absolute/path/file.ts",
"MAIN",
JAVASCRIPT_LANGUAGE_KEY,
"js",
null,
true,
null,
Expand Down Expand Up @@ -504,7 +503,7 @@ void should_fail_if_bad_json_response() throws Exception {
JsAnalysisRequest request = new JsAnalysisRequest(
inputFile.absolutePath(),
inputFile.type().toString(),
JAVASCRIPT_LANGUAGE_KEY,
"js",
null,
true,
null,
Expand Down Expand Up @@ -595,7 +594,7 @@ void test_rule_tostring() {
"key",
emptyList(),
Collections.singletonList(InputFile.Type.MAIN),
JAVASCRIPT_LANGUAGE_KEY
"js"
);
assertThat(rule).hasToString("key");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import java.util.List;
import org.junit.jupiter.api.Test;
import org.sonar.api.batch.fs.InputFile;
import org.sonar.plugins.javascript.shared.Constants;

class EslintRuleTest {

Expand Down Expand Up @@ -64,7 +63,7 @@ void should_throw_when_invalid_lang() {
private static List<EslintRule> rules(String... keys) {
return Arrays
.stream(keys)
.map(key -> new EslintRule(key, emptyList(), emptyList(), Constants.JAVASCRIPT_LANGUAGE_KEY))
.map(key -> new EslintRule(key, emptyList(), emptyList(), "js"))
.collect(toList());
}
}
1 change: 0 additions & 1 deletion sonar-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
<module>bridge</module>
<module>css</module>
<module>javascript-checks</module>
<module>shared</module>
<module>sonar-javascript-plugin</module>
</modules>

Expand Down
37 changes: 0 additions & 37 deletions sonar-plugin/shared/pom.xml

This file was deleted.

This file was deleted.

0 comments on commit 9f0b868

Please sign in to comment.