mtrevisan/HunLinter

View on GitHub

Showing 198 of 403 total issues

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

Avoid deeply nested control flow statements.
Open

                        if(restart)
                            continue;

    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);
                            }

      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

      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 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

        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

        Avoid deeply nested control flow statements.
        Open

                                if(child.from.size() < parent.from.size() && parent.condition.length() == child.condition.length()
                                        && parent.from.containsAll(child.from))
                                    properChildren.add(child);

          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

          Avoid deeply nested control flow statements.
          Open

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

            Avoid deeply nested control flow statements.
            Open

                                    if(startPart == null){
                                        final String rule = m.group(PARAM_RULE);
            
                                        start = 1;
                                        cut = getKeyLengthFromData(rule);

              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)

                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");

                  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

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

                      @SuppressWarnings("OverlyBroadThrowsClause")
                      private static void mergeSortedFiles(final Collection<File> files, final ExternalSorterOptions options, final File outputFile)
                              throws IOException{
                          final Comparator<String> comparator = options.getComparator();
                          final Queue<BinaryFileBuffer> queue = new PriorityQueue<>(files.size(),

                  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 candidateAppliedRule : candidate.getInflection().getAppliedRules())
                                                  candidateAppliedRules.remove(candidateAppliedRule.getFlag());

                    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

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

                        private boolean loadHandlerIntoQueue(final Object subscriber){
                            boolean subscribedAlready = false;
                            for(final HandlerInfo info : handlers){
                                final Object otherSubscriber = info.getSubscriber();
                                if(otherSubscriber == 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

                    Severity
                    Category
                    Status
                    Source
                    Language