prowide/prowide-core

View on GitHub
src/main/java/com/prowidesoftware/swift/io/parser/SwiftParser.java

Summary

Maintainability
F
1 wk
Test Coverage

File SwiftParser.java has 647 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * Copyright 2006-2023 Prowide
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
Severity: Major
Found in src/main/java/com/prowidesoftware/swift/io/parser/SwiftParser.java - About 1 day to fix

    Method readUntilBlockEnds has a Cognitive Complexity of 44 (exceeds 8 allowed). Consider refactoring.
    Open

        protected String readUntilBlockEnds() throws IOException {
            final int start = buffer == null ? 0 : buffer.length();
            int len = 0;
            int c;
    
    
    Severity: Minor
    Found in src/main/java/com/prowidesoftware/swift/io/parser/SwiftParser.java - About 6 hrs 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 consumeBlock4 has a Cognitive Complexity of 42 (exceeds 8 allowed). Consider refactoring.
    Open

        protected SwiftBlock4 consumeBlock4(final SwiftBlock4 b, final String s) {
            /*
             * Note that if the block4 is a text block last character is -, which is part of the EOB
             * since the parser removes the last }
             */
    Severity: Minor
    Found in src/main/java/com/prowidesoftware/swift/io/parser/SwiftParser.java - About 5 hrs 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

    SwiftParser has 38 methods (exceeds 20 allowed). Consider refactoring.
    Open

    public class SwiftParser {
    
        private static final transient java.util.logging.Logger log =
                java.util.logging.Logger.getLogger(SwiftParser.class.getName());
        /**
    Severity: Minor
    Found in src/main/java/com/prowidesoftware/swift/io/parser/SwiftParser.java - About 5 hrs to fix

      Method findEndOfTagByLineFeed has a Cognitive Complexity of 28 (exceeds 8 allowed). Consider refactoring.
      Open

          protected int findEndOfTagByLineFeed(final String s, int start, final boolean isTextBlock) {
      
              int i = start;
      
              // start scanning for tag end
      Severity: Minor
      Found in src/main/java/com/prowidesoftware/swift/io/parser/SwiftParser.java - About 3 hrs 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 consumeBlock has a Cognitive Complexity of 24 (exceeds 8 allowed). Consider refactoring.
      Open

          protected SwiftBlock consumeBlock(final UnparsedTextList unparsedReceiver) throws IOException {
      
              // search for block start
              final String unparsed = findBlockStart();
      
      
      Severity: Minor
      Found in src/main/java/com/prowidesoftware/swift/io/parser/SwiftParser.java - About 2 hrs 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 consumeBlock4 has 70 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected SwiftBlock4 consumeBlock4(final SwiftBlock4 b, final String s) {
              /*
               * Note that if the block4 is a text block last character is -, which is part of the EOB
               * since the parser removes the last }
               */
      Severity: Major
      Found in src/main/java/com/prowidesoftware/swift/io/parser/SwiftParser.java - About 2 hrs to fix

        Method consumeTagListBlock has a Cognitive Complexity of 22 (exceeds 8 allowed). Consider refactoring.
        Open

            protected SwiftTagListBlock consumeTagListBlock(final SwiftTagListBlock b, final String s) {
                // start processing the block data
                final int start = s.indexOf(':');
                if (start >= 0 && start + 1 < s.length()) {
                    final String data = s.substring(start + 1);
        Severity: Minor
        Found in src/main/java/com/prowidesoftware/swift/io/parser/SwiftParser.java - About 2 hrs 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 consumeBlock has 53 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected SwiftBlock consumeBlock(final UnparsedTextList unparsedReceiver) throws IOException {
        
                // search for block start
                final String unparsed = findBlockStart();
        
        
        Severity: Major
        Found in src/main/java/com/prowidesoftware/swift/io/parser/SwiftParser.java - About 2 hrs to fix

          Method readUntilBlockEnds has 53 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected String readUntilBlockEnds() throws IOException {
                  final int start = buffer == null ? 0 : buffer.length();
                  int len = 0;
                  int c;
          
          
          Severity: Major
          Found in src/main/java/com/prowidesoftware/swift/io/parser/SwiftParser.java - About 2 hrs to fix

            Method createBlock has 38 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private SwiftBlock createBlock(final char blockId, final String s) {
                    SwiftBlock b;
            
                    // create the block object
                    switch (blockId) {
            Severity: Minor
            Found in src/main/java/com/prowidesoftware/swift/io/parser/SwiftParser.java - About 1 hr to fix

              Method findEndOfTagByLineFeed has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected int findEndOfTagByLineFeed(final String s, int start, final boolean isTextBlock) {
              
                      int i = start;
              
                      // start scanning for tag end
              Severity: Minor
              Found in src/main/java/com/prowidesoftware/swift/io/parser/SwiftParser.java - About 1 hr to fix

                Method createBlock has a Cognitive Complexity of 14 (exceeds 8 allowed). Consider refactoring.
                Open

                    private SwiftBlock createBlock(final char blockId, final String s) {
                        SwiftBlock b;
                
                        // create the block object
                        switch (blockId) {
                Severity: Minor
                Found in src/main/java/com/prowidesoftware/swift/io/parser/SwiftParser.java - About 1 hr 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 processUnparsedText has a Cognitive Complexity of 13 (exceeds 8 allowed). Consider refactoring.
                Open

                    private UnparsedTextList processUnparsedText(final String unparsedText) {
                        // prepare to process
                        UnparsedTextList list = null;
                
                        // we start a new unparsed text at every "{1:"
                Severity: Minor
                Found in src/main/java/com/prowidesoftware/swift/io/parser/SwiftParser.java - About 1 hr 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 isTextBlock has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private boolean isTextBlock(final String s) {
                        // hack to report as block4 only text blocks 4 , check data in buffer
                        if (s.length() < 3) {
                            return false;
                        }
                Severity: Minor
                Found in src/main/java/com/prowidesoftware/swift/io/parser/SwiftParser.java - About 1 hr to fix

                  Method consumeTagListBlock has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected SwiftTagListBlock consumeTagListBlock(final SwiftTagListBlock b, final String s) {
                          // start processing the block data
                          final int start = s.indexOf(':');
                          if (start >= 0 && start + 1 < s.length()) {
                              final String data = s.substring(start + 1);
                  Severity: Minor
                  Found in src/main/java/com/prowidesoftware/swift/io/parser/SwiftParser.java - About 1 hr to fix

                    Method isTextBlock has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring.
                    Open

                        private boolean isTextBlock(final String s) {
                            // hack to report as block4 only text blocks 4 , check data in buffer
                            if (s.length() < 3) {
                                return false;
                            }
                    Severity: Minor
                    Found in src/main/java/com/prowidesoftware/swift/io/parser/SwiftParser.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 identifyBlock has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring.
                    Open

                        protected char identifyBlock(final String s) {
                            if (s != null && s.length() > 1) {
                                final char c = s.charAt(0);
                                if ('0' <= c && c <= '9') {
                                    return c;
                    Severity: Minor
                    Found in src/main/java/com/prowidesoftware/swift/io/parser/SwiftParser.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 createBlock2 has a Cognitive Complexity of 10 (exceeds 8 allowed). Consider refactoring.
                    Open

                        private SwiftBlock2 createBlock2(final String s) {
                            Character block2Type = extractBlock2Type(s);
                            if (Character.valueOf('I').equals(block2Type)) {
                                return enrichBlockType(createBlock2Input(s), "I");
                            } else if (Character.valueOf('O').equals(block2Type)) {
                    Severity: Minor
                    Found in src/main/java/com/prowidesoftware/swift/io/parser/SwiftParser.java - About 35 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

                    Avoid too many return statements within this method.
                    Open

                            return new SwiftBlock2Output();
                    Severity: Major
                    Found in src/main/java/com/prowidesoftware/swift/io/parser/SwiftParser.java - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                              return false;
                      Severity: Major
                      Found in src/main/java/com/prowidesoftware/swift/io/parser/SwiftParser.java - About 30 mins to fix

                        Refactor this method to reduce its Cognitive Complexity from 24 to the 15 allowed.
                        Open

                            protected SwiftBlock consumeBlock(final UnparsedTextList unparsedReceiver) throws IOException {

                        Cognitive Complexity is a measure of how hard the control flow of a method is to understand. Methods with high Cognitive Complexity will be difficult to maintain.

                        See

                        Refactor this method to reduce its Cognitive Complexity from 22 to the 15 allowed.
                        Open

                            protected SwiftTagListBlock consumeTagListBlock(final SwiftTagListBlock b, final String s) {

                        Cognitive Complexity is a measure of how hard the control flow of a method is to understand. Methods with high Cognitive Complexity will be difficult to maintain.

                        See

                        Refactor this method to reduce its Cognitive Complexity from 42 to the 15 allowed.
                        Open

                            protected SwiftBlock4 consumeBlock4(final SwiftBlock4 b, final String s) {

                        Cognitive Complexity is a measure of how hard the control flow of a method is to understand. Methods with high Cognitive Complexity will be difficult to maintain.

                        See

                        Refactor this method to reduce its Cognitive Complexity from 28 to the 15 allowed.
                        Open

                            protected int findEndOfTagByLineFeed(final String s, int start, final boolean isTextBlock) {

                        Cognitive Complexity is a measure of how hard the control flow of a method is to understand. Methods with high Cognitive Complexity will be difficult to maintain.

                        See

                        Refactor this method to reduce its Cognitive Complexity from 44 to the 15 allowed.
                        Open

                            protected String readUntilBlockEnds() throws IOException {

                        Cognitive Complexity is a measure of how hard the control flow of a method is to understand. Methods with high Cognitive Complexity will be difficult to maintain.

                        See

                        Add a default case to this switch.
                        Open

                                    switch (c) {

                        The requirement for a final default clause is defensive programming. The clause should either take appropriate action, or contain a suitable comment as to why no action is taken.

                        Noncompliant Code Example

                        switch (param) {  //missing default clause
                          case 0:
                            doSomething();
                            break;
                          case 1:
                            doSomethingElse();
                            break;
                        }
                        
                        switch (param) {
                          default: // default clause should be the last one
                            error();
                            break;
                          case 0:
                            doSomething();
                            break;
                          case 1:
                            doSomethingElse();
                            break;
                        }
                        

                        Compliant Solution

                        switch (param) {
                          case 0:
                            doSomething();
                            break;
                          case 1:
                            doSomethingElse();
                            break;
                          default:
                            error();
                            break;
                        }
                        

                        Exceptions

                        If the switch parameter is an Enum and if all the constants of this enum are used in the case statements, then no default clause is expected.

                        Example:

                        public enum Day {
                            SUNDAY, MONDAY
                        }
                        ...
                        switch(day) {
                          case SUNDAY:
                            doSomething();
                            break;
                          case MONDAY:
                            doSomethingElse();
                            break;
                        }
                        

                        See

                        End this switch case with an unconditional break, return or throw statement.
                        Open

                                        case '}':

                        When the execution is not explicitly terminated at the end of a switch case, it continues to execute the statements of the following case. While this is sometimes intentional, it often is a mistake which leads to unexpected behavior.

                        Noncompliant Code Example

                        switch (myVariable) {
                          case 1:
                            foo();
                            break;
                          case 2:  // Both 'doSomething()' and 'doSomethingElse()' will be executed. Is it on purpose ?
                            doSomething();
                          default:
                            doSomethingElse();
                            break;
                        }
                        

                        Compliant Solution

                        switch (myVariable) {
                          case 1:
                            foo();
                            break;
                          case 2:
                            doSomething();
                            break;
                          default:
                            doSomethingElse();
                            break;
                        }
                        

                        Exceptions

                        This rule is relaxed in the following cases:

                        switch (myVariable) {
                          case 0:                                // Empty case used to specify the same behavior for a group of cases.
                          case 1:
                            doSomething();
                            break;
                          case 2:                                // Use of return statement
                            return;
                          case 3:                                // Use of throw statement
                            throw new IllegalStateException();
                          case 4:                                // Use of continue statement
                            continue;
                          default:                               // For the last case, use of break statement is optional
                            doSomethingElse();
                        }
                        

                        See

                        • MITRE, CWE-484 - Omitted Break Statement in Switch
                        • CERT, MSC17-C. - Finish every set of statements associated with a case label with a break statement
                        • CERT, MSC52-J. - Finish every set of statements associated with a case label with a break statement

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

                            private SwiftBlock2Input createBlock2Input(final String s) {
                                try {
                                    return new SwiftBlock2Input(s, false);
                                } catch (IllegalArgumentException e) {
                                    if (this.configuration.isLenient()) {
                        src/main/java/com/prowidesoftware/swift/io/parser/SwiftParser.java on lines 457..469
                        src/main/java/com/prowidesoftware/swift/io/parser/SwiftParser.java on lines 514..526

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

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

                            private SwiftBlock1 createBlock1(final String s) {
                                try {
                                    return new SwiftBlock1(s, false);
                                } catch (IllegalArgumentException e) {
                                    if (this.configuration.isLenient()) {
                        src/main/java/com/prowidesoftware/swift/io/parser/SwiftParser.java on lines 497..509
                        src/main/java/com/prowidesoftware/swift/io/parser/SwiftParser.java on lines 514..526

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

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

                            private SwiftBlock2Output createBlock2Output(final String s) {
                                try {
                                    return new SwiftBlock2Output(s, false);
                                } catch (IllegalArgumentException e) {
                                    if (this.configuration.isLenient()) {
                        src/main/java/com/prowidesoftware/swift/io/parser/SwiftParser.java on lines 457..469
                        src/main/java/com/prowidesoftware/swift/io/parser/SwiftParser.java on lines 497..509

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

                        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 (unparsed.length() > 0) {
                                    if (unparsedReceiver == null) {
                                        log.warning("Unparsed text '" + unparsed + "' can not be reported since unparsedReceiver is null");
                                    } else {
                                        unparsedReceiver.addText(unparsed);
                        src/main/java/com/prowidesoftware/swift/io/parser/SwiftParser.java on lines 331..337

                        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 (unparsed.length() > 0) {
                                        if (unparsedReceiver == null) {
                                            log.warning("Unparsed text '" + unparsed + "' can not be reported since unparsedReceiver is null");
                                        } else {
                                            unparsedReceiver.addText(unparsed);
                        src/main/java/com/prowidesoftware/swift/io/parser/SwiftParser.java on lines 394..400

                        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

                        There are no issues that match your filters.

                        Category
                        Status