LoboEvolution/LoboEvolution

View on GitHub
LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java

Summary

Maintainability
F
1 wk
Test Coverage

File DOMNodeTest.java has 1116 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * MIT License
 *
 * Copyright (c) 2014 - 2024 LoboEvolution
 *
Severity: Major
Found in LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java - About 2 days to fix

    Method testAppendChild has 186 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        @Test
        public void testAppendChild() throws DOMException {
            document = sampleHtmlFile();
            final Element html = document.getDocumentElement();
            final Element elm = document.createElement("body");
    Severity: Major
    Found in LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java - About 7 hrs to fix

      Method removeChild2 has 140 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          @Test
          public void removeChild2() throws DOMException {
              document = sampleHtmlFile();
              final Element html = document.getDocumentElement();
              final Element body = document.createElement("body");
      Severity: Major
      Found in LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java - About 5 hrs to fix

        Method prependChild has 120 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            @Test
            public void prependChild() throws DOMException {
                document = sampleHtmlFile();
                final Element html = document.getDocumentElement();
                final Element elm = document.createElement("body");
        Severity: Major
        Found in LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java - About 4 hrs to fix

          Method prependChild has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
          Open

              @Test
              public void prependChild() throws DOMException {
                  document = sampleHtmlFile();
                  final Element html = document.getDocumentElement();
                  final Element elm = document.createElement("body");
          Severity: Minor
          Found in LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.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 insertBefore2 has 93 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              @Test
              public void insertBefore2() throws DOMException {
                  document = sampleHtmlFile();
                  final Element html = document.getDocumentElement();
                  final Element body = document.createElement("body");
          Severity: Major
          Found in LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java - About 3 hrs to fix

            Method normalize2 has 83 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                @Test
                public void normalize2() {
                    document = sampleHtmlFile();
                    assertEquals(2, document.getChildNodes().getLength());
                    final Element elm = document.createElement("body");
            Severity: Major
            Found in LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java - About 3 hrs to fix

              Method testAppendChild has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
              Open

                  @Test
                  public void testAppendChild() throws DOMException {
                      document = sampleHtmlFile();
                      final Element html = document.getDocumentElement();
                      final Element elm = document.createElement("body");
              Severity: Minor
              Found in LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.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

              DOMNodeTest has 24 methods (exceeds 20 allowed). Consider refactoring.
              Open

              public class DOMNodeTest extends LoboUnitTest {
              
                  private static Document document;
                  private static DOMImplementationImpl impl;
              
              
              Severity: Minor
              Found in LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java - About 2 hrs to fix

                Method replaceChild2 has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    @Test
                    public void replaceChild2() throws DOMException {
                        document = sampleHtmlFile();
                        final Element html = document.getDocumentElement();
                        final Element body = document.createElement("body");
                Severity: Major
                Found in LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java - About 2 hrs to fix

                  Method removeChild has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      @Test
                      public void removeChild() throws DOMException {
                          document = sampleHtmlFile();
                          final Element html = document.getDocumentElement();
                          Element elm = document.createElement("body");
                  Severity: Minor
                  Found in LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java - About 1 hr to fix

                    Method getNodeValue has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        @Test
                        public void getNodeValue() {
                            document = sampleHtmlFile();
                            final Element elm = document.createElement("p");
                            assertEquals("P", elm.getNodeName());
                    Severity: Minor
                    Found in LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java - About 1 hr to fix

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

                          @Test
                          public void compareDocumentPosition1() {
                              document = sampleHtmlFile();
                              final Node html = document.getDocumentElement();
                              final Element div1 = document.createElement("div");
                      Severity: Minor
                      Found in LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java - About 1 hr to fix

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

                            public void testAppendChild() throws DOMException {

                        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

                        Define a constant instead of duplicating this literal "\t " 4 times.
                        Open

                                html.appendChild(document.createTextNode("\t     "));

                        Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                        On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                        Noncompliant Code Example

                        With the default threshold of 3:

                        public void run() {
                          prepare("action1");                              // Noncompliant - "action1" is duplicated 3 times
                          execute("action1");
                          release("action1");
                        }
                        
                        @SuppressWarning("all")                            // Compliant - annotations are excluded
                        private void method1() { /* ... */ }
                        @SuppressWarning("all")
                        private void method2() { /* ... */ }
                        
                        public String method3(String a) {
                          System.out.println("'" + a + "'");               // Compliant - literal "'" has less than 5 characters and is excluded
                          return "";                                       // Compliant - literal "" has less than 5 characters and is excluded
                        }
                        

                        Compliant Solution

                        private static final String ACTION_1 = "action1";  // Compliant
                        
                        public void run() {
                          prepare(ACTION_1);                               // Compliant
                          execute(ACTION_1);
                          release(ACTION_1);
                        }
                        

                        Exceptions

                        To prevent generating some false-positives, literals having less than 5 characters are excluded.

                        Make the enclosing method "static" or remove this set.
                        Open

                                document = sampleHtmlFile();

                        Correctly updating a static field from a non-static method is tricky to get right and could easily lead to bugs if there are multiple class instances and/or multiple threads in play. Ideally, static fields are only updated from synchronized static methods.

                        This rule raises an issue each time a static field is updated from a non-static method.

                        Noncompliant Code Example

                        public class MyClass {
                        
                          private static int count = 0;
                        
                          public void doSomething() {
                            //...
                            count++;  // Noncompliant
                          }
                        }
                        

                        Make the enclosing method "static" or remove this set.
                        Open

                                document = sampleHtmlFile();

                        Correctly updating a static field from a non-static method is tricky to get right and could easily lead to bugs if there are multiple class instances and/or multiple threads in play. Ideally, static fields are only updated from synchronized static methods.

                        This rule raises an issue each time a static field is updated from a non-static method.

                        Noncompliant Code Example

                        public class MyClass {
                        
                          private static int count = 0;
                        
                          public void doSomething() {
                            //...
                            count++;  // Noncompliant
                          }
                        }
                        

                        Define a constant instead of duplicating this literal "use-computed-styles" 5 times.
                        Open

                                assertTrue(config.canSetParameter("use-computed-styles", false));

                        Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                        On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                        Noncompliant Code Example

                        With the default threshold of 3:

                        public void run() {
                          prepare("action1");                              // Noncompliant - "action1" is duplicated 3 times
                          execute("action1");
                          release("action1");
                        }
                        
                        @SuppressWarning("all")                            // Compliant - annotations are excluded
                        private void method1() { /* ... */ }
                        @SuppressWarning("all")
                        private void method2() { /* ... */ }
                        
                        public String method3(String a) {
                          System.out.println("'" + a + "'");               // Compliant - literal "'" has less than 5 characters and is excluded
                          return "";                                       // Compliant - literal "" has less than 5 characters and is excluded
                        }
                        

                        Compliant Solution

                        private static final String ACTION_1 = "action1";  // Compliant
                        
                        public void run() {
                          prepare(ACTION_1);                               // Compliant
                          execute(ACTION_1);
                          release(ACTION_1);
                        }
                        

                        Exceptions

                        To prevent generating some false-positives, literals having less than 5 characters are excluded.

                        Make the enclosing method "static" or remove this set.
                        Open

                                document = sampleHtmlFile();

                        Correctly updating a static field from a non-static method is tricky to get right and could easily lead to bugs if there are multiple class instances and/or multiple threads in play. Ideally, static fields are only updated from synchronized static methods.

                        This rule raises an issue each time a static field is updated from a non-static method.

                        Noncompliant Code Example

                        public class MyClass {
                        
                          private static int count = 0;
                        
                          public void doSomething() {
                            //...
                            count++;  // Noncompliant
                          }
                        }
                        

                        Define a constant instead of duplicating this literal "comments" 4 times.
                        Open

                                assertTrue(config.canSetParameter("comments", false));

                        Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                        On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                        Noncompliant Code Example

                        With the default threshold of 3:

                        public void run() {
                          prepare("action1");                              // Noncompliant - "action1" is duplicated 3 times
                          execute("action1");
                          release("action1");
                        }
                        
                        @SuppressWarning("all")                            // Compliant - annotations are excluded
                        private void method1() { /* ... */ }
                        @SuppressWarning("all")
                        private void method2() { /* ... */ }
                        
                        public String method3(String a) {
                          System.out.println("'" + a + "'");               // Compliant - literal "'" has less than 5 characters and is excluded
                          return "";                                       // Compliant - literal "" has less than 5 characters and is excluded
                        }
                        

                        Compliant Solution

                        private static final String ACTION_1 = "action1";  // Compliant
                        
                        public void run() {
                          prepare(ACTION_1);                               // Compliant
                          execute(ACTION_1);
                          release(ACTION_1);
                        }
                        

                        Exceptions

                        To prevent generating some false-positives, literals having less than 5 characters are excluded.

                        Remove this useless assignment to local variable "last".
                        Open

                                final Node last = fragment.getLastChild();

                        A dead store happens when a local variable is assigned a value that is not read by any subsequent instruction. Calculating or retrieving a value only to then overwrite it or throw it away, could indicate a serious error in the code. Even if it's not an error, it is at best a waste of resources. Therefore all calculated values should be used.

                        Noncompliant Code Example

                        i = a + b; // Noncompliant; calculation result not used before value is overwritten
                        i = compute();
                        

                        Compliant Solution

                        i = a + b;
                        i += compute();
                        

                        Exceptions

                        This rule ignores initializations to -1, 0, 1, null, true, false and "".

                        See

                        Make the enclosing method "static" or remove this set.
                        Open

                                document = sampleHtmlFile();

                        Correctly updating a static field from a non-static method is tricky to get right and could easily lead to bugs if there are multiple class instances and/or multiple threads in play. Ideally, static fields are only updated from synchronized static methods.

                        This rule raises an issue each time a static field is updated from a non-static method.

                        Noncompliant Code Example

                        public class MyClass {
                        
                          private static int count = 0;
                        
                          public void doSomething() {
                            //...
                            count++;  // Noncompliant
                          }
                        }
                        

                        Make the enclosing method "static" or remove this set.
                        Open

                                document = sampleHtmlFile();

                        Correctly updating a static field from a non-static method is tricky to get right and could easily lead to bugs if there are multiple class instances and/or multiple threads in play. Ideally, static fields are only updated from synchronized static methods.

                        This rule raises an issue each time a static field is updated from a non-static method.

                        Noncompliant Code Example

                        public class MyClass {
                        
                          private static int count = 0;
                        
                          public void doSomething() {
                            //...
                            count++;  // Noncompliant
                          }
                        }
                        

                        Make the enclosing method "static" or remove this set.
                        Open

                                document = sampleHtmlFile();

                        Correctly updating a static field from a non-static method is tricky to get right and could easily lead to bugs if there are multiple class instances and/or multiple threads in play. Ideally, static fields are only updated from synchronized static methods.

                        This rule raises an issue each time a static field is updated from a non-static method.

                        Noncompliant Code Example

                        public class MyClass {
                        
                          private static int count = 0;
                        
                          public void doSomething() {
                            //...
                            count++;  // Noncompliant
                          }
                        }
                        

                        Make the enclosing method "static" or remove this set.
                        Open

                                document = sampleHtmlFile();

                        Correctly updating a static field from a non-static method is tricky to get right and could easily lead to bugs if there are multiple class instances and/or multiple threads in play. Ideally, static fields are only updated from synchronized static methods.

                        This rule raises an issue each time a static field is updated from a non-static method.

                        Noncompliant Code Example

                        public class MyClass {
                        
                          private static int count = 0;
                        
                          public void doSomething() {
                            //...
                            count++;  // Noncompliant
                          }
                        }
                        

                        Make the enclosing method "static" or remove this set.
                        Open

                                document = sampleHtmlFile();

                        Correctly updating a static field from a non-static method is tricky to get right and could easily lead to bugs if there are multiple class instances and/or multiple threads in play. Ideally, static fields are only updated from synchronized static methods.

                        This rule raises an issue each time a static field is updated from a non-static method.

                        Noncompliant Code Example

                        public class MyClass {
                        
                          private static int count = 0;
                        
                          public void doSomething() {
                            //...
                            count++;  // Noncompliant
                          }
                        }
                        

                        Define a constant instead of duplicating this literal "inside p" 3 times.
                        Open

                                p.appendChild(document.createTextNode("inside p"));

                        Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                        On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                        Noncompliant Code Example

                        With the default threshold of 3:

                        public void run() {
                          prepare("action1");                              // Noncompliant - "action1" is duplicated 3 times
                          execute("action1");
                          release("action1");
                        }
                        
                        @SuppressWarning("all")                            // Compliant - annotations are excluded
                        private void method1() { /* ... */ }
                        @SuppressWarning("all")
                        private void method2() { /* ... */ }
                        
                        public String method3(String a) {
                          System.out.println("'" + a + "'");               // Compliant - literal "'" has less than 5 characters and is excluded
                          return "";                                       // Compliant - literal "" has less than 5 characters and is excluded
                        }
                        

                        Compliant Solution

                        private static final String ACTION_1 = "action1";  // Compliant
                        
                        public void run() {
                          prepare(ACTION_1);                               // Compliant
                          execute(ACTION_1);
                          release(ACTION_1);
                        }
                        

                        Exceptions

                        To prevent generating some false-positives, literals having less than 5 characters are excluded.

                        Define a constant instead of duplicating this literal "normalize-characters" 6 times.
                        Open

                                assertTrue(config.canSetParameter("normalize-characters", false));

                        Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                        On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                        Noncompliant Code Example

                        With the default threshold of 3:

                        public void run() {
                          prepare("action1");                              // Noncompliant - "action1" is duplicated 3 times
                          execute("action1");
                          release("action1");
                        }
                        
                        @SuppressWarning("all")                            // Compliant - annotations are excluded
                        private void method1() { /* ... */ }
                        @SuppressWarning("all")
                        private void method2() { /* ... */ }
                        
                        public String method3(String a) {
                          System.out.println("'" + a + "'");               // Compliant - literal "'" has less than 5 characters and is excluded
                          return "";                                       // Compliant - literal "" has less than 5 characters and is excluded
                        }
                        

                        Compliant Solution

                        private static final String ACTION_1 = "action1";  // Compliant
                        
                        public void run() {
                          prepare(ACTION_1);                               // Compliant
                          execute(ACTION_1);
                          release(ACTION_1);
                        }
                        

                        Exceptions

                        To prevent generating some false-positives, literals having less than 5 characters are excluded.

                        Define a constant instead of duplicating this literal " " 3 times.
                        Open

                                elm.appendChild(document.createTextNode("     "));

                        Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                        On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                        Noncompliant Code Example

                        With the default threshold of 3:

                        public void run() {
                          prepare("action1");                              // Noncompliant - "action1" is duplicated 3 times
                          execute("action1");
                          release("action1");
                        }
                        
                        @SuppressWarning("all")                            // Compliant - annotations are excluded
                        private void method1() { /* ... */ }
                        @SuppressWarning("all")
                        private void method2() { /* ... */ }
                        
                        public String method3(String a) {
                          System.out.println("'" + a + "'");               // Compliant - literal "'" has less than 5 characters and is excluded
                          return "";                                       // Compliant - literal "" has less than 5 characters and is excluded
                        }
                        

                        Compliant Solution

                        private static final String ACTION_1 = "action1";  // Compliant
                        
                        public void run() {
                          prepare(ACTION_1);                               // Compliant
                          execute(ACTION_1);
                          release(ACTION_1);
                        }
                        

                        Exceptions

                        To prevent generating some false-positives, literals having less than 5 characters are excluded.

                        Define a constant instead of duplicating this literal "Must throw exception." 30 times.
                        Open

                                    fail("Must throw exception.");

                        Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                        On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                        Noncompliant Code Example

                        With the default threshold of 3:

                        public void run() {
                          prepare("action1");                              // Noncompliant - "action1" is duplicated 3 times
                          execute("action1");
                          release("action1");
                        }
                        
                        @SuppressWarning("all")                            // Compliant - annotations are excluded
                        private void method1() { /* ... */ }
                        @SuppressWarning("all")
                        private void method2() { /* ... */ }
                        
                        public String method3(String a) {
                          System.out.println("'" + a + "'");               // Compliant - literal "'" has less than 5 characters and is excluded
                          return "";                                       // Compliant - literal "" has less than 5 characters and is excluded
                        }
                        

                        Compliant Solution

                        private static final String ACTION_1 = "action1";  // Compliant
                        
                        public void run() {
                          prepare(ACTION_1);                               // Compliant
                          execute(ACTION_1);
                          release(ACTION_1);
                        }
                        

                        Exceptions

                        To prevent generating some false-positives, literals having less than 5 characters are excluded.

                        Make the enclosing method "static" or remove this set.
                        Open

                                document = sampleHtmlFile();

                        Correctly updating a static field from a non-static method is tricky to get right and could easily lead to bugs if there are multiple class instances and/or multiple threads in play. Ideally, static fields are only updated from synchronized static methods.

                        This rule raises an issue each time a static field is updated from a non-static method.

                        Noncompliant Code Example

                        public class MyClass {
                        
                          private static int count = 0;
                        
                          public void doSomething() {
                            //...
                            count++;  // Noncompliant
                          }
                        }
                        

                        Make the enclosing method "static" or remove this set.
                        Open

                                document = sampleHtmlFile();

                        Correctly updating a static field from a non-static method is tricky to get right and could easily lead to bugs if there are multiple class instances and/or multiple threads in play. Ideally, static fields are only updated from synchronized static methods.

                        This rule raises an issue each time a static field is updated from a non-static method.

                        Noncompliant Code Example

                        public class MyClass {
                        
                          private static int count = 0;
                        
                          public void doSomething() {
                            //...
                            count++;  // Noncompliant
                          }
                        }
                        

                        Define a constant instead of duplicating this literal "inside div" 3 times.
                        Open

                                div.appendChild(document.createTextNode("inside div"));

                        Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                        On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                        Noncompliant Code Example

                        With the default threshold of 3:

                        public void run() {
                          prepare("action1");                              // Noncompliant - "action1" is duplicated 3 times
                          execute("action1");
                          release("action1");
                        }
                        
                        @SuppressWarning("all")                            // Compliant - annotations are excluded
                        private void method1() { /* ... */ }
                        @SuppressWarning("all")
                        private void method2() { /* ... */ }
                        
                        public String method3(String a) {
                          System.out.println("'" + a + "'");               // Compliant - literal "'" has less than 5 characters and is excluded
                          return "";                                       // Compliant - literal "" has less than 5 characters and is excluded
                        }
                        

                        Compliant Solution

                        private static final String ACTION_1 = "action1";  // Compliant
                        
                        public void run() {
                          prepare(ACTION_1);                               // Compliant
                          execute(ACTION_1);
                          release(ACTION_1);
                        }
                        

                        Exceptions

                        To prevent generating some false-positives, literals having less than 5 characters are excluded.

                        Make the enclosing method "static" or remove this set.
                        Open

                                document = sampleHtmlFile();

                        Correctly updating a static field from a non-static method is tricky to get right and could easily lead to bugs if there are multiple class instances and/or multiple threads in play. Ideally, static fields are only updated from synchronized static methods.

                        This rule raises an issue each time a static field is updated from a non-static method.

                        Noncompliant Code Example

                        public class MyClass {
                        
                          private static int count = 0;
                        
                          public void doSomething() {
                            //...
                            count++;  // Noncompliant
                          }
                        }
                        

                        Make the enclosing method "static" or remove this set.
                        Open

                                document = sampleHtmlFile();

                        Correctly updating a static field from a non-static method is tricky to get right and could easily lead to bugs if there are multiple class instances and/or multiple threads in play. Ideally, static fields are only updated from synchronized static methods.

                        This rule raises an issue each time a static field is updated from a non-static method.

                        Noncompliant Code Example

                        public class MyClass {
                        
                          private static int count = 0;
                        
                          public void doSomething() {
                            //...
                            count++;  // Noncompliant
                          }
                        }
                        

                        Define a constant instead of duplicating this literal "css-whitespace-processing" 4 times.
                        Open

                                assertTrue(config.canSetParameter("css-whitespace-processing", false));

                        Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                        On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                        Noncompliant Code Example

                        With the default threshold of 3:

                        public void run() {
                          prepare("action1");                              // Noncompliant - "action1" is duplicated 3 times
                          execute("action1");
                          release("action1");
                        }
                        
                        @SuppressWarning("all")                            // Compliant - annotations are excluded
                        private void method1() { /* ... */ }
                        @SuppressWarning("all")
                        private void method2() { /* ... */ }
                        
                        public String method3(String a) {
                          System.out.println("'" + a + "'");               // Compliant - literal "'" has less than 5 characters and is excluded
                          return "";                                       // Compliant - literal "" has less than 5 characters and is excluded
                        }
                        

                        Compliant Solution

                        private static final String ACTION_1 = "action1";  // Compliant
                        
                        public void run() {
                          prepare(ACTION_1);                               // Compliant
                          execute(ACTION_1);
                          release(ACTION_1);
                        }
                        

                        Exceptions

                        To prevent generating some false-positives, literals having less than 5 characters are excluded.

                        Make the enclosing method "static" or remove this set.
                        Open

                                document = sampleHtmlFile();

                        Correctly updating a static field from a non-static method is tricky to get right and could easily lead to bugs if there are multiple class instances and/or multiple threads in play. Ideally, static fields are only updated from synchronized static methods.

                        This rule raises an issue each time a static field is updated from a non-static method.

                        Noncompliant Code Example

                        public class MyClass {
                        
                          private static int count = 0;
                        
                          public void doSomething() {
                            //...
                            count++;  // Noncompliant
                          }
                        }
                        

                        Make the enclosing method "static" or remove this set.
                        Open

                                document = sampleHtmlFile();

                        Correctly updating a static field from a non-static method is tricky to get right and could easily lead to bugs if there are multiple class instances and/or multiple threads in play. Ideally, static fields are only updated from synchronized static methods.

                        This rule raises an issue each time a static field is updated from a non-static method.

                        Noncompliant Code Example

                        public class MyClass {
                        
                          private static int count = 0;
                        
                          public void doSomething() {
                            //...
                            count++;  // Noncompliant
                          }
                        }
                        

                        Make the enclosing method "static" or remove this set.
                        Open

                                document = sampleHtmlFile();

                        Correctly updating a static field from a non-static method is tricky to get right and could easily lead to bugs if there are multiple class instances and/or multiple threads in play. Ideally, static fields are only updated from synchronized static methods.

                        This rule raises an issue each time a static field is updated from a non-static method.

                        Noncompliant Code Example

                        public class MyClass {
                        
                          private static int count = 0;
                        
                          public void doSomething() {
                            //...
                            count++;  // Noncompliant
                          }
                        }
                        

                        Define a constant instead of duplicating this literal " " 8 times.
                        Open

                                html.appendChild(document.createTextNode("\n     "));

                        Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                        On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                        Noncompliant Code Example

                        With the default threshold of 3:

                        public void run() {
                          prepare("action1");                              // Noncompliant - "action1" is duplicated 3 times
                          execute("action1");
                          release("action1");
                        }
                        
                        @SuppressWarning("all")                            // Compliant - annotations are excluded
                        private void method1() { /* ... */ }
                        @SuppressWarning("all")
                        private void method2() { /* ... */ }
                        
                        public String method3(String a) {
                          System.out.println("'" + a + "'");               // Compliant - literal "'" has less than 5 characters and is excluded
                          return "";                                       // Compliant - literal "" has less than 5 characters and is excluded
                        }
                        

                        Compliant Solution

                        private static final String ACTION_1 = "action1";  // Compliant
                        
                        public void run() {
                          prepare(ACTION_1);                               // Compliant
                          execute(ACTION_1);
                          release(ACTION_1);
                        }
                        

                        Exceptions

                        To prevent generating some false-positives, literals having less than 5 characters are excluded.

                        Make the enclosing method "static" or remove this set.
                        Open

                                document = sampleHtmlFile();

                        Correctly updating a static field from a non-static method is tricky to get right and could easily lead to bugs if there are multiple class instances and/or multiple threads in play. Ideally, static fields are only updated from synchronized static methods.

                        This rule raises an issue each time a static field is updated from a non-static method.

                        Noncompliant Code Example

                        public class MyClass {
                        
                          private static int count = 0;
                        
                          public void doSomething() {
                            //...
                            count++;  // Noncompliant
                          }
                        }
                        

                        Make the enclosing method "static" or remove this set.
                        Open

                                document = sampleHtmlFile();

                        Correctly updating a static field from a non-static method is tricky to get right and could easily lead to bugs if there are multiple class instances and/or multiple threads in play. Ideally, static fields are only updated from synchronized static methods.

                        This rule raises an issue each time a static field is updated from a non-static method.

                        Noncompliant Code Example

                        public class MyClass {
                        
                          private static int count = 0;
                        
                          public void doSomething() {
                            //...
                            count++;  // Noncompliant
                          }
                        }
                        

                        Make the enclosing method "static" or remove this set.
                        Open

                                document = sampleHtmlFile();

                        Correctly updating a static field from a non-static method is tricky to get right and could easily lead to bugs if there are multiple class instances and/or multiple threads in play. Ideally, static fields are only updated from synchronized static methods.

                        This rule raises an issue each time a static field is updated from a non-static method.

                        Noncompliant Code Example

                        public class MyClass {
                        
                          private static int count = 0;
                        
                          public void doSomething() {
                            //...
                            count++;  // Noncompliant
                          }
                        }
                        

                        Make the enclosing method "static" or remove this set.
                        Open

                                document = sampleHtmlFile();

                        Correctly updating a static field from a non-static method is tricky to get right and could easily lead to bugs if there are multiple class instances and/or multiple threads in play. Ideally, static fields are only updated from synchronized static methods.

                        This rule raises an issue each time a static field is updated from a non-static method.

                        Noncompliant Code Example

                        public class MyClass {
                        
                          private static int count = 0;
                        
                          public void doSomething() {
                            //...
                            count++;  // Noncompliant
                          }
                        }
                        

                        Make the enclosing method "static" or remove this set.
                        Open

                                document = sampleHtmlFile();

                        Correctly updating a static field from a non-static method is tricky to get right and could easily lead to bugs if there are multiple class instances and/or multiple threads in play. Ideally, static fields are only updated from synchronized static methods.

                        This rule raises an issue each time a static field is updated from a non-static method.

                        Noncompliant Code Example

                        public class MyClass {
                        
                          private static int count = 0;
                        
                          public void doSomething() {
                            //...
                            count++;  // Noncompliant
                          }
                        }
                        

                        Make the enclosing method "static" or remove this set.
                        Open

                                document = sampleHtmlFile();

                        Correctly updating a static field from a non-static method is tricky to get right and could easily lead to bugs if there are multiple class instances and/or multiple threads in play. Ideally, static fields are only updated from synchronized static methods.

                        This rule raises an issue each time a static field is updated from a non-static method.

                        Noncompliant Code Example

                        public class MyClass {
                        
                          private static int count = 0;
                        
                          public void doSomething() {
                            //...
                            count++;  // Noncompliant
                          }
                        }
                        

                        Make the enclosing method "static" or remove this set.
                        Open

                                document = sampleHtmlFile();

                        Correctly updating a static field from a non-static method is tricky to get right and could easily lead to bugs if there are multiple class instances and/or multiple threads in play. Ideally, static fields are only updated from synchronized static methods.

                        This rule raises an issue each time a static field is updated from a non-static method.

                        Noncompliant Code Example

                        public class MyClass {
                        
                          private static int count = 0;
                        
                          public void doSomething() {
                            //...
                            count++;  // Noncompliant
                          }
                        }
                        

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

                                try {
                                    elm.prependChild(docType);
                                    fail("Must throw exception.");
                                } catch (final DOMException e) {
                                    assertNull(docType.getParentNode());
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 521..528

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

                        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

                                try {
                                    elm.appendChild(docType);
                                    fail("Must throw exception.");
                                } catch (final DOMException e) {
                                    assertNull(docType.getParentNode());
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 386..393

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

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

                                try {
                                    text.appendChild(elm);
                                    fail("Must throw exception.");
                                } catch (final DOMException e) {
                                    assertNotNull(elm.getParentNode());
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 408..414
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 501..507
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 549..555
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 570..576
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 577..583
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 584..590
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 592..598
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 599..605
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 606..612
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 613..619
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 621..627
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 629..635
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 636..642

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

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

                                try {
                                    text.appendChild(docType);
                                    fail("Must throw exception.");
                                } catch (final DOMException e) {
                                    assertNull(docType.getParentNode());
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 408..414
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 501..507
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 549..555
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 557..563
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 570..576
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 584..590
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 592..598
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 599..605
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 606..612
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 613..619
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 621..627
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 629..635
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 636..642

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

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

                                try {
                                    attr.appendChild(fragment);
                                    fail("Must throw exception.");
                                } catch (final DOMException e) {
                                    assertNull(fragment.getParentNode());
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 408..414
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 501..507
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 549..555
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 557..563
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 570..576
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 577..583
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 584..590
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 592..598
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 599..605
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 606..612
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 621..627
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 629..635
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 636..642

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

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

                                try {
                                    fragment.appendChild(docType);
                                    fail("Must throw exception.");
                                } catch (final DOMException e) {
                                    assertNull(docType.getParentNode());
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 408..414
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 501..507
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 549..555
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 557..563
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 570..576
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 577..583
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 584..590
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 592..598
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 599..605
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 606..612
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 613..619
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 621..627
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 629..635

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

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

                                try {
                                    text.appendChild(text);
                                    fail("Must throw exception.");
                                } catch (final DOMException e) {
                                    assertNull(text.getParentNode());
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 408..414
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 501..507
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 557..563
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 570..576
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 577..583
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 584..590
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 592..598
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 599..605
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 606..612
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 613..619
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 621..627
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 629..635
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 636..642

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

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

                                try {
                                    attr.appendChild(text);
                                    fail("Must throw exception.");
                                } catch (final DOMException e) {
                                    assertNull(text.getParentNode());
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 408..414
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 501..507
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 549..555
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 557..563
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 570..576
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 577..583
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 584..590
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 599..605
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 606..612
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 613..619
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 621..627
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 629..635
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 636..642

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

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

                                try {
                                    text.appendChild(pi);
                                    fail("Must throw exception.");
                                } catch (final DOMException e) {
                                    assertNull(pi.getParentNode());
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 408..414
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 501..507
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 549..555
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 557..563
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 577..583
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 584..590
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 592..598
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 599..605
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 606..612
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 613..619
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 621..627
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 629..635
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 636..642

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

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

                                try {
                                    docType.appendChild(fragment);
                                    fail("Must throw exception.");
                                } catch (final DOMException e) {
                                    assertNull(fragment.getParentNode());
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 408..414
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 549..555
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 557..563
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 570..576
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 577..583
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 584..590
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 592..598
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 599..605
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 606..612
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 613..619
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 621..627
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 629..635
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 636..642

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

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

                                try {
                                    fragment.prependChild(docType);
                                    fail("Must throw exception.");
                                } catch (final DOMException e) {
                                    assertNull(docType.getParentNode());
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 501..507
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 549..555
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 557..563
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 570..576
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 577..583
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 584..590
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 592..598
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 599..605
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 606..612
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 613..619
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 621..627
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 629..635
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 636..642

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

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

                                try {
                                    text.appendChild(fragment);
                                    fail("Must throw exception.");
                                } catch (final DOMException e) {
                                    assertNull(fragment.getParentNode());
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 408..414
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 501..507
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 549..555
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 557..563
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 570..576
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 577..583
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 592..598
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 599..605
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 606..612
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 613..619
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 621..627
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 629..635
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 636..642

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

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

                                try {
                                    attr.appendChild(docType);
                                    fail("Must throw exception.");
                                } catch (final DOMException e) {
                                    assertNull(docType.getParentNode());
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 408..414
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 501..507
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 549..555
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 557..563
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 570..576
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 577..583
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 584..590
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 592..598
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 599..605
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 613..619
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 621..627
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 629..635
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 636..642

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

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

                                try {
                                    pi.appendChild(fragment);
                                    fail("Must throw exception.");
                                } catch (final DOMException e) {
                                    assertNull(fragment.getParentNode());
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 408..414
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 501..507
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 549..555
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 557..563
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 570..576
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 577..583
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 584..590
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 592..598
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 599..605
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 606..612
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 613..619
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 629..635
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 636..642

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

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

                                try {
                                    pi.appendChild(docType);
                                    fail("Must throw exception.");
                                } catch (final DOMException e) {
                                    assertNull(docType.getParentNode());
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 408..414
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 501..507
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 549..555
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 557..563
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 570..576
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 577..583
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 584..590
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 592..598
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 599..605
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 606..612
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 613..619
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 621..627
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 636..642

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

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

                                try {
                                    attr.appendChild(pi);
                                    fail("Must throw exception.");
                                } catch (final DOMException e) {
                                    assertNull(pi.getParentNode());
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 408..414
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 501..507
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 549..555
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 557..563
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 570..576
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 577..583
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 584..590
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 592..598
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 606..612
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 613..619
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 621..627
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 629..635
                        LoboUnitTest/src/test/java/org/loboevolution/junit/DOMNodeTest.java on lines 636..642

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

                        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