mtrevisan/HunLinter

View on GitHub

Showing 338 of 403 total issues

Method hyphenateAddRule has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    private void hyphenateAddRule(){
        final String language = parserManager.getLanguage();
        final Orthography orthography = BaseBuilder.getOrthography(language);
        String addedRuleText = orthography.correctOrthography(wordTextField.getText());
        final String addedRule = orthography.correctOrthography(addRuleTextField.getText().toLowerCase(Locale.ROOT));

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

    private boolean searchInText(final String text, final HitConsumer hitConsumer){
        Objects.requireNonNull(text, "Text cannot be null");

        boolean found = false;
        if(isInitialized()){

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

    private static void validateAugmentedRule(final CharSequence cleanedRule, final String rule){
        final int count = RegexHelper.clear(cleanedRule, PATTERN_HYPHENATION_POINT).length();
        if(count != 1)
            throw new LinterException(MORE_HYPHENATION_DOTS, rule);

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

    public final List<String> combineMorphologicalFields(final DictionaryEntry dicEntry){
        final List<String> baseMorphFields = (dicEntry.morphologicalFields != null? new ArrayList<>(dicEntry.morphologicalFields):
            new ArrayList<>(0));
        final List<String> ruleMorphFields = (morphologicalFields != null? morphologicalFields: new ArrayList<>(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 sort has a Cognitive Complexity of 10 (exceeds 5 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){
        Objects.requireNonNull(data, "Data cannot be null");
        Objects.requireNonNull(comparator, "Comparator cannot be null");
        assert low < high && low < data.length && high <= data.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

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

    public final void openSentenceExceptionsFile(final File sexFile) throws IOException, SAXException{
        if(sexFile != null && sexFile.exists()){
            LOGGER.info(MARKER_APPLICATION, "Opening Sentence Exceptions file: {}", sexFile.getName());

            final String language = affParser.getLanguage();
src/main/java/io/github/mtrevisan/hunlinter/parsers/ParserManager.java on lines 295..306

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

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

    public final void openWordExceptionsFile(final File wexFile) throws IOException, SAXException{
        if(wexFile != null && wexFile.exists()){
            LOGGER.info(MARKER_APPLICATION, "Opening Word Exceptions file: {}", wexFile.getName());

            final String language = affParser.getLanguage();
src/main/java/io/github/mtrevisan/hunlinter/parsers/ParserManager.java on lines 282..293

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

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

        final Function<Void, Void> step1 = ignored -> {
            prepareProcessing("Execute " + workerData.getWorkerName());

            final Path dicPath = dicParser.getDicFile()
                .toPath();
src/main/java/io/github/mtrevisan/hunlinter/workers/StatisticsWorker.java on lines 115..126
src/main/java/io/github/mtrevisan/hunlinter/workers/dictionary/CompoundRulesWorker.java on lines 78..89
src/main/java/io/github/mtrevisan/hunlinter/workers/dictionary/DictionaryReducerWorker.java on lines 76..87
src/main/java/io/github/mtrevisan/hunlinter/workers/hyphenation/HyphenationLinterWorker.java on lines 110..121

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

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

        final Function<Void, List<IndexDataPair<String>>> step1 = ignored -> {
            prepareProcessing("Execute " + workerData.getWorkerName());

            final Path dicPath = dicParser.getDicFile()
                .toPath();
src/main/java/io/github/mtrevisan/hunlinter/workers/StatisticsWorker.java on lines 115..126
src/main/java/io/github/mtrevisan/hunlinter/workers/dictionary/CompoundRulesWorker.java on lines 78..89
src/main/java/io/github/mtrevisan/hunlinter/workers/dictionary/DictionaryReducerWorker.java on lines 76..87
src/main/java/io/github/mtrevisan/hunlinter/workers/dictionary/WordCountWorker.java on lines 97..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 70.

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

        final Function<Void, List<IndexDataPair<String>>> step1 = ignored -> {
            prepareProcessing("Execute " + workerData.getWorkerName());

            final Path dicPath = dicParser.getDicFile()
                .toPath();
src/main/java/io/github/mtrevisan/hunlinter/workers/StatisticsWorker.java on lines 115..126
src/main/java/io/github/mtrevisan/hunlinter/workers/dictionary/CompoundRulesWorker.java on lines 78..89
src/main/java/io/github/mtrevisan/hunlinter/workers/dictionary/WordCountWorker.java on lines 97..108
src/main/java/io/github/mtrevisan/hunlinter/workers/hyphenation/HyphenationLinterWorker.java on lines 110..121

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

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

        final Function<Void, Void> step1 = ignored -> {
            prepareProcessing("Execute " + workerData.getWorkerName());

            final Path dicPath = dicParser.getDicFile()
                .toPath();
src/main/java/io/github/mtrevisan/hunlinter/workers/dictionary/CompoundRulesWorker.java on lines 78..89
src/main/java/io/github/mtrevisan/hunlinter/workers/dictionary/DictionaryReducerWorker.java on lines 76..87
src/main/java/io/github/mtrevisan/hunlinter/workers/dictionary/WordCountWorker.java on lines 97..108
src/main/java/io/github/mtrevisan/hunlinter/workers/hyphenation/HyphenationLinterWorker.java on lines 110..121

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

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 arc = fsa.getFirstArc(node); arc != 0; arc = fsa.getNextArc(arc))
            if(!fsa.isArcTerminal(arc)){
                final int target = fsa.getEndNode(arc);
                if(!visited.contains(target))
                    nodes.push(target);
src/main/java/io/github/mtrevisan/hunlinter/datastructures/fsa/serializers/FSASerializer.java on lines 232..237

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

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 arc = fsa.getFirstArc(node); arc != 0; arc = fsa.getNextArc(arc))
                if(!fsa.isArcTerminal(arc)){
                    final int target = fsa.getEndNode(arc);
                    if(!visited.get(target))
                        nodes.push(target);
src/main/java/io/github/mtrevisan/hunlinter/datastructures/fsa/serializers/CFSASerializer.java on lines 298..303

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

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

        final Function<Void, List<IndexDataPair<String>>> step1 = ignored -> {
            prepareProcessing("Execute " + workerData.getWorkerName());

            final Path dicPath = dicParser.getDicFile()
                .toPath();
src/main/java/io/github/mtrevisan/hunlinter/workers/StatisticsWorker.java on lines 115..126
src/main/java/io/github/mtrevisan/hunlinter/workers/dictionary/DictionaryReducerWorker.java on lines 76..87
src/main/java/io/github/mtrevisan/hunlinter/workers/dictionary/WordCountWorker.java on lines 97..108
src/main/java/io/github/mtrevisan/hunlinter/workers/hyphenation/HyphenationLinterWorker.java on lines 110..121

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

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

    @Override
    public final boolean equals(final Object obj){
        if(this == obj)
            return true;
        if(obj == null || getClass() != obj.getClass())
src/main/java/io/github/mtrevisan/hunlinter/parsers/autocorrect/CorrectionEntry.java on lines 63..73
src/main/java/io/github/mtrevisan/hunlinter/parsers/hyphenation/Hyphenation.java on lines 117..127
src/main/java/io/github/mtrevisan/hunlinter/parsers/thesaurus/ThesaurusEntry.java on lines 182..192

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

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

    public WordExceptionsLayeredPane(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/panes/SentenceExceptionsLayeredPane.java on lines 75..90

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

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 Consumer<ThesaurusEntry> createInnerProcessor(final Consumer<ThesaurusEntry> dataProcessor, final int totalEntries){
        final AtomicInteger processingIndex = new AtomicInteger(0);
        return data -> {
            try{
                dataProcessor.accept(data);
src/main/java/io/github/mtrevisan/hunlinter/workers/core/WorkerAutoCorrect.java on lines 89..107

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

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

    public SentenceExceptionsLayeredPane(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/panes/WordExceptionsLayeredPane.java on lines 75..90

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

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 Consumer<CorrectionEntry> createInnerProcessor(final Consumer<CorrectionEntry> dataProcessor, final int totalEntries){
        final AtomicInteger processingIndex = new AtomicInteger(0);
        return data -> {
            try{
                dataProcessor.accept(data);
src/main/java/io/github/mtrevisan/hunlinter/workers/core/WorkerThesaurus.java on lines 75..93

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

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

    static{
        final EnumSet<PartOfSpeechTag> tags = EnumSet.allOf(PartOfSpeechTag.class);
        final Map<String, PartOfSpeechTag> map = new HashMap<>(tags.size());
        for(final PartOfSpeechTag tag : tags)
            map.put(MorphologicalTag.PART_OF_SPEECH.getCode() + tag.code, tag);
src/main/java/io/github/mtrevisan/hunlinter/parsers/enums/InflectionTag.java on lines 237..243

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

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

Severity
Category
Status
Source
Language