Skip to content

Commit e71a036

Browse files
Fix for Sonar
1 parent 460275d commit e71a036

File tree

6 files changed

+9
-5
lines changed

6 files changed

+9
-5
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=ComputerDaddyGuy_JFileTreePrettyPrinter&metric=alert_status&token=42442b67d269c6a17b4578ba2d87731c92b8922a)](https://sonarcloud.io/summary/new_code?id=ComputerDaddyGuy_JFileTreePrettyPrinter)
44
[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=ComputerDaddyGuy_JFileTreePrettyPrinter&metric=security_rating&token=42442b67d269c6a17b4578ba2d87731c92b8922a)](https://sonarcloud.io/summary/new_code?id=ComputerDaddyGuy_JFileTreePrettyPrinter)
55
[![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=ComputerDaddyGuy_JFileTreePrettyPrinter&metric=vulnerabilities&token=42442b67d269c6a17b4578ba2d87731c92b8922a)](https://sonarcloud.io/summary/new_code?id=ComputerDaddyGuy_JFileTreePrettyPrinter)
6+
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=ComputerDaddyGuy_JFileTreePrettyPrinter&metric=coverage&token=42442b67d269c6a17b4578ba2d87731c92b8922a)](https://sonarcloud.io/summary/new_code?id=ComputerDaddyGuy_JFileTreePrettyPrinter)
67

78
[![Maven Central](https://img.shields.io/maven-central/v/io.github.computerdaddyguy/jfiletreeprettyprinter.svg?color=blue)](https://maven-badges.herokuapp.com/maven-central/io.github.computerdaddyguy/jfiletreeprettyprinter/)
89
[![Javadoc](https://javadoc.io/badge2/io.github.computerdaddyguy/jfiletreeprettyprinter/javadoc.svg?color=blue)](https://javadoc.io/doc/io.github.computerdaddyguy/jfiletreeprettyprinter)

src/main/java/io/github/computerdaddyguy/jfiletreeprettyprinter/PathPredicateBuilder.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
@NullMarked
2828
public class PathPredicateBuilder {
2929

30+
@Nullable
3031
private Predicate<Path> combinedPredicate;
3132

3233
/**

src/main/java/io/github/computerdaddyguy/jfiletreeprettyprinter/PathPredicates.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public static Predicate<Path> hasExtension(String extension) {
106106
* @return a predicate testing for files to represent a directory
107107
*/
108108
public static Predicate<Path> isDirectory() {
109-
return path -> PathUtils.isDirectory(path);
109+
return PathUtils::isDirectory;
110110
}
111111

112112
/**
@@ -115,7 +115,7 @@ public static Predicate<Path> isDirectory() {
115115
* @return a predicate testing for files to represent a file
116116
*/
117117
public static Predicate<Path> isFile() {
118-
return path -> PathUtils.isFile(path);
118+
return PathUtils::isFile;
119119
}
120120

121121
}

src/main/java/io/github/computerdaddyguy/jfiletreeprettyprinter/renderer/file/DefaultEmojiMapping.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public DefaultEmojiMapping(
4141
return emoji;
4242
}
4343

44+
@Nullable
4445
private final String extractExtension(String fileName) {
4546
var dotIndex = fileName.lastIndexOf('.');
4647
return dotIndex < 0 ? null : fileName.substring(dotIndex + 1);

src/main/java/io/github/computerdaddyguy/jfiletreeprettyprinter/renderer/file/EmojiFileFormatter.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import java.util.List;
99
import java.util.Objects;
1010
import org.jspecify.annotations.NullMarked;
11+
import org.jspecify.annotations.Nullable;
1112

1213
@NullMarked
1314
class EmojiFileFormatter implements FileFormatter {
@@ -25,7 +26,7 @@ private String getFileEmojiPrefix(Path p) {
2526
return getEmojiPrefix(emoji);
2627
}
2728

28-
private String getEmojiPrefix(String emoji) {
29+
private String getEmojiPrefix(@Nullable String emoji) {
2930
if (emoji == null) {
3031
return "";
3132
}

src/main/java/io/github/computerdaddyguy/jfiletreeprettyprinter/scanner/DefaultPathToTreeScanner.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ private TreeEntry handleDirectory(int depth, Path dir, @Nullable Predicate<Path>
5353

5454
try (var childrenStream = Files.newDirectoryStream(dir)) {
5555
var it = directoryStreamToIterator(childrenStream, filter);
56-
childEntries = handleDirectoryChildren(depth, dir, filter, it);
56+
childEntries = handleDirectoryChildren(depth, dir, it, filter);
5757
} catch (IOException e) {
5858
throw new UncheckedIOException("Unable to list files for directory: " + dir, e);
5959
}
@@ -66,7 +66,7 @@ private TreeEntry handleDirectory(int depth, Path dir, @Nullable Predicate<Path>
6666
return new DirectoryEntry(dir, childEntries);
6767
}
6868

69-
private List<TreeEntry> handleDirectoryChildren(int depth, Path dir, Predicate<Path> filter, Iterator<Path> pathIterator) {
69+
private List<TreeEntry> handleDirectoryChildren(int depth, Path dir, Iterator<Path> pathIterator, @Nullable Predicate<Path> filter) {
7070

7171
var childEntries = new ArrayList<TreeEntry>();
7272
int maxChildEntries = options.getChildLimit().applyAsInt(dir);

0 commit comments

Comments
 (0)