Skip to content

Commit

Permalink
Implement SonarCloud quality suggestions #159
Browse files Browse the repository at this point in the history
  • Loading branch information
pkiraly committed Dec 8, 2023
1 parent 4d8cfe3 commit f0e8320
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,13 @@ jobs:
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2

- name: Build and analyze
- name: Build and send to SonarCloud (https://sonarcloud.io/summary/new_code?id=pkiraly_metadata-qa-api)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
uses: actions/setup-java@v2
with:
java-version: '17'
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -DskipGpg=true

# https://app.codecov.io/gh/pkiraly/metadata-qa-api
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ protected void initialize(String pFileName, boolean parse) {
List<String> lines = Files.readAllLines(path, Charset.defaultCharset());
var i = 1;
for (String line : lines) {
processLine(line, i, parse);
processLine(line, i++, parse);
}
} catch (URISyntaxException | IOException | FileSystemNotFoundException ex) {
LOGGER.severe(String.format("Error with file: %s, path: %s.", pFileName, path));
Expand All @@ -90,7 +90,7 @@ public void processLine(String line, int i, boolean parse) throws NumberFormatEx
String[] parts = line.split(";", 2);
data.put(parts[1].replace("\\n", "\n"), Integer.parseInt(parts[0]));
} else {
data.put(line, i++);
data.put(line, i);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package de.gwdg.metadataqa.api.model;

import junit.framework.TestCase;

public class LanguageSaturationTypeTest extends TestCase {

public void testIsTaggedLiteral() {
assertTrue(LanguageSaturationType.LANGUAGE.isTaggedLiteral());
assertTrue(LanguageSaturationType.TRANSLATION.isTaggedLiteral());
assertFalse(LanguageSaturationType.NA.isTaggedLiteral());
assertFalse(LanguageSaturationType.LINK.isTaggedLiteral());
assertFalse(LanguageSaturationType.STRING.isTaggedLiteral());
}
}

0 comments on commit f0e8320

Please sign in to comment.