mtrevisan/HunLinter

View on GitHub

Showing 198 of 403 total issues

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

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

    public List<String> getMorphologicalFields(final MorphologicalTag morphologicalTag){
        final List<String> collector = new ArrayList<>(morphologicalFields != null? morphologicalFields.size(): 0);
        if(morphologicalFields != null){
            final String tag = morphologicalTag.getCode();
            final int purgeTag = tag.length();
Severity: Minor
Found in src/main/java/io/github/mtrevisan/hunlinter/parsers/vos/AffixEntry.java - About 35 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 extractWords has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private List<String> extractWords(){
        final List<String> list = new ArrayList<>(0);

        final Charset charset = dicParser.getCharset();
        final File dicFile = dicParser.getDicFile();

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

    private static void encode(final ByteArrayList encodings, final List<Inflection> inflections, final byte separator,
            final SequenceEncoderInterface sequenceEncoder){
        ByteBuffer tag = ByteBuffer.allocate(0);

        for(int i = 0; i < inflections.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

Avoid too many return statements within this method.
Open

            return FSAMatchResult.AUTOMATON_HAS_PREFIX;

    Avoid too many return statements within this method.
    Open

            return new FSAMatchResult(FSAMatchResult.PREFIX_MATCH, 0, node);

      Avoid too many return statements within this method.
      Open

              return Collections.emptyList();

        Avoid too many return statements within this method.
        Open

                return (startsWithUppercase? Casing.PASCAL_CASE: Casing.CAMEL_CASE);

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

              private List<Inflection> applyAffixRules(final DictionaryEntry dicEntry, final RuleEntry overriddenRule,
                      final boolean enforceOnlyInCompound){
                  final List<Inflection> inflections = applyAffixRules(dicEntry, false, overriddenRule);
          
                  if(enforceOnlyInCompound)

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

              private static void checkCompoundValidity(final String[] parts, final String compoundRule){
                  for(final String part : parts){
                      final boolean isNumber = (part.length() != 1
                          || !FlagParsingStrategy.FLAG_OPTIONAL.equals(part) && !FlagParsingStrategy.FLAG_ANY.equals(part));
                      if(isNumber && !NumberUtils.isCreatable(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 getTwofoldInflections has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              private List<Inflection> getTwofoldInflections(final List<Inflection> onefoldInflections, final boolean isCompound,
                      final boolean reverse, final RuleEntry overriddenRule) throws NoApplicableRuleException{
                  final List<Inflection> twofoldInflections = new ArrayList<>(0);
                  for(int i = 0; i < onefoldInflections.size(); i ++){
                      final Inflection inflection = onefoldInflections.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 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 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 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 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 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 withReplacementPairs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public final DictionaryMetadataBuilder withReplacementPairs(final Map<String, List<String>> replacementPairs){
                  final StringBuilder builder = new StringBuilder();
                  for(final Map.Entry<String, List<String>> e : replacementPairs.entrySet()){
                      final String k = e.getKey();
                      for(final String v : e.getValue()){

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

              private int linearizeAndCalculateOffsets(final FSAAbstract fsa, final DynamicIntArray states, final DynamicIntArray linearized,
                      final IntIntMap offsets) throws IOException{
                  final IntSet visited = new IntHashSet();
                  final DynamicIntArray nodes = new DynamicIntArray();
                  linearized.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

          Severity
          Category
          Status
          Source
          Language