Showing 7 of 7 total issues
File xfmr.js
has 276 lines of code (exceeds 250 allowed). Consider refactoring. Open
import hoek from 'hoek'
import _ from 'lodash'
import Spec from './spec'
import pluralize from 'pluralize'
Function getDefinitionsFromRouteConfig
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
getDefinitionsFromRouteConfig(sails) {
let routes = sails.config.routes,
swaggerdefs = _.pick(routes, function(routeConfig, route) {
return _.has(routeConfig, 'swagger');
});
- 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 getDefinitionsFromRouteConfig
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
getDefinitionsFromRouteConfig(sails) {
let routes = sails.config.routes,
swaggerdefs = _.pick(routes, function(routeConfig, route) {
return _.has(routeConfig, 'swagger');
});
Function getBlueprintPrefixes
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function getBlueprintPrefixes() {
// Add a "/" to a prefix if it's missing
function formatPrefix(prefix) {
return (prefix.indexOf('/') !== 0 ? '/' : '') + prefix
}
- 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 getParameters
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
getParameters(sails, methodGroup) {
let method = methodGroup.method
let routeKeys = methodGroup.keys
let canHavePayload = method === 'post' || method === 'put'
Function getPathControllerTag
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
getPathControllerTag(sails, methodGroup) {
// Fist check if we can find a controller tag using prefixed blueprint routes
for (var prefix of getBlueprintPrefixes()) {
if (methodGroup.path.indexOf(prefix) === 0) {
let [$, pathToken] = methodGroup.path.replace(prefix, '').split('/')
- 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 getParameters
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
getParameters(sails, methodGroup) {
let method = methodGroup.method
let routeKeys = methodGroup.keys
let canHavePayload = method === 'post' || method === 'put'
- 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"