Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/main/java/io/lighty/yang/validator/formats/Analyzer.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import io.lighty.yang.validator.GroupArguments;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
Expand All @@ -32,11 +33,12 @@ public class Analyzer extends FormatPlugin {

@Override
void emitFormat(final Module module) {
final Set<DeclaredStatement<?>> statements = getRecursivelyDeclaredStatements(modelContext.getModules());
final Set<DeclaredStatement<?>> statements = getRecursivelyDeclaredStatements(Collections.singleton(module));
for (final DeclaredStatement<?> declaredStatement : statements) {
analyzeSubstatement(declaredStatement);
}
printOut();
printOut(module);
counter.clear();
}

private Set<DeclaredStatement<?>> getRecursivelyDeclaredStatements(final Collection<? extends ModuleLike> modules) {
Expand All @@ -58,7 +60,8 @@ private static boolean submodulesAreNotEmpty(final Collection<? extends ModuleLi

@SuppressFBWarnings(value = "SLF4J_SIGN_ONLY_FORMAT",
justification = "Valid output from LYV is dependent on Logback output")
private void printOut() {
private void printOut(final Module module) {
LOG.info("\n{}:", module.getName());
for (final Map.Entry<String, Integer> entry : new TreeMap<>(counter).entrySet()) {
LOG.info("{}: {}", entry.getKey(), entry.getValue());
}
Expand Down