PieceMeta/node-sparql-hollandaise

View on GitHub

Showing 9 of 16 total issues

Query has 22 functions (exceeds 20 allowed). Consider refactoring.
Open

export default class Query {
    /**
     * The Query is the root object for all SPARQL requests
     *
     * @class Query
Severity: Minor
Found in src/sparql/query.js - About 2 hrs to fix

    Function toString has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        toString(isSubQuery = false) {
            var queryString = '';
    
            if (!isSubQuery) {
                if (this._config.base) {
    Severity: Minor
    Found in src/sparql/query.js - 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

    Function constructor has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        constructor(...args) {
            var splitTriple = null;
            switch (args.length) {
                case 3:
                    let valid = true;
    Severity: Minor
    Found in src/sparql/triple.js - 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

    Function submit has 49 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        submit(queryString) {
            var instance = this;
            return new Promise(function (resolve, reject) {
                var headers = {
                    'Content-Type': 'application/x-www-form-urlencoded',
    Severity: Minor
    Found in src/sparql/transport.js - About 1 hr to fix

      Function constructor has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          constructor(...args) {
              var splitTriple = null;
              switch (args.length) {
                  case 3:
                      let valid = true;
      Severity: Minor
      Found in src/sparql/triple.js - About 1 hr to fix

        Function toString has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            toString(isSubQuery = false) {
                var queryString = '';
        
                if (!isSubQuery) {
                    if (this._config.base) {
        Severity: Minor
        Found in src/sparql/query.js - About 1 hr to fix

          Function toString has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              toString() {
                  var result = `${this._optional ? 'OPTIONAL ' : ''}${this._union ? 'UNION ' : ''}{ `;
                  for (let element of this._elements) {
                      if (element.constructor.name === 'Query') {
                          result += `{ ${element.toString(true)} } `;
          Severity: Minor
          Found in src/sparql/graph-pattern.js - About 55 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function constructor has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              constructor(value, prefixIndex = null) {
                  if (prefixIndex === null) {
                      prefixIndex = PrefixIndex;
                  }
                  if (value.indexOf(':') === -1) {
          Severity: Minor
          Found in src/sparql/prefix.js - About 25 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function addElement has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              addElement(element, atIndex = -1) {
                  if (typeof element === 'string') {
                      element = new Triple(element);
                  }
                  if (this._allowedTypes.indexOf(element.constructor.name) > -1) {
          Severity: Minor
          Found in src/sparql/graph-pattern.js - About 25 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Severity
          Category
          Status
          Source
          Language