vudash/vudash

View on GitHub

Showing 7 of 13 total issues

Function assign has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

  Object.assign = function (target, varArgs) {
    'use strict'
    if (target == null) {
      throw new TypeError('Cannot convert undefined or null to object')
    }
Severity: Minor
Found in packages/core/src/public/js/object-assign.polyfill.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 run has 44 lines of code (exceeds 25 allowed). Consider refactoring.
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')
Severity: Minor
Found in packages/core/src/cli/create.js - About 1 hr to fix

    Function register has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    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 }
    Severity: Minor
    Found in packages/core/src/server.js - About 1 hr to fix

      Function register has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        register: function (server, options, next) {
          server.route({
            method: 'PUT',
            path: '/api/v1/view/current',
            config: {
      Severity: Minor
      Found in packages/core/src/plugins/api/api.js - About 1 hr to fix

        Function register has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          register: function (server, options, next) {
            server.route({
              method: 'GET',
              path: '/',
              handler: indexHandler
        Severity: Minor
        Found in packages/core/src/plugins/ui/ui.js - About 1 hr to fix

          Avoid deeply nested control flow statements.
          Open

                    if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
                      to[nextKey] = nextSource[nextKey]
                    }
          Severity: Major
          Found in packages/core/src/public/js/object-assign.polyfill.js - About 45 mins to fix

            Function prepareOptions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            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') {
            Severity: Minor
            Found in packages/datasource-random/src/random-transport/index.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