mtrevisan/HunLinter

View on GitHub
src/main/java/io/github/mtrevisan/hunlinter/parsers/thesaurus/ThesaurusParser.java

Summary

Maintainability
A
1 hr
Test Coverage

Method parse has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    @SuppressWarnings("OverlyBroadThrowsClause")
    public final void parse(final File theFile) throws IOException{
        clear();

        final Path thePath = theFile.toPath();

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

Method prepareTextForFilter has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static Pair<String, String> prepareTextForFilter(final String[] partOfSpeeches, final String[] synonyms){
        //extract Part-of-Speech if present
        final String posFilter = (partOfSpeeches != null && partOfSpeeches.length > 0
            ? "[\\(\\s](" + StringUtils.join(partOfSpeeches, PIPE) + ")[\\),]"
            : ".+");

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

Method insertSynonyms has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public final DuplicationResult<ThesaurusEntry> insertSynonyms(final String partOfSpeechAndSynonyms,
            final Predicate<String> duplicatesDiscriminator){
        final String[] posAndSyns = StringUtils.split(partOfSpeechAndSynonyms, ThesaurusEntry.PART_OF_SPEECH_SEPARATOR, 2);
        if(posAndSyns.length != 2)
            throw new LinterException(WRONG_FORMAT, partOfSpeechAndSynonyms);

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

There are no issues that match your filters.

Category
Status