Method evaluate
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public PrecisionRecall evaluate(Set<Pair<V, V>> clusterPairs, Set<Pair<V, V>> classPairs) {
final var union = new HashSet<>(clusterPairs);
union.addAll(classPairs);
final var preds = new boolean[union.size()];
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
'if' construct must use '{}'s. Open
if (preds[i] && trues[i]) tp++;
- Read upRead up
- Exclude checks
Checks for braces around code blocks.
This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.
Extra separation in import group before 'java.util.Collection' Open
import java.util.Collection;
- Read upRead up
- Exclude checks
Checks that the groups of import declarations appear in the order specifiedby the user. If there is an import but its group is not specified in theconfiguration such an import should be placed at the end of the import list.
This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.
Wrong lexicographical order for 'java.util.Collection' import. Should be before 'org.jgrapht.alg.util.Pair'. Open
import java.util.Collection;
- Read upRead up
- Exclude checks
Checks that the groups of import declarations appear in the order specifiedby the user. If there is an import but its group is not specified in theconfiguration such an import should be placed at the end of the import list.
This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.
Wrong lexicographical order for 'java.util.HashSet' import. Should be before 'org.jgrapht.alg.util.Pair'. Open
import java.util.HashSet;
- Read upRead up
- Exclude checks
Checks that the groups of import declarations appear in the order specifiedby the user. If there is an import but its group is not specified in theconfiguration such an import should be placed at the end of the import list.
This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.
Local variable name 'i' must match pattern '^[a-z][a-z0-9][a-zA-Z0-9]*$'. Open
var i = 0;
- Read upRead up
- Exclude checks
Checks that local, non-final
variable names conform to a specified pattern.A catch parameter is considered to be a local variable.
This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.
'if' construct must use '{}'s. Open
if (!preds[i] && trues[i]) fn++;
- Read upRead up
- Exclude checks
Checks for braces around code blocks.
This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.
Extra separation in import group before 'java.util.Objects.requireNonNull' Open
import static java.util.Objects.requireNonNull;
- Read upRead up
- Exclude checks
Checks that the groups of import declarations appear in the order specifiedby the user. If there is an import but its group is not specified in theconfiguration such an import should be placed at the end of the import list.
This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.
Each variable declaration must be in its own statement. Open
double tp_fp = tp + fp, tp_fn = tp + fn;
- Read upRead up
- Exclude checks
Checks that each variable declaration is in its own statement and onits own line.
Rationale: the Java code conventions chapter 6.1 recommends thatdeclarations should be one per line/statement.
This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.
Wrong lexicographical order for 'java.util.stream.Collectors' import. Should be before 'org.jgrapht.alg.util.Pair'. Open
import java.util.stream.Collectors;
- Read upRead up
- Exclude checks
Checks that the groups of import declarations appear in the order specifiedby the user. If there is an import but its group is not specified in theconfiguration such an import should be placed at the end of the import list.
This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.
'.' should be on a new line. Open
flatMap(first -> cluster.stream().map(second -> pairOf(first, second))).
- Read upRead up
- Exclude checks
Checks line wrapping with separators.
This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.
Wrong lexicographical order for 'java.util.Objects.requireNonNull' import. Should be before 'org.jgrapht.alg.util.Pair'. Open
import static java.util.Objects.requireNonNull;
- Read upRead up
- Exclude checks
Checks that the groups of import declarations appear in the order specifiedby the user. If there is an import but its group is not specified in theconfiguration such an import should be placed at the end of the import list.
This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.
Each variable declaration must be in its own statement. Open
int tp = 0, fp = 0, fn = 0;
- Read upRead up
- Exclude checks
Checks that each variable declaration is in its own statement and onits own line.
Rationale: the Java code conventions chapter 6.1 recommends thatdeclarations should be one per line/statement.
This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.
Local variable name 'tp_fn' must match pattern '^[a-z][a-z0-9][a-zA-Z0-9]*$'. Open
double tp_fp = tp + fp, tp_fn = tp + fn;
- Read upRead up
- Exclude checks
Checks that local, non-final
variable names conform to a specified pattern.A catch parameter is considered to be a local variable.
This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.
'if' construct must use '{}'s. Open
if (preds[i] && !trues[i]) fp++;
- Read upRead up
- Exclude checks
Checks for braces around code blocks.
This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.
Wrong lexicographical order for 'java.util.stream.Stream' import. Should be before 'org.jgrapht.alg.util.Pair'. Open
import java.util.stream.Stream;
- Read upRead up
- Exclude checks
Checks that the groups of import declarations appear in the order specifiedby the user. If there is an import but its group is not specified in theconfiguration such an import should be placed at the end of the import list.
This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.
'.' should be on a new line. Open
return cluster.stream().
- Read upRead up
- Exclude checks
Checks line wrapping with separators.
This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.
Local variable name 'tp_fp' must match pattern '^[a-z][a-z0-9][a-zA-Z0-9]*$'. Open
double tp_fp = tp + fp, tp_fn = tp + fn;
- Read upRead up
- Exclude checks
Checks that local, non-final
variable names conform to a specified pattern.A catch parameter is considered to be a local variable.
This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.
Line is longer than 100 characters (found 128). Open
public PrecisionRecall evaluate(Collection<? extends Collection<V>> clusters, Collection<? extends Collection<V>> classes) {
- Read upRead up
- Exclude checks
Checks for long lines.
Rationale: Long lines are hard to read in printouts or if developershave limited screen space for the source code, e.g. if the IDEdisplays additional information like project tree, class hierarchy,etc.
This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.
Wrong lexicographical order for 'java.util.Set' import. Should be before 'org.jgrapht.alg.util.Pair'. Open
import java.util.Set;
- Read upRead up
- Exclude checks
Checks that the groups of import declarations appear in the order specifiedby the user. If there is an import but its group is not specified in theconfiguration such an import should be placed at the end of the import list.
This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.
Line is longer than 100 characters (found 105). Open
return (first.hashCode() <= second.hashCode()) ? Pair.of(first, second) : Pair.of(second, first);
- Read upRead up
- Exclude checks
Checks for long lines.
Rationale: Long lines are hard to read in printouts or if developershave limited screen space for the source code, e.g. if the IDEdisplays additional information like project tree, class hierarchy,etc.
This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.