Skip to content

Commit f16b1b8

Browse files
committed
Handle sonar
1 parent 8d7695f commit f16b1b8

File tree

6 files changed

+17
-14
lines changed

6 files changed

+17
-14
lines changed

testcontainers-advanced-imagebuilder/src/main/java/software/xdev/testcontainers/imagebuilder/compat/DockerfileCOPYParentsEmulator.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
/**
2828
* Emulates <a href="https://docs.docker.com/reference/dockerfile/#copy---parents">COPY --parents</a>
2929
*/
30+
@SuppressWarnings("java:S1075")
3031
public class DockerfileCOPYParentsEmulator implements DockerFileLineModifier
3132
{
3233
@Override

testcontainers-advanced-imagebuilder/src/main/java/software/xdev/testcontainers/imagebuilder/jgit/ignore/IgnoreNode.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ public MatchResult isIgnored(final String entryPath, final boolean isDirectory)
102102
* match); or null, if undetermined
103103
* @since 4.11
104104
*/
105+
@SuppressWarnings("java:S2447")
105106
public Boolean checkIgnored(
106107
final String entryPath,
107108
final boolean isDirectory)

testcontainers-advanced-imagebuilder/src/main/java/software/xdev/testcontainers/imagebuilder/jgit/ignore/internal/NameMatcher.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
/**
2222
* Matcher built from patterns for file names (single path segments). This class is immutable and thread safe.
2323
*/
24+
@SuppressWarnings("java:S2160") // Eclipse
2425
public class NameMatcher extends AbstractMatcher
2526
{
2627
protected final boolean beginning;
@@ -41,14 +42,9 @@ protected NameMatcher(
4142
pattern = Strings.deleteBackslash(pattern);
4243
}
4344
this.beginning = !pattern.isEmpty() && pattern.charAt(0) == this.slash;
44-
if(!this.beginning)
45-
{
46-
this.subPattern = pattern;
47-
}
48-
else
49-
{
50-
this.subPattern = pattern.substring(1);
51-
}
45+
this.subPattern = !this.beginning
46+
? pattern
47+
: pattern.substring(1);
5248
}
5349

5450
@SuppressWarnings({"java:S3776", "PMD.CognitiveComplexity"})

testcontainers-advanced-imagebuilder/src/main/java/software/xdev/testcontainers/imagebuilder/jgit/ignore/internal/PathMatcher.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,14 @@
3434
* <p>
3535
* This class is immutable and thread safe.
3636
*/
37-
@SuppressWarnings("checkstyle:FinalParameters")
37+
@SuppressWarnings("java:S2160") // Eclipse
3838
public class PathMatcher extends AbstractMatcher
3939
{
4040
protected static final WildMatcher WILD_NO_DIRECTORY = new WildMatcher(false);
41-
4241
protected static final WildMatcher WILD_ONLY_DIRECTORY = new WildMatcher(true);
4342

4443
protected final List<IMatcher> matchers;
45-
4644
protected final char slash;
47-
4845
protected final boolean beginning;
4946

5047
protected PathMatcher(
@@ -74,6 +71,7 @@ protected boolean isSimplePathWithSegments(final String path)
7471
&& count(path, this.slash, true) > 0;
7572
}
7673

74+
@SuppressWarnings("java:S5413")
7775
protected static List<IMatcher> createMatchers(
7876
final List<String> segments,
7977
final Character pathSeparator, final boolean dirOnly)
@@ -112,6 +110,7 @@ protected static List<IMatcher> createMatchers(
112110
* @return never null
113111
* @throws InvalidPatternException if pattern is invalid
114112
*/
113+
@SuppressWarnings("checkstyle:FinalParameters")
115114
public static IMatcher createPathMatcher(
116115
String pattern,
117116
final Character pathSeparator, final boolean dirOnly)
@@ -179,7 +178,8 @@ protected static IMatcher createNameMatcher0(
179178

180179
@Override
181180
public boolean matches(
182-
final String path, final boolean assumeDirectory,
181+
final String path,
182+
final boolean assumeDirectory,
183183
final boolean pathMatch)
184184
{
185185
if(this.matchers == null)
@@ -232,7 +232,10 @@ public boolean matches(final String segment, final int startIncl, final int endE
232232
"Path matcher works only on entire paths");
233233
}
234234

235-
@SuppressWarnings({"java:S3776", "PMD.CognitiveComplexity"})
235+
@SuppressWarnings({
236+
"java:S3776",
237+
"PMD.CognitiveComplexity",
238+
"java:S6541"}) // Eclipse code = Big brain required
236239
protected boolean iterate(
237240
final String path,
238241
final int startIncl,

testcontainers-advanced-imagebuilder/src/main/java/software/xdev/testcontainers/imagebuilder/jgit/ignore/internal/Strings.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,7 @@ private static String checkPosixCharClass(final char[] buffer)
580580
return null;
581581
}
582582

583+
@SuppressWarnings({"java:S135", "java:S127"})
583584
static String deleteBackslash(final String s)
584585
{
585586
if(s.indexOf('\\') < 0)

testcontainers-advanced-imagebuilder/src/main/java/software/xdev/testcontainers/imagebuilder/jgit/ignore/internal/WildCardMatcher.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
* <p>
2929
* This class is immutable and thread safe.
3030
*/
31+
@SuppressWarnings("java:S2160") // Eclipse
3132
public class WildCardMatcher extends NameMatcher
3233
{
3334
protected final Pattern p;

0 commit comments

Comments
 (0)