erulabs/erudb

View on GitHub

Showing 14 of 14 total issues

Function validateServiceOptions has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

export function validateServiceOptions (opts = {}) {
  if (!opts.expectedPeerCount) opts.expectedPeerCount = 3
  if (!opts.expectedDiskCount) opts.expectedDiskCount = 3
  if (!opts.expectedHostCount) opts.expectedHostCount = 3
  if (!opts.expectedGroupCount) opts.expectedGroupCount = 3
Severity: Minor
Found in src/helpers.js - About 3 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 validateServiceOptions has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function validateServiceOptions (opts = {}) {
  if (!opts.expectedPeerCount) opts.expectedPeerCount = 3
  if (!opts.expectedDiskCount) opts.expectedDiskCount = 3
  if (!opts.expectedHostCount) opts.expectedHostCount = 3
  if (!opts.expectedGroupCount) opts.expectedGroupCount = 3
Severity: Minor
Found in src/helpers.js - About 1 hr to fix

    Avoid deeply nested control flow statements.
    Open

            if (!opts.peers.redis.key) opts.peers.redis.key = '__EruDB_discovery'
    Severity: Major
    Found in src/helpers.js - About 45 mins to fix

      Import in body of module; reorder to top.
      Open

      import sourcemaps from 'gulp-sourcemaps'
      Severity: Minor
      Found in gulpfile.babel.js by eslint

      For more information visit Source: http://eslint.org/docs/rules/

      Import in body of module; reorder to top.
      Open

      import prepend from 'prepend-file'
      Severity: Minor
      Found in gulpfile.babel.js by eslint

      For more information visit Source: http://eslint.org/docs/rules/

      Import in body of module; reorder to top.
      Open

      import mocha from 'gulp-mocha'
      Severity: Minor
      Found in gulpfile.babel.js by eslint

      For more information visit Source: http://eslint.org/docs/rules/

      Unexpected tab character.
      Open

              .pipe(babel({ presets: [ 'es2015' ] }))
      Severity: Minor
      Found in gulpfile.babel.js by eslint

      disallow all tabs (no-tabs)

      Some style guides don't allow the use of tab characters at all, including within comments.

      Rule Details

      This rule looks for tabs anywhere inside a file: code, comments or anything else.

      Examples of incorrect code for this rule:

      var a /t= 2;
      
      /**
      * /t/t it's a test function
      */
      function test(){}
      
      var x = 1; // /t test

      Examples of correct code for this rule:

      var a = 2;
      
      /**
      * it's a test function
      */
      function test(){}
      
      var x = 1; // test

      When Not To Use It

      If you have established a standard where having tabs is fine.

      Compatibility

      Import in body of module; reorder to top.
      Open

      import eslint from 'gulp-eslint'
      Severity: Minor
      Found in gulpfile.babel.js by eslint

      For more information visit Source: http://eslint.org/docs/rules/

      Import in body of module; reorder to top.
      Open

      import fs from 'fs'
      Severity: Minor
      Found in gulpfile.babel.js by eslint

      For more information visit Source: http://eslint.org/docs/rules/

      Import in body of module; reorder to top.
      Open

      import del from 'del'
      Severity: Minor
      Found in gulpfile.babel.js by eslint

      For more information visit Source: http://eslint.org/docs/rules/

      Unexpected tab character.
      Open

              .pipe(gulp.dest(DEST))
      Severity: Minor
      Found in gulpfile.babel.js by eslint

      disallow all tabs (no-tabs)

      Some style guides don't allow the use of tab characters at all, including within comments.

      Rule Details

      This rule looks for tabs anywhere inside a file: code, comments or anything else.

      Examples of incorrect code for this rule:

      var a /t= 2;
      
      /**
      * /t/t it's a test function
      */
      function test(){}
      
      var x = 1; // /t test

      Examples of correct code for this rule:

      var a = 2;
      
      /**
      * it's a test function
      */
      function test(){}
      
      var x = 1; // test

      When Not To Use It

      If you have established a standard where having tabs is fine.

      Compatibility

      Import in body of module; reorder to top.
      Open

      import server from 'gulp-develop-server'
      Severity: Minor
      Found in gulpfile.babel.js by eslint

      For more information visit Source: http://eslint.org/docs/rules/

      Import in body of module; reorder to top.
      Open

      import gulp from 'gulp'
      Severity: Minor
      Found in gulpfile.babel.js by eslint

      For more information visit Source: http://eslint.org/docs/rules/

      Import in body of module; reorder to top.
      Open

      import babel from 'gulp-babel'
      Severity: Minor
      Found in gulpfile.babel.js by eslint

      For more information visit Source: http://eslint.org/docs/rules/

      Severity
      Category
      Status
      Source
      Language