PieceMeta/node-sparql-hollandaise

View on GitHub

Showing 16 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

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

        limit(count) {
            if (typeof count === 'number') {
                this._config.solutionModifiers.push(`LIMIT ${count}`);
            } else {
                throw new Error(`Input for LIMIT must be number but is ${typeof count}.`);
    Severity: Major
    Found in src/sparql/query.js and 2 other locations - About 2 hrs to fix
    src/sparql/query.js on lines 201..208
    src/sparql/query.js on lines 233..240

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

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

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

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

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

    Refactorings

    Further Reading

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

        offset(count) {
            if (typeof count === 'number') {
                this._config.solutionModifiers.push(`OFFSET ${count}`);
            } else {
                throw new Error(`Input for OFFSET must be number but is ${typeof count}.`);
    Severity: Major
    Found in src/sparql/query.js and 2 other locations - About 2 hrs to fix
    src/sparql/query.js on lines 201..208
    src/sparql/query.js on lines 217..224

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

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

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

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

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

    Refactorings

    Further Reading

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

        order(content) {
            if (typeof content === 'string') {
                this._config.solutionModifiers.push(`ORDER BY ${content}`);
            } else {
                throw new Error(`Input for ORDER must be string but is ${typeof content}.`);
    Severity: Major
    Found in src/sparql/query.js and 2 other locations - About 2 hrs to fix
    src/sparql/query.js on lines 217..224
    src/sparql/query.js on lines 233..240

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

    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

    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

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

          export default class Filter {
              /**
               * The Filter class represents a single FILTER clause to be used within GraphPatterns
               *
               * @class Filter
          Severity: Major
          Found in src/sparql/filter.js and 1 other location - About 1 hr to fix
          src/sparql/query-types.js on lines 29..50

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

          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

          export class Describe {
              /**
               * Creates a DESCRIBE query
               *
               * @class Describe
          Severity: Major
          Found in src/sparql/query-types.js and 1 other location - About 1 hr to fix
          src/sparql/filter.js on lines 1..22

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

          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

          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

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

                  if (Array.isArray(this._config.solutionModifiers)) {
                      for (let mod of this._config.solutionModifiers) {
                          queryString += ` ${mod.toString()}`;
                      }
                  }
          Severity: Minor
          Found in src/sparql/query.js and 1 other location - About 40 mins to fix
          src/sparql/query.js on lines 267..271

          Duplicated Code

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

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

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

          Tuning

          This issue has a mass of 48.

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

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

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

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

          Refactorings

          Further Reading

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

                      if (this._config.prefixes.length > 0) {
                          for (let prefix of this._config.prefixes) {
                              queryString += `${prefix.toString()} `;
                          }
                      }
          Severity: Minor
          Found in src/sparql/query.js and 1 other location - About 40 mins to fix
          src/sparql/query.js on lines 292..296

          Duplicated Code

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

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

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

          Tuning

          This issue has a mass of 48.

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

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

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

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

          Refactorings

          Further Reading

          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