mtrevisan/HunLinter

View on GitHub

Showing 197 of 403 total issues

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

    @Override
    public final void fileDeleted(final Path path){
        LOGGER.info(MARKER_APPLICATION, "File {} deleted", path.getFileName());

        final File file = path.toFile();
Severity: Minor
Found in src/main/java/io/github/mtrevisan/hunlinter/parsers/ParserManager.java - About 25 mins to fix

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

    private static void expandAddition(final List<LineEntry> rules, final LineEntry compactedRule){
        final String from = rules.get(0).from.iterator().next();
        final int longestConditionLength = compactedRule.condition.length();
        for(int i = 0; i < rules.size(); i ++){
            final LineEntry rule = rules.get(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 removeTwofolds has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private void removeTwofolds(final Iterable<Inflection> prods){
        final String circumfixFlag = affixData.getCircumfixFlag();
        if(circumfixFlag != null){
            final Iterator<Inflection> itr = prods.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 reverse has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public final LineEntry reverse(){
        final String reversedRemoval = StringUtils.reverse(removal);
        final Collection<String> reversedAddition = new HashSet<>(addition.size());
        final Collection<String> reversedFrom = new HashSet<>(from.size());
        final StringBuilder sb = new StringBuilder();

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

   private void limitComboBoxActionPerformed(final java.awt.event.ActionEvent evt) {//GEN-FIRST:event_limitComboBoxActionPerformed
      final String inputText = ((String)inputComboBox.getEditor().getItem()).trim();
      final int limit = Integer.parseInt(limitComboBox.getItemAt(limitComboBox.getSelectedIndex()));
      final String inputCompounds = inputTextArea.getText();

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

    public final void letterToFlagIncompatibilityCheck(final Inflection inflection){
        final String word = inflection.getWord();
        for(int i = 0; i < letterAndRulesNotCombinableKeys.length; i ++)
            if(StringUtils.containsAny(word, letterAndRulesNotCombinableKeys[i])){
                final LetterMatcherEntry[] letterMatcherEntries = letterAndRulesNotCombinable.get(letterAndRulesNotCombinableKeys[i]);
Severity: Minor
Found in src/main/java/io/github/mtrevisan/hunlinter/languages/RulesLoader.java - About 25 mins to fix

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

    public final void flagToFlagIncompatibilityCheck(final Inflection inflection){
        for(int i = 0; i < ruleAndRulesNotCombinableKeys.length; i ++)
            if(inflection.hasContinuationFlag(ruleAndRulesNotCombinableKeys[i])){
                final RuleMatcherEntry[] ruleMatcherEntries = ruleAndRulesNotCombinable.get(ruleAndRulesNotCombinableKeys[i]);
                for(int j = 0; j < ruleMatcherEntries.length; j ++)
Severity: Minor
Found in src/main/java/io/github/mtrevisan/hunlinter/languages/RulesLoader.java - About 25 mins to fix

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

   private void addRuleButtonActionPerformed(final java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addRuleButtonActionPerformed
      final  String newRule = addRuleTextField.getText();
      final HyphenationParser.Level level = HyphenationParser.Level.values()[addRuleLevelComboBox.getSelectedIndex()];
      final String foundRule = parserManager.addHyphenationRule(newRule.toLowerCase(Locale.ROOT), level);
      if(foundRule == null){

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

    private static void linearizeState(final FSAAbstract fsa, final DynamicIntArray nodes, final DynamicIntArray linearized,
            final IntSet visited, final int node){
        linearized.add(node);
        visited.add(node);
        for(int arc = fsa.getFirstArc(node); arc != 0; arc = fsa.getNextArc(arc))

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

    public final DuplicationResult<CorrectionEntry> insertCorrection(final String incorrect, final String correct,
            final BooleanSupplier duplicatesDiscriminator){
        if(incorrect.contains(HyphenationParser.APOSTROPHE) || incorrect.contains(QUOTATION_MARK))
            throw new LinterException(BAD_QUOTE, "Incorrect", incorrect);
        if(correct.contains(HyphenationParser.APOSTROPHE) || correct.contains(QUOTATION_MARK))

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

    public final boolean containsSynonym(final String synonym){
        if(synonyms != null)
            for(int i = 0; i < synonyms.size(); i ++)
                if(ThesaurusDictionary.removeSynonymUse(synonyms.get(i)).equals(synonym))
                    return 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 enforceNeedAffixFlag has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private void enforceNeedAffixFlag(final Iterable<Inflection> inflections){
        final String needAffixFlag = affixData.getNeedAffixFlag();
        if(needAffixFlag != 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 searchInText has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public final void searchInText(final String text, final HitProcessor<V> processor){
        Objects.requireNonNull(processor, "Processor cannot be null");

        final HitConsumer consumer = (hits, index) -> {
            final int position = index + 1;

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

    public final boolean containsHasToContainStressDerivationalSuffix(final List<String> derivationalSuffixes){
        if(!hasToContainStressDerivationalSuffix.isEmpty())
            for(int i = 0; i < derivationalSuffixes.size(); i ++)
                if(hasToContainStressDerivationalSuffix.contains(derivationalSuffixes.get(i)))
                    return true;
Severity: Minor
Found in src/main/java/io/github/mtrevisan/hunlinter/languages/RulesLoader.java - About 25 mins to fix

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

    public final boolean removeRule(final String rule, final Level level){
        final String oldRule;
        if(isCustomRule(rule)){
            final String key = StringHelper.removeAll(rule, EQUALS_SIGN);
            oldRule = customHyphenations.get(level)

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

    private List<Inflection> generateInflections(final String compoundWord, final List<DictionaryEntry> compoundEntries,
            final List<List<String>> continuationFlags){
        final boolean hasForbidCompoundFlag = (affixData.getForbidCompoundFlag() != null);
        final boolean hasPermitCompoundFlag = (affixData.getPermitCompoundFlag() != null);
        final boolean allowTwofoldAffixesInCompound = affixData.isTwofoldAffixesInCompound();

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

    @Override
    public void setFont(final Font font){
        //FIXME find a way to dynamically change the font of each tag and re-adjust container layout
        synchronized(getTreeLock()){
            final int size = getComponents().length;
Severity: Minor
Found in src/main/java/io/github/mtrevisan/hunlinter/gui/components/TagPanel.java - About 25 mins to fix

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

    public final void match(final Inflection inflection){
        if(!inflection.getContinuationFlags().isEmpty())
            for(int i = 0; i < wrongFlags.length; i ++)
                if(inflection.hasContinuationFlag(wrongFlags[i]))
                    throw new LinterException(messagePattern, masterFlag, wrongFlags[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 intersects has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public final boolean intersects(final Collection<String> partOfSpeeches, final String[] synonyms){
        final Collection<String> ss = new ArrayList<>(List.of(synonyms));
        final boolean removed = ss.remove(definition);
        for(int i = 0; i < this.synonyms.size(); i ++){
            final SynonymsEntry entry = this.synonyms.get(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 isProductiveFor has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public final boolean isProductiveFor(final String word){
        if(entries != null)
            for(int i = 0; i < entries.size(); i ++)
                if(entries.get(i).canApplyTo(word))
                    return true;
Severity: Minor
Found in src/main/java/io/github/mtrevisan/hunlinter/parsers/vos/RuleEntry.java - About 25 mins to fix

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