Skip to content

Commit

Permalink
Remove sonar-issues due to extended Quality Gate
Browse files Browse the repository at this point in the history
  • Loading branch information
jonas-wielage-sonarsource committed Sep 25, 2023
1 parent 0cf74fd commit 746389d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,17 @@ public static Predicate<String> createPredicate(@Nullable PostModule post, @Null

static Predicate<String> filterForPatternNot(List<String> patternNot) {
String pipedPatterns = pipePatternNot(patternNot);
var compiledPatternNot = Pattern.compile(pipedPatterns);

return candidateSecret -> {
Matcher matcher = Pattern.compile(pipedPatterns).matcher(candidateSecret);
var matcher = compiledPatternNot.matcher(candidateSecret);
return !matcher.find();
};
}

static String pipePatternNot(List<String> patternNot) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < patternNot.size(); i++) {
var sb = new StringBuilder();
for (var i = 0; i < patternNot.size(); i++) {
sb.append("(?:");
sb.append(patternNot.get(i));
sb.append(")");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ private static Map<String, List<Rule>> initialize(String specificationLocation,
}

private static Specification loadSpecification(String specificationLocation, String fileName) {
InputStream specificationStream = SpecificationLoader.class.getClassLoader()
InputStream specificationStream = Thread.currentThread().getContextClassLoader()
.getResourceAsStream(specificationLocation + fileName);
return SpecificationDeserializer.deserialize(specificationStream, fileName);
}
Expand Down

0 comments on commit 746389d

Please sign in to comment.