-
Notifications
You must be signed in to change notification settings - Fork 119
Open
Labels
Description
I have the following code:
private static long folderSizeInMb(final Path path) throws IOException {
try (Stream<Path> paths = Files.walk(path)) {
return paths.filter(Files::isRegularFile).mapToLong(
p -> {
try {
return Files.size(p);
} catch (final IOException exception) {
throw new IllegalStateException(
String.format("Failed to calculate size in %s", p),
exception
);
}
}
).sum() / 1024L / 1024L;
}
}qulice complaints on the paths variable with the UnnessaryLocalRule check, because the variable is mentioned only once in the code. However, we can't just remove it, because it's Java syntax for try-catch-with-resources statement.
Expected behaviour:
quilice doesn't complain on variables declared in try-catch-with-resources.
Reactions are currently unavailable