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'
}
- Read upRead up
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) {
Function validate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function validate (snippet) {
var errors = []
var errorAccumulator = utils.errorAccumulator(errors)
- Read upRead up
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) {
Function getAllRecursively
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
var getAllRecursively = function getAllRecursively (caller, pageNumber, pageSize, items, promise) {
Function __executeScriptMode
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
PhraseModel.prototype.__executeScriptMode = function __executeScriptMode (verb, parameters, timeout, file, events) {
Function _run
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
PhraseManager.prototype._run = function _runPhrase (phrase, verb, params, domain, cb) {
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'
- Read upRead up
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,
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
}
- Read upRead up
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"