vudash/vudash

View on GitHub

Showing 13 of 13 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  sounds: Joi.object({
    passed: Joi.string().optional().description('Sound to play on build pass'),
    failed: Joi.string().optional().description('Sound to play on build fail'),
    unknown: Joi.string().optional().description('Sound to play on unknown state')
  }).optional().description('Sounds to play when build status changes'),
Severity: Major
Found in packages/widget-ci/src/server/validation.js and 1 other location - About 2 hrs to fix
packages/core/src/dashboard/schema/schema.js on lines 27..31

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 91.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

const datasourcesSchema = Joi.object().pattern(/.*/, Joi.object({
  module: Joi.string().required().description('Datasource module name or directory path'),
  schedule: Joi.number().required().description('Update frequency, milliseconds'),
  options: Joi.object().optional().description('Datasource specific options')
})).optional().description('Hash of datasources')
Severity: Major
Found in packages/core/src/dashboard/schema/schema.js and 1 other location - About 2 hrs to fix
packages/widget-ci/src/server/validation.js on lines 13..17

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 91.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

        const transformerSchema = Joi.object({
          transformer: Joi.string().required().label('Transformer module name'),
          options: Joi.object().optional().label('Transform configuration')
        })
      Severity: Major
      Found in packages/core/src/transform-loader/transform-loader.js and 1 other location - About 1 hr to fix
      packages/core/src/dashboard/schema/schema.js on lines 5..8

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 64.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      const layoutSchema = Joi.object({
        columns: Joi.number().required().description('Number of columns'),
        rows: Joi.number().required().description('Number of rows')
      }).required().description('Layout')
      Severity: Major
      Found in packages/core/src/dashboard/schema/schema.js and 1 other location - About 1 hr to fix
      packages/core/src/transform-loader/transform-loader.js on lines 8..11

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 64.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      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

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

            options: Joi.alternatives([
              Joi.object().optional().description('Chance method options'),
              Joi.array().optional().description('Chance method arguments')
            ])
          packages/datasource-google-sheets/src/config-validator/index.js on lines 39..42

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 56.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              return Joi.alternatives([
                Joi.string().required().description('Column heading'),
                Joi.array().required().description('Array of column headings')
              ]).required().description('Column or an array of Columns to retrieve')
          packages/datasource-random/src/datasource-validation/index.js on lines 7..10

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 56.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          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