Commit 85a27ffd authored by Maxime Lefrançois's avatar Maxime Lefrançois

Closes #34 issue with .DS_store files

parent 7bf3b4d3
......@@ -82,7 +82,7 @@ public class Clause_9_3_Checker extends AbstractClauseChecker {
String nonCsv = Files.walk(path, 1).filter(p -> {
try {
return p.toFile().isFile() && !csvMatcher.matches(p);
return p.toFile().isFile() && !csvMatcher.matches(p) && !p.toFile().getName().startsWith(".");
} catch (Exception ex) {
return false;
}
......
......@@ -27,9 +27,11 @@ package fr.emse.gitlab.saref.checkers;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.Charset;
import java.nio.charset.MalformedInputException;
import java.nio.file.Files;
import org.apache.jena.atlas.RuntimeIOException;
import org.apache.jena.riot.Lang;
......@@ -46,7 +48,7 @@ import fr.emse.gitlab.saref.utils.Languages;
public class Clause_9_4_1_Checker extends AbstractClauseChecker {
private static enum MESSAGE {
one, name, turtle;
one, name, turtle, ioexception;
}
public Clause_9_4_1_Checker(RepositoryManager repositoryManager) {
......@@ -56,8 +58,14 @@ public class Clause_9_4_1_Checker extends AbstractClauseChecker {
@Override
public void checkClause() throws SAREFPipelineException {
File dir = new File(repository.getDirectory(), "ontology");
if (dir.list().length != 1) {
logError(getMessage(MESSAGE.one, repository.getProject().getOntologyFileName(Languages.TEXT_TURTLE)));
try {
if (Files.walk(dir.toPath(), 1).filter(p -> !p.toFile().isFile() && !p.toFile().getName().startsWith("."))
.count() != 1) {
logError(getMessage(MESSAGE.one, repository.getProject().getOntologyFileName(Languages.TEXT_TURTLE)));
}
} catch (IOException e) {
logError(getMessage(MESSAGE.ioexception), e);
}
File file = new File(dir, repository.getProject().getOntologyFileName(Languages.TEXT_TURTLE));
if (!file.isFile()) {
......
......@@ -86,7 +86,7 @@ public class Clause_9_5_Checker extends AbstractClauseChecker {
String nonCsv = Files.walk(path, 1).filter(p -> {
try {
return p.toFile().isFile() && !csvMatcher.matches(p);
return p.toFile().isFile() && !csvMatcher.matches(p) && !p.toFile().getName().startsWith(".");
} catch (Exception ex) {
return false;
}
......
......@@ -84,7 +84,7 @@ public class Clause_9_6_1_Checker extends AbstractClauseChecker {
String nonTtl = Files.walk(dir.toPath(), 1).filter(p -> {
try {
return p.toFile().isFile() && !TTL_MATCHER.matches(p);
return p.toFile().isFile() && !TTL_MATCHER.matches(p) && !p.toFile().getName().startsWith(".");
} catch (Exception ex) {
return false;
}
......
......@@ -34,10 +34,8 @@ import fr.emse.gitlab.saref.SAREFPipelineException;
import fr.emse.gitlab.saref.entities.SAREFExample;
import fr.emse.gitlab.saref.entities.SAREFExtension;
import fr.emse.gitlab.saref.entities.SAREFProject;
import fr.emse.gitlab.saref.entities.SAREFVersion;
import fr.emse.gitlab.saref.entities.SAREFVersionName;
import fr.emse.gitlab.saref.managers.RepositoryManager;
import fr.emse.gitlab.saref.vocabs.SHACL;
/**
* Checks TS 103 673 Clause 9.6.2: Prefixes declaration
......
missing=The `tests` directory should contain at least one file with the `.csv` extension. This file shall conform to the requirements specification as defined in clause 9.5.2 in TS 103 673.
line=The `tests` specification shall be a CSV (Comma-Separated Values) file encoded in UTF-8. The first line of the file shall be the following: `Id;Requirement;Category;Test`
ioexception=Error while checking the `tests` directory
directories=There should not be directories in the `tests` directory. Their content will be ignored.
\ No newline at end of file
directories=There should not be directories in the `tests` directory. Their content will be ignored.
csv=Every test document shall have the extension `.csv`. The following documents violate this clause: %s
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment