bq/composr-core

View on GitHub

Showing 30 of 38 total issues

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

PhraseManager.prototype.runByPath = function runByPath (domain, path, verb, params, version, cb) {
  if (utils.values.isFalsy(verb)) {
    verb = 'get'
  }

Severity: Minor
Found in src/lib/managers/Phrase.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 runByPath has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

PhraseManager.prototype.runByPath = function runByPath (domain, path, verb, params, version, cb) {
Severity: Minor
Found in src/lib/managers/Phrase.js - About 45 mins to fix

    Function validate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    function validate (snippet) {
      var errors = []
    
      var errorAccumulator = utils.errorAccumulator(errors)
    
    
    Severity: Minor
    Found in src/lib/validators/snippet.validator.js - About 45 mins to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function documentation has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    function documentation (phrases, snippets, domain, version, basePathDoc) {
    Severity: Minor
    Found in src/lib/doc/documentation.js - About 35 mins to fix

      Function getAllRecursively has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      var getAllRecursively = function getAllRecursively (caller, pageNumber, pageSize, items, promise) {
      Severity: Minor
      Found in src/lib/utils.js - About 35 mins to fix

        Function __executeScriptMode has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        PhraseModel.prototype.__executeScriptMode = function __executeScriptMode (verb, parameters, timeout, file, events) {
        Severity: Minor
        Found in src/lib/models/PhraseModel.js - About 35 mins to fix

          Function _run has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          PhraseManager.prototype._run = function _runPhrase (phrase, verb, params, domain, cb) {
          Severity: Minor
          Found in src/lib/managers/Phrase.js - About 35 mins to fix

            Function getByMatchingPath has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            PhraseManager.prototype.getByMatchingPath = function getByMatchingPath (domain, path, verb, version) {
              var candidate = null
            
              if (!verb) {
                verb = 'get'
            Severity: Minor
            Found in src/lib/managers/Phrase.js - About 35 mins to fix

            Cognitive Complexity

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

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

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

            Further reading

            Avoid too many return statements within this function.
            Open

              return new Promise(function (resolve, reject) {
                try {
                  var options = {
                    clientId: module.config.credentials.clientId,
                    clientSecret: module.config.credentials.clientSecret,
            Severity: Major
            Found in src/lib/initCorbelDriver.js - About 30 mins to fix

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

              PhraseModel.prototype.__executeScriptMode = function __executeScriptMode (verb, parameters, timeout, file, events) {
                var options = {
                  timeout: timeout || 10000,
                  displayErrors: true
                }
              Severity: Minor
              Found in src/lib/models/PhraseModel.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