mtrevisan/HunLinter

View on GitHub

Showing 197 of 403 total issues

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

    private static <T> void buildMaxHeap(final T[] data, final int low, final int high, final Comparator<? super T> comparator,
            final int progressStep, final ProgressCallback progressCallback){

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

        public static void forEachDictionaryLine(final File file, final Charset charset, final BiConsumer<Integer, String> fun,
                final ProgressCallback progressCallback){
            final int totalLines = FileHelper.getLinesCount(file, charset);
            int progress = 0;
            int progressIndex = 0;
    Severity: Minor
    Found in src/main/java/io/github/mtrevisan/hunlinter/services/ParserHelper.java - About 45 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 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 readHunspellCharsetName has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        private static String readHunspellCharsetName(final BufferedReader reader, final int limitLinesRead) throws IOException{
            //scan each lines until either a valid charset name is found as the first line (hyphenation or thesaurus file),
            //or `SET <charsetName>` is found (affix file)
            int linesRead = 0;
            while(limitLinesRead < 0 || linesRead < limitLinesRead){

    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

    Consider simplifying this complex logical expression.
    Open

            if(appliedRules.length > 0){
                //check that last suffix and last prefix don't have the needaffix flag
                boolean lastSuffix = false;
                boolean lastPrefix = false;
                boolean lastSuffixNeedAffix = false;

      Consider simplifying this complex logical expression.
      Open

              if(hasLeadingZeros(tokens[0])
                      || tokensWithPatch != null && (tokensWithPatch.length > 1 && hasLeadingZeros(tokens[1])
                      || tokensWithPatch.length > 2 && hasLeadingZeros(tokensWithPatch[2])))
                  throw new IllegalArgumentException("Numeric identifier MUST NOT contain leading zeros");

        Method getListCellRendererComponent has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public final Component getListCellRendererComponent(final JList<? extends String> list, final String value, final int lineIndex,
                    final boolean isSelected, final boolean cellHasFocus){

          Method linearizeState has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              private static void linearizeState(final FSAAbstract fsa, final DynamicIntArray nodes, final DynamicIntArray linearized,
                      final IntSet visited, final int node){

            Method createPopupMenu has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    protected JPopupMenu createPopupMenu(final boolean properties, final boolean copy, final boolean save, final boolean print,
                            final boolean zoom){

              Method emitArcs has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  private boolean emitArcs(final FSAAbstract fsa, final OutputStream os, final int[] linearized, final int gtl, final int nodeDataLength)

                Method applyAffixRule has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    private List<Inflection> applyAffixRule(final DictionaryEntry dicEntry, final String affix, final List<String> postponedAffixes,
                            final boolean isCompound, final RuleEntry overriddenRule) throws NoApplicableRuleException{

                  Method retrieveAdditionsToBeRemoved has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      private static List<String> retrieveAdditionsToBeRemoved(final Collection<LineEntry> rules, final LineEntry rule,
                              final Collection<LineEntry> temporaryRules, final Map<String, List<String>> lcss, final List<String> keys){

                    Method replace has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        public final void replace(final FilterBypass fb, final int offset, final int length, final String text, final AttributeSet attrs) throws BadLocationException{

                      Method sort has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          public static <T> void sort(final T[] data, final int low, final int high, final Comparator<? super T> comparator,
                                  final ProgressCallback progressCallback){

                        Method createWorker has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            private static <T> void createWorker(final String workerName, final Function<T, WorkerAbstract<?>> creator, final Supplier<T> preStart,
                                    final Consumer<WorkerAbstract<?>> onStart, final Consumer<WorkerAbstract<?>> onEnd){
                        Severity: Minor
                        Found in src/main/java/io/github/mtrevisan/hunlinter/workers/WorkerManager.java - About 35 mins to fix

                          Method createDictionaryStatistics has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              public final void createDictionaryStatistics(final BooleanSupplier preStart, final Consumer<WorkerAbstract<?>> onStart,
                                      final Consumer<WorkerAbstract<?>> onEnd, final Consumer<Exception> onCancelled, final Frame parentFrame){
                          Severity: Minor
                          Found in src/main/java/io/github/mtrevisan/hunlinter/workers/WorkerManager.java - About 35 mins to fix

                            Method encode has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                private static byte[] encode(final byte[] inflectedWord, final ByteBuffer tag, final String stem, final byte separator,
                                        final SequenceEncoderInterface sequenceEncoder){

                              Method createWordlistWorker has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                  public final void createWordlistWorker(final WordlistWorker.WorkerType type, final Supplier<File> preStart,
                                          final Consumer<WorkerAbstract<?>> onStart, final Consumer<WorkerAbstract<?>> onEnd, final Consumer<Exception> onCancelled){
                              Severity: Minor
                              Found in src/main/java/io/github/mtrevisan/hunlinter/workers/WorkerManager.java - About 35 mins to fix

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

                                    public final void mergeThesaurusRow(final Component invoker){
                                        final int selectedRow = table.convertRowIndexToModel(table.getSelectedRow());
                                        final ThesaurusTableModel dm = (ThesaurusTableModel)table.getModel();
                                        final ThesaurusEntry synonyms = dm.getSynonymsAt(selectedRow);
                                        final SynonymsEntry newSynonyms = new SynonymsEntry(synonymsTextField.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

                                Severity
                                Category
                                Status
                                Source
                                Language