Showing 7 of 13 total issues
Function assign
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
Open
Object.assign = function (target, varArgs) {
'use strict'
if (target == null) {
throw new TypeError('Cannot convert undefined or null to object')
}
- 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 run
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
exports.run = function () {
const dashboard = require('../../dashboards/template.json')
const cwd = process.cwd()
const spinner = ora().start('Creating dashboard layout')
const configFile = Path.join(cwd, 'dashboards', 'default.json')
Function register
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function register () {
const server = new Hapi.Server()
server.connection({ port: process.env.PORT || 3300 })
server.settings.app = { serverUrl: process.env.SERVER_URL || server.info.uri }
Function register
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
register: function (server, options, next) {
server.route({
method: 'PUT',
path: '/api/v1/view/current',
config: {
Function register
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
register: function (server, options, next) {
server.route({
method: 'GET',
path: '/',
handler: indexHandler
Avoid deeply nested control flow statements. Open
Open
if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
to[nextKey] = nextSource[nextKey]
}
Function prepareOptions
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
prepareOptions () {
const options = this.config.method ? this.config.options : { min: 0, max: 999 }
const args = Array.isArray(options) ? options : [options]
if (this.config.method === 'n') {
- 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"