diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 2f278b6f..4a62e30c 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -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 diff --git a/src/main/java/de/gwdg/metadataqa/api/abbreviation/AbbreviationManager.java b/src/main/java/de/gwdg/metadataqa/api/abbreviation/AbbreviationManager.java index bd91c388..72be4f95 100644 --- a/src/main/java/de/gwdg/metadataqa/api/abbreviation/AbbreviationManager.java +++ b/src/main/java/de/gwdg/metadataqa/api/abbreviation/AbbreviationManager.java @@ -77,7 +77,7 @@ protected void initialize(String pFileName, boolean parse) { List 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)); @@ -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); } } diff --git a/src/main/java/de/gwdg/metadataqa/api/calculator/AnnotationCalculator.java b/src/main/java/de/gwdg/metadataqa/api/calculator/AnnotationCalculator.java index d7f6ace9..9afd75d2 100644 --- a/src/main/java/de/gwdg/metadataqa/api/calculator/AnnotationCalculator.java +++ b/src/main/java/de/gwdg/metadataqa/api/calculator/AnnotationCalculator.java @@ -8,6 +8,7 @@ import java.io.Serializable; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; diff --git a/src/test/java/de/gwdg/metadataqa/api/model/LanguageSaturationTypeTest.java b/src/test/java/de/gwdg/metadataqa/api/model/LanguageSaturationTypeTest.java new file mode 100644 index 00000000..e0ec765c --- /dev/null +++ b/src/test/java/de/gwdg/metadataqa/api/model/LanguageSaturationTypeTest.java @@ -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()); + } +} \ No newline at end of file