ContentMine/thresher

View on GitHub

Showing 227 of 227 total issues

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

            if (n.nodeType == 2 /*Node.ATTRIBUTE_NODE*/
                    || n.nodeType == 1 /*Node.ELEMENT_NODE*/
                    || n.nodeType == XPathNamespace.XPATH_NAMESPACE_NODE) {
                var test = Utilities.resolveQName(this.value, xpc.namespaceResolver, xpc.expressionContextNode, false);
                if (test[0] == null) {
Severity: Minor
Found in lib/xpath.js and 1 other location - About 35 mins to fix
lib/xpath.js on lines 2189..2193

Duplicated Code

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

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

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

Tuning

This issue has a mass of 46.

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

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

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

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

Refactorings

Further Reading

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

    if (this.resultType != XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE
            && this.resultType != XPathResult.ORDERED_NODE_SNAPSHOT_TYPE) {
        throw new XPathException(XPathException.TYPE_ERR);
    }
Severity: Minor
Found in lib/xpath.js and 1 other location - About 35 mins to fix
lib/xpath.js on lines 4212..4215

Duplicated Code

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

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

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

Tuning

This issue has a mass of 46.

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

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

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

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

Refactorings

Further Reading

Avoid too many return statements within this function.
Open

            return Step.PARENT;
Severity: Major
Found in lib/xpath.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                return Step.PRECEDINGSIBLING;
    Severity: Major
    Found in lib/xpath.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                  return Step.DESCENDANT;
      Severity: Major
      Found in lib/xpath.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                    return Step.NAMESPACE;
        Severity: Major
        Found in lib/xpath.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return false;
          Severity: Major
          Found in lib/xpath.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                return false;
            Severity: Major
            Found in lib/xpath.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                              return;
              Severity: Major
              Found in lib/xpath.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        return -1;
                Severity: Major
                Found in lib/xpath.js - About 30 mins to fix

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

                  Functions.false_ = function() {
                      if (arguments.length != 1) {
                          throw new Error("Function false expects ()");
                      }
                      return new XBoolean(false);
                  Severity: Minor
                  Found in lib/xpath.js and 1 other location - About 30 mins to fix
                  lib/xpath.js on lines 3562..3567

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

                  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

                  Avoid too many return statements within this function.
                  Open

                              return Step.FOLLOWINGSIBLING;
                  Severity: Major
                  Found in lib/xpath.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                return Step.SELF;
                    Severity: Major
                    Found in lib/xpath.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                  return Step.FOLLOWING;
                      Severity: Major
                      Found in lib/xpath.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                return new NodeTest(-1, undefined);
                        Severity: Major
                        Found in lib/xpath.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                              return 1;
                          Severity: Major
                          Found in lib/xpath.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                            return test[0] == node[0] && test[1] == node[1];
                            Severity: Major
                            Found in lib/xpath.js - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                          return Step.PRECEDING;
                              Severity: Major
                              Found in lib/xpath.js - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                                return;
                                Severity: Major
                                Found in lib/xpath.js - About 30 mins to fix

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

                                  Functions.true_ = function() {
                                      if (arguments.length != 1) {
                                          throw new Error("Function true expects ()");
                                      }
                                      return new XBoolean(true);
                                  Severity: Minor
                                  Found in lib/xpath.js and 1 other location - About 30 mins to fix
                                  lib/xpath.js on lines 3569..3574

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

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

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

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

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

                                  Refactorings

                                  Further Reading

                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language