Skip to content

Commit

Permalink
sonar suppressions
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Oct 4, 2024
1 parent 4a6a6c2 commit 3a25774
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 17 deletions.
31 changes: 17 additions & 14 deletions eo-runtime/src/main/java/EOorg/EOeolang/EOfs/EOdir$EOwalk.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import java.nio.file.Path;
import java.nio.file.PathMatcher;
import java.nio.file.Paths;
import java.util.stream.Stream;
import org.eolang.AtVoid;
import org.eolang.Atom;
import org.eolang.Attr;
Expand Down Expand Up @@ -72,19 +73,21 @@ public Phi lambda() throws Exception {
final PathMatcher matcher = FileSystems.getDefault().getPathMatcher(
String.format("glob:%s", glob)
);
return new Data.ToPhi(
Files.walk(path)
.map(p -> p.toAbsolutePath().toString())
.map(p -> p.substring(p.indexOf(path.toString())))
.filter(p -> matcher.matches(Paths.get(p)))
.map(
p -> {
final Phi file = Phi.Φ.take("org.eolang.fs.file").copy();
file.put(0, new ToPhi(p));
return file;
}
)
.toArray(Phi[]::new)
);
try (Stream<Path> paths = Files.walk(path)) {
return new Data.ToPhi(
paths
.map(p -> p.toAbsolutePath().toString())
.map(p -> p.substring(p.indexOf(path.toString())))
.filter(p -> matcher.matches(Paths.get(p)))
.map(
p -> {
final Phi file = Phi.Φ.take("org.eolang.fs.file").copy();
file.put(0, new ToPhi(p));
return file;
}
)
.toArray(Phi[]::new)
);
}
}
}
1 change: 1 addition & 0 deletions eo-runtime/src/main/java/EOorg/EOeolang/EOfs/Files.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ private Files() {
* @param name Name of the file
* @throws FileNotFoundException If can't open file
*/
@SuppressWarnings("java:S2095")
void open(final String name) throws IOException {
final Path path = Paths.get(name);
this.streams.putIfAbsent(
Expand Down
4 changes: 1 addition & 3 deletions eo-runtime/src/main/java/org/eolang/Dataized.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,11 @@
* or find "Δ" attribute inside it. If neither of that works, there is a
* runtime exception.
*
* <p>It's recommended to use {@link Param} object, when you are inside
* a EO object: it will add type checking on top of dataization.
*
* @see <a href="https://arxiv.org/abs/2111.13384">Canonical explanation of the Dataization concept</a>
* @since 0.1
*/
@Versionized
@SuppressWarnings("java:S5164")
public final class Dataized {

/**
Expand Down
1 change: 1 addition & 0 deletions eo-runtime/src/main/java/org/eolang/PhDefault.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public class PhDefault implements Phi, Cloneable {
* variable can be removed, or, if this is not possible
* (see https://github.com/objectionary/eo/pull/1930), come up with another solution.
*/
@SuppressWarnings("java:S5164")
private static final ThreadLocal<Integer> NESTING = ThreadLocal.withInitial(() -> 0);

/**
Expand Down
1 change: 1 addition & 0 deletions eo-runtime/src/main/java/org/eolang/PhTraced.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public final class PhTraced implements Phi {
* place where this variable can be removed, or, if this is not possible
* (see https://github.com/objectionary/eo/pull/1930), come up with another solution.
*/
@SuppressWarnings("java:S5164")
private static final ThreadLocal<Map<Integer, Integer>> DATAIZING_CAGES = ThreadLocal
.withInitial(HashMap::new);

Expand Down

0 comments on commit 3a25774

Please sign in to comment.