TechnologyAdvice/DevLab

View on GitHub

Showing 8 of 8 total issues

Function get has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

  get: (cfg, name, tmpdir, primary = false) => {
    if (!cfg.from) throw new Error('Missing \'from\' property in config or argument')
    const cwd = dewindowize(process.cwd())
    const workDir = cfg.workDir || cwd
    let args
Severity: Minor
Found in src/command.js - About 1 hr 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 getExec has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  getExec: (cfg) => {
    const sh = '#!/bin/sh\nset -e;\n'
    const before = cfg.before ? `${cfg.before}\n` : ''
    const after = cfg.after ? `\n${cfg.after}` : ''
    // Custom exec, just run native task
Severity: Minor
Found in src/command.js - About 1 hr 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 filterEnabled has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  filterEnabled: (cfg) => {
    if (!cfg.run.length) return cfg
    const tasks = _.values(_.pick(cfg.run, cfg.tasks))
    const objs = _.filter(_.isType('object'), tasks)
    // If any running task doesn't have object config and no services specified in command line, keep all services
Severity: Minor
Found in src/services.js - About 1 hr to fix

    Function logMissingServiceImages has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      logMissingServiceImages: (svc) => Promise.resolve().then(() => {
        const missingImages = svc.reduce((arr, i) => {
          const cmd = [
            'docker images',
            '"--filter=reference=' + i.args[i.args.length - 1] + '"'
    Severity: Minor
    Found in src/images.js - About 45 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

    Function exports has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    module.exports = () => {
      /**
       * Runs sync access for W_OK to determine if we can write to the path
       * @params {String} path The path to test
       * @returns {Boolean}
    Severity: Minor
    Found in src/tempdir.js - About 35 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

    Function getImage has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      getImage: (dockerfile = './Dockerfile', monitorPaths = [], tags = []) => {
        monitorPaths.push(dockerfile)
        return Promise.all([
          images.getHash(monitorPaths),
          images.getBuiltImages()
    Severity: Minor
    Found in src/images.js - About 35 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

    Function filterEnabled has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      filterEnabled: (cfg) => {
        if (!cfg.run.length) return cfg
        const tasks = _.values(_.pick(cfg.run, cfg.tasks))
        const objs = _.filter(_.isType('object'), tasks)
        // If any running task doesn't have object config and no services specified in command line, keep all services
    Severity: Minor
    Found in src/services.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

    Function parse has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      parse: () => Promise.resolve().then(() => {
        const cfg = {}
        const actions = []
        _.pipe([
          _.omit(['_']),
    Severity: Minor
    Found in src/args.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