mtrevisan/HunLinter

View on GitHub

Showing 338 of 403 total issues

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

    private void checkValidity(final String[] parts, final ParsingContext context){
        if(parts.length != 2)
            throw new LinterException(WRONG_FORMAT, context);
        if(!affixOption.is(parts[0]))
            throw new LinterException(BAD_OPTION, context, affixOption.getCode());
src/main/java/io/github/mtrevisan/hunlinter/parsers/affix/ConversionTable.java on lines 103..108

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

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 2 locations. Consider refactoring.
Open

    private SuperBlock(final boolean even, final int maxNumberOfDataBlocks, final int maxNumberOfElementsPerBlock,
            final int numberOfDataBlocks){
        this.even = even;
        this.maxNumberOfDataBlocks = maxNumberOfDataBlocks;
        this.maxNumberOfElementsPerBlock = maxNumberOfElementsPerBlock;
src/main/java/io/github/mtrevisan/hunlinter/languages/LetterMatcherEntry.java on lines 41..47

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

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 5 locations. Consider refactoring.
Open

        futureSaveResultFileChooser = JavaHelper.executeFuture(() -> {
            final JFileChooser saveResultFileChooser = new JFileChooser();
            saveResultFileChooser.setFileFilter(new FileNameExtensionFilter("Text files", "txt"));
            saveResultFileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
            return saveResultFileChooser;
src/main/java/io/github/mtrevisan/hunlinter/actions/DictionaryExtractMinimalPairsAction.java on lines 72..77
src/main/java/io/github/mtrevisan/hunlinter/actions/DictionaryExtractWordlistAction.java on lines 79..84
src/main/java/io/github/mtrevisan/hunlinter/gui/panes/PoSFSALayeredPane.java on lines 100..105
src/main/java/io/github/mtrevisan/hunlinter/gui/panes/ThesaurusLayeredPane.java on lines 117..122

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

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 2 locations. Consider refactoring.
Open

                        for(int m = 0; m < size; m ++){
                            final Inflection inflection = inflections.get(m);
                            if(inflection.hasContinuationFlag(flag))
                                dicEntriesPerFlag.add(inflection);
                        }
src/main/java/io/github/mtrevisan/hunlinter/services/XMLManager.java on lines 122..126

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

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 5 locations. Consider refactoring.
Open

        futureOpenDictionaryFSAFileChooser = JavaHelper.executeFuture(() -> {
            final JFileChooser openPoSDictionaryFileChooser = new JFileChooser();
            openPoSDictionaryFileChooser.setFileFilter(new FileNameExtensionFilter("FSA files", "dict"));
            openPoSDictionaryFileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
            return openPoSDictionaryFileChooser;
src/main/java/io/github/mtrevisan/hunlinter/actions/DictionaryExtractDuplicatesAction.java on lines 75..80
src/main/java/io/github/mtrevisan/hunlinter/actions/DictionaryExtractMinimalPairsAction.java on lines 72..77
src/main/java/io/github/mtrevisan/hunlinter/actions/DictionaryExtractWordlistAction.java on lines 79..84
src/main/java/io/github/mtrevisan/hunlinter/gui/panes/PoSFSALayeredPane.java on lines 100..105

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

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 5 locations. Consider refactoring.
Open

        futureOpenPoSFSAFileChooser = JavaHelper.executeFuture(() -> {
            final JFileChooser openPoSDictionaryFileChooser = new JFileChooser();
            openPoSDictionaryFileChooser.setFileFilter(new FileNameExtensionFilter("FSA files", "dict"));
            openPoSDictionaryFileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
            return openPoSDictionaryFileChooser;
src/main/java/io/github/mtrevisan/hunlinter/actions/DictionaryExtractDuplicatesAction.java on lines 75..80
src/main/java/io/github/mtrevisan/hunlinter/actions/DictionaryExtractMinimalPairsAction.java on lines 72..77
src/main/java/io/github/mtrevisan/hunlinter/actions/DictionaryExtractWordlistAction.java on lines 79..84
src/main/java/io/github/mtrevisan/hunlinter/gui/panes/ThesaurusLayeredPane.java on lines 117..122

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

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 2 locations. Consider refactoring.
Open

            for(int i = 0; i < length; i ++){
                final Node node = nodes.item(i);
                if(extractionCondition.test(node))
                    children.add(node);
            }
src/main/java/io/github/mtrevisan/hunlinter/parsers/dictionary/generators/WordGeneratorCompound.java on lines 100..104

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

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

        if(syllabeCount > longestWordCountBySyllabes){
            longestWordsBySyllabes.clear();
            longestWordsBySyllabes.add(hyphenation);
            longestWordCountBySyllabes = syllabeCount;
        }
src/main/java/io/github/mtrevisan/hunlinter/parsers/dictionary/DictionaryStatistics.java on lines 164..170

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

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

        return (parent.getType() == AffixType.SUFFIX
            ? word.substring(0, word.length() - appending.length()) + removing
            : removing + word.substring(appending.length()));
src/main/java/io/github/mtrevisan/hunlinter/parsers/vos/AffixEntry.java on lines 359..361

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

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 2 locations. Consider refactoring.
Open

        final Function<Void, List<IndexDataPair<ThesaurusEntry>>> step3 = ignored -> {
            resetProcessing("Execute " + workerData.getWorkerName() + " (step 3/3)");

            processLines(dictionaryProcessor);

src/main/java/io/github/mtrevisan/hunlinter/workers/autocorrect/AutoCorrectLinterWorker.java on lines 116..124

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

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

        if(letterCount > longestWordCountByCharacters){
            longestWordsByCharacters.clear();
            longestWordsByCharacters.add(word);
            longestWordCountByCharacters = letterCount;
        }
src/main/java/io/github/mtrevisan/hunlinter/parsers/dictionary/DictionaryStatistics.java on lines 178..184

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

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 5 locations. Consider refactoring.
Open

        futureSaveResultFileChooser = JavaHelper.executeFuture(() -> {
            final JFileChooser saveResultFileChooser = new JFileChooser();
            saveResultFileChooser.setFileFilter(new FileNameExtensionFilter("Text files", "txt"));
            saveResultFileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
            return saveResultFileChooser;
src/main/java/io/github/mtrevisan/hunlinter/actions/DictionaryExtractDuplicatesAction.java on lines 75..80
src/main/java/io/github/mtrevisan/hunlinter/actions/DictionaryExtractMinimalPairsAction.java on lines 72..77
src/main/java/io/github/mtrevisan/hunlinter/gui/panes/PoSFSALayeredPane.java on lines 100..105
src/main/java/io/github/mtrevisan/hunlinter/gui/panes/ThesaurusLayeredPane.java on lines 117..122

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

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 5 locations. Consider refactoring.
Open

        futureSaveResultFileChooser = JavaHelper.executeFuture(() -> {
            final JFileChooser saveResultFileChooser = new JFileChooser();
            saveResultFileChooser.setFileFilter(new FileNameExtensionFilter("Text files", "txt"));
            saveResultFileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
            return saveResultFileChooser;
src/main/java/io/github/mtrevisan/hunlinter/actions/DictionaryExtractDuplicatesAction.java on lines 75..80
src/main/java/io/github/mtrevisan/hunlinter/actions/DictionaryExtractWordlistAction.java on lines 79..84
src/main/java/io/github/mtrevisan/hunlinter/gui/panes/PoSFSALayeredPane.java on lines 100..105
src/main/java/io/github/mtrevisan/hunlinter/gui/panes/ThesaurusLayeredPane.java on lines 117..122

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

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

        return (parent.getType() == AffixType.SUFFIX
            ? word.substring(0, word.length() - removing.length()) + appending
            : appending + word.substring(removing.length()));
src/main/java/io/github/mtrevisan/hunlinter/parsers/vos/AffixEntry.java on lines 366..368

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

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 2 locations. Consider refactoring.
Open

        final Function<Void, List<IndexDataPair<CorrectionEntry>>> step2 = ignored -> {
            resetProcessing("Execute " + workerData.getWorkerName() + " (step 2/2)");

            processLines(dataProcessor);

src/main/java/io/github/mtrevisan/hunlinter/workers/thesaurus/ThesaurusLinterWorker.java on lines 132..140

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

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 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{
            Severity
            Category
            Status
            Source
            Language