mtrevisan/HunLinter

View on GitHub

Showing 197 of 403 total issues

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 existsCompoundAsReplacement has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private boolean existsCompoundAsReplacement(final String word){
        boolean exists = false;
        for(final String elem : compoundAsReplacement)
            if(word.contains(elem)){
                exists = true;

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 clear has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public final void clear(){
        totalInflections = 0;
        longestWordCountByCharacters = 0;
        longestWordCountBySyllabes = 0;
        lengthsFrequencies.clear();

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 replaceAll has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public final void replaceAll(final Collection<String> c, final int startIndex){
        if(!c.isEmpty()){
            final int size = getSize();
            if(startIndex >= size)
                addAll(c);

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 enforceOnlyInCompound has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private void enforceOnlyInCompound(final Iterable<Inflection> inflections){
        final String onlyInCompoundFlag = affixData.getOnlyInCompoundFlag();
        if(onlyInCompoundFlag != null){
            final Iterator<Inflection> itr = inflections.iterator();
            while(itr.hasNext()){

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 clear has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public final void clear(){
        secondLevelPresent = false;
        patternNoHyphen = null;
        patterns.clear();
        for(final Level lev : Level.values()){

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 checkCompoundValidity has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private static void checkCompoundValidity(final String[] parts, final CharSequence compoundRule){
        for(final String part : parts){
            final int size = part.length();
            final boolean isFlag = (size != 1
                || !FlagParsingStrategy.FLAG_OPTIONAL.equals(part) && !FlagParsingStrategy.FLAG_ANY.equals(part));

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 getMinimumFromLength has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public final int getMinimumFromLength(){
        int minLength = -1;
        for(final String f : from){
            final int length = f.length();
            if(length < minLength || minLength < 0){

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 freezeState has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private int freezeState(final int activePathIndex){
        final int start = activePath[activePathIndex];
        final int end = nextArcOffset[activePathIndex];
        final int length = end - start;

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 add has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public final boolean add(final String[] partOfSpeeches, final String[] synonyms){
        final StringJoiner sj = new StringJoiner(LIST_SEPARATOR, PART_OF_SPEECH_START, PART_OF_SPEECH_END);
        final int size = (partOfSpeeches != null? partOfSpeeches.length: 0);
        for(int i = 0; i < size; i ++)
            sj.add(partOfSpeeches[i]);

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 contains has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public final boolean contains(final Collection<String> partOfSpeeches, final List<String> synonyms){
        final Collection<String> ss = new ArrayList<>(synonyms);
        final boolean removed = ss.remove(definition);
        if(removed)
            for(int i = 0; i < this.synonyms.size(); i ++)

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 insertRuleOrUpdateFrom has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private static void insertRuleOrUpdateFrom(final List<LineEntry> expandedRules, final LineEntry rule){
        final int ruleIndex = expandedRules.indexOf(rule);
        if(ruleIndex >= 0)
            expandedRules.get(ruleIndex).from.addAll(rule.from);
        else{

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 containsPartOfSpeechesAndSynonym has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public final boolean containsPartOfSpeechesAndSynonym(final List<String> partOfSpeeches, final String synonym){
        if(synonyms != null)
            for(int i = 0; i < synonyms.size(); i ++){
                final SynonymsEntry entry = synonyms.get(i);
                if(entry.hasSamePartOfSpeeches(partOfSpeeches) && entry.containsSynonym(synonym))

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 initialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    @EventHandler
    @SuppressWarnings({"unused", "NumberEquality"})
    public final void initialize(final Integer actionCommand){
        if(actionCommand != MainFrame.ACTION_COMMAND_INITIALIZE)
            return;

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 validate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public final void validate(){
        if(getExpectedNumberOfElements() <= 0)
            throw new IllegalArgumentException(INVALID_NUMBER_OF_ELEMENTS);
        if(getFalsePositiveProbability() <= 0. || getFalsePositiveProbability() >= 1.)
            throw new IllegalArgumentException(INVALID_FALSE_POSITIVE_PROBABILITY);

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 contains has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    @Override
    public final boolean contains(final T value){
        if(value != null)
            for(final BloomFilterInterface<T> filter : filters)
                if(filter.contains(value))

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 validateBasicRules has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private static void validateBasicRules(final CharSequence rule){
        if(!RegexHelper.find(rule, PATTERN_VALID_RULE))
            throw new LinterException(INVALID_RULE, rule);
        if(!StringUtils.contains(rule, EQUALS_SIGN)){
            if(!RegexHelper.find(rule, PATTERN_VALID_RULE_BREAK_POINTS))

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 siftDown has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private static <T> void siftDown(final T[] data, final int low, final int heapsize, final Comparator<? super T> comparator){
        //index of the element being moved down the tree
        int parent = low;
        int leftChild;
        do{

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 createInnerProcessorByLines has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private Consumer<IndexDataPair<String>> createInnerProcessorByLines(final Consumer<IndexDataPair<String>> dataProcessor,
            final long totalEntries){
        final AtomicInteger progress = new AtomicInteger(1);
        final AtomicInteger progressIndex = new AtomicInteger(1);
        final int progressStep = (int)Math.ceil(totalEntries / 100.f);

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

Severity
Category
Status
Source
Language