mtrevisan/HunLinter

View on GitHub

Showing 338 of 403 total issues

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

                Similar blocks of code found in 4 locations. Consider refactoring.
                Open

                    public CorrectionEntry(final String incorrectForm, final String correctForm){
                        Objects.requireNonNull(incorrectForm, "Incorrect form cannot be null");
                        Objects.requireNonNull(correctForm, "Correct form cannot be null");
                
                        this.incorrectForm = incorrectForm;
                src/main/java/io/github/mtrevisan/hunlinter/gui/renderers/DictionarySortCellRenderer.java on lines 53..59
                src/main/java/io/github/mtrevisan/hunlinter/parsers/hyphenation/Hyphenator.java on lines 67..73
                src/main/java/io/github/mtrevisan/hunlinter/workers/WorkerManager.java on lines 78..84

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 47.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 4 locations. Consider refactoring.
                Open

                    public WorkerManager(final Packager packager, final ParserManager parserManager){
                        Objects.requireNonNull(packager, "Packager cannot be null");
                        Objects.requireNonNull(parserManager, "Parser manager cannot be null");
                
                        this.packager = packager;
                src/main/java/io/github/mtrevisan/hunlinter/gui/renderers/DictionarySortCellRenderer.java on lines 53..59
                src/main/java/io/github/mtrevisan/hunlinter/parsers/autocorrect/CorrectionEntry.java on lines 36..42
                src/main/java/io/github/mtrevisan/hunlinter/parsers/hyphenation/Hyphenator.java on lines 67..73

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 47.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 4 locations. Consider refactoring.
                Open

                    public DictionarySortCellRenderer(final Function<Integer, Integer> boundaryIndex, final Font font){
                        Objects.requireNonNull(boundaryIndex, "Boundary index cannot be null");
                        Objects.requireNonNull(font, "Font cannot be null");
                
                        this.boundaryIndex = boundaryIndex;
                src/main/java/io/github/mtrevisan/hunlinter/parsers/autocorrect/CorrectionEntry.java on lines 36..42
                src/main/java/io/github/mtrevisan/hunlinter/parsers/hyphenation/Hyphenator.java on lines 67..73
                src/main/java/io/github/mtrevisan/hunlinter/workers/WorkerManager.java on lines 78..84

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 47.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 4 locations. Consider refactoring.
                Open

                    public Hyphenator(final HyphenationParser hypParser, final String breakCharacter){
                        Objects.requireNonNull(hypParser, "Hyphenation parser cannot be null");
                        Objects.requireNonNull(breakCharacter, "Break character cannot be null");
                
                        this.hypParser = hypParser;
                src/main/java/io/github/mtrevisan/hunlinter/gui/renderers/DictionarySortCellRenderer.java on lines 53..59
                src/main/java/io/github/mtrevisan/hunlinter/parsers/autocorrect/CorrectionEntry.java on lines 36..42
                src/main/java/io/github/mtrevisan/hunlinter/workers/WorkerManager.java on lines 78..84

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 47.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                            for(int i = 0; i < minLength; i ++){
                                final int result = (left[i] & 0xFF) - (right[i] & 0xFF);
                                if(result != 0)
                                    return result;
                            }
                src/main/java/io/github/mtrevisan/hunlinter/datastructures/fsa/builders/LexicographicalComparator.java on lines 167..171

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 46.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                            for(; i < minLength; i ++){
                                final int result = (left[i] & 0xFF) - (right[i] & 0xFF);
                                if(result != 0)
                                    return result;
                            }
                src/main/java/io/github/mtrevisan/hunlinter/datastructures/fsa/builders/LexicographicalComparator.java on lines 187..191

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 46.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                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

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

                    @SuppressWarnings("OverlyBroadThrowsClause")
                    public final void parse(final File theFile) throws IOException{
                        clear();
                
                        final Path thePath = theFile.toPath();

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

                    private boolean existsCompoundAsReplacement(final String word){
                        boolean exists = false;
                        for(final String elem : compoundAsReplacement)
                            if(word.contains(elem)){
                                exists = 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 clear has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    public final void clear(){
                        totalInflections = 0;
                        longestWordCountByCharacters = 0;
                        longestWordCountBySyllabes = 0;
                        lengthsFrequencies.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

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

                    public final void replaceAll(final Collection<String> c, final int startIndex){
                        if(!c.isEmpty()){
                            final int size = getSize();
                            if(startIndex >= size)
                                addAll(c);

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

                    private void enforceOnlyInCompound(final Iterable<Inflection> inflections){
                        final String onlyInCompoundFlag = affixData.getOnlyInCompoundFlag();
                        if(onlyInCompoundFlag != 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 clear has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    public final void clear(){
                        secondLevelPresent = false;
                        patternNoHyphen = null;
                        patterns.clear();
                        for(final Level lev : Level.values()){

                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