mtrevisan/HunLinter

View on GitHub

Showing 197 of 403 total issues

Avoid deeply nested control flow statements.
Open

                        for(int k = j + 1; k < properChildrenSize; k ++)
                            if(!SetHelper.intersection(childrenGroup.get(properChildren.get(j)), childrenGroup.get(properChildren.get(k))).isEmpty())
                                //TODO
                                throw new IllegalStateException("Children are not disjointed, please report this case to the developer, thank you");

    Method emitArc has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        private static int emitArc(final ByteBuffer bb, final OutputStream os, final int gtl, int flags, final byte label, final int targetOffset)

      Method enforceNextCompoundCase has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          private static String enforceNextCompoundCase(final char lastChar, String nextCompound, final StringHelper.Casing lastWordCasing,
                  final StringHelper.Casing nextWordCasing){
              final char nextChar = nextCompound.charAt(0);
              if(Character.isLetter(lastChar) && Character.isLetter(nextChar)){
                  final Set<StringHelper.Casing> collisions = COMPOUND_WORD_BOUNDARY_COLLISIONS.get(lastWordCasing);

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

          private int emitNodes(final FSAAbstract fsa, final OutputStream os, final DynamicIntArray linearized) throws IOException{
              int offset = 0;
      
              //add epsilon state
              offset += emitNodeData(os, 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

      Avoid deeply nested control flow statements.
      Open

                              for(int m = 0; m < size; m ++){
                                  final Inflection inflection = inflections.get(m);
                                  if(inflection.hasContinuationFlag(flag))
                                      dicEntriesPerFlag.add(inflection);
                              }

        Avoid deeply nested control flow statements.
        Open

                                if(restart)
                                    continue;

          Method getTableCellRendererComponent has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public final Component getTableCellRendererComponent(final JTable table, final Object value, final boolean isSelected,
                      final boolean hasFocus, final int row, final int column){

            Method next has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                @Override
                public final WordData next(){
                    final ByteBuffer entryBuffer = entriesItr.next();
                    final byte[] array = entryBuffer.array();
                    final int limit = entryBuffer.remaining();

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

                @Override
                public final Hyphenation hyphenate(final String word){
                    //apply first level hyphenation
                    final Map<HyphenationParser.Level, AhoCorasickTrie<String>> patterns = hypParser.getPatterns();
                    HyphenationOptions options = hypParser.getOptions().getNonCompoundOptions();

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

                @Override
                public final <T extends OutputStream> T serialize(final FSAAbstract fsa, final T os, final ProgressCallback progressCallback)
                        throws IOException{
                    //calculate the most frequent labels and build indexed labels dictionary
                    computeLabelsIndex(fsa);

            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 deeply nested control flow statements.
            Open

                                    for(int j = 1; !restart && j < branchSize; j ++){
                                        final LineEntry child = branch.get(j);
                                        if(!parent.from.containsAll(child.from))
                                            //TODO
                                            throw new IllegalStateException("No proper children found, please report this case to the developer, thank you");

              Avoid deeply nested control flow statements.
              Open

                                      if(inflections.size() > limit)
                                          break;

                Method enforceNoHyphens has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    public final void enforceNoHyphens(final List<String> syllabes, final Iterable<String> noHyphen){
                        if(syllabes.size() > 1){
                            int wordLength = 0;
                            for(int i = 0; i < syllabes.size(); i ++)
                                wordLength += syllabes.get(i).length();

                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 deeply nested control flow statements.
                Open

                                            for(final AffixEntry candidateAppliedRule : candidate.getInflection().getAppliedRules())
                                                candidateAppliedRules.remove(candidateAppliedRule.getFlag());

                  Method maxRepeating has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static int maxRepeating(final CharSequence text, final char chr){
                          final int n = text.length();
                          int count = 0;
                          int currentCount = 1;
                          //traverse string except last character

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

                      @SuppressWarnings("OverlyBroadThrowsClause")
                      private static List<File> splitAndSortFiles(final File file, final ExternalSorterOptions options) throws IOException{
                          //extract uncompressed file size
                          final long dataLength = FileHelper.getFileSize(file);
                          final long availableMemory = JavaHelper.estimateAvailableMemory();

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

                      private void notifyListeners(final WatchKey key){
                          final List<WatchEvent<?>> pollEvents = key.pollEvents();
                          for(final WatchEvent<?> event : pollEvents){
                              final WatchEvent.Kind<?> eventKind = event.kind();
                  
                  

                  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 deeply nested control flow statements.
                  Open

                                              for(final AffixEntry otherAppliedRule : other.getInflection().getAppliedRules())
                                                  otherAppliedRules.remove(otherAppliedRule.getFlag());

                    Avoid deeply nested control flow statements.
                    Open

                                                if(candidateAppliedRules.isEmpty()){
                                                    final String info = candidate.getWord()
                                                        + (equalProduction && ! other.getWord().equals(candidate.getWord())? " (or " + other.getWord() + ")": "")
                                                        + " is a candidate for removal";
                                                    if(!sj.toString().endsWith(info))

                      Method append has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                          @Override
                          protected final void append(final ILoggingEvent eventObject){
                              if((!TEXT_AREAS.isEmpty() || !TEXT_PANES.isEmpty() || !LABELS.isEmpty()) && encoder != null){
                                  final Level level = eventObject.getLevel();
                                  if(level == Level.WARN && !preferences.getBoolean(ReportWarningsAction.REPORT_WARNINGS, 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

                      Severity
                      Category
                      Status
                      Source
                      Language