JoTrdl/grunt-dock

View on GitHub

Showing 46 of 46 total issues

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

    async.doWhilst(
      function (callback) {
        i ++;
        process(images[i-1], callback);
      },
Severity: Major
Found in lib/clean.js and 1 other location - About 4 hrs to fix
lib/clean.js on lines 127..141

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 120.

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

    async.doWhilst(
      function (callback) {
        i ++;
        process(containers[i-1], callback);
      },
Severity: Major
Found in lib/clean.js and 1 other location - About 4 hrs to fix
lib/clean.js on lines 59..74

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 120.

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 buildCommands has 98 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var buildCommands = function(grunt, docker, options, done, tag) {

  // Build image with tag and its data/options.
  // Call callback when done or error.
  var build = function(data, options, callback) {
Severity: Major
Found in lib/build.js - About 3 hrs to fix

    Function buildCommands has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

    var buildCommands = function(grunt, docker, options, done, tag) {
    
      // Build image with tag and its data/options.
      // Call callback when done or error.
      var build = function(data, options, callback) {
    Severity: Minor
    Found in lib/build.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 start has 72 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    commands.start = function(grunt, docker, options, done, tag) {
    
      // Start 1 container with image tag
      var startContainer = function(tag, confImage, callback) {
    
    
    Severity: Major
    Found in lib/container.js - About 2 hrs to fix

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

            stream.on("data", function(data) {
              var jsonData = JSON.parse(data);
              if (jsonData && jsonData.error) {
                stream.emit("error", jsonData.error);
              }
      Severity: Major
      Found in lib/push.js and 1 other location - About 2 hrs to fix
      lib/pull.js on lines 38..44

      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

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

            stream.on("data", function(data) {
              var jsonData = JSON.parse(data);
              if (jsonData && jsonData.error) {
                stream.emit("error", jsonData.error);
              }
      Severity: Major
      Found in lib/pull.js and 1 other location - About 2 hrs to fix
      lib/push.js on lines 47..53

      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 exports has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

      module.exports = function(grunt) {
      
        var commands = utils.merge({
          list : require('../lib/list'),
          clean : require('../lib/clean'),
      Severity: Minor
      Found in tasks/dock.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 action has 58 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        commands[action] = function(grunt, docker, options, done, tag) {
      
          // process 1 container with image tag
          var process = function(tag, confImage, callback) {
      
      
      Severity: Major
      Found in lib/container.js - About 2 hrs to fix

        Function startContainer has 54 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          var startContainer = function(tag, confImage, callback) {
        
            grunt.log.subhead('Starting image [' + tag + ']');
        
            async.waterfall([
        Severity: Major
        Found in lib/container.js - About 2 hrs to fix

          Function exports has 52 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          module.exports = function(grunt) {
          
            var commands = utils.merge({
              list : require('../lib/list'),
              clean : require('../lib/clean'),
          Severity: Major
          Found in tasks/dock.js - About 2 hrs to fix

            Function exports has 49 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            module.exports = function(grunt) {
            
              var caPath   = path.resolve(utils.getUserHome(), '.docker/machine/certs/', 'ca.pem'),
                  certPath = path.resolve(utils.getUserHome(), '.docker/machine/certs/', 'cert.pem'),
                  keyPath  = path.resolve(utils.getUserHome(), '.docker/machine/certs/', 'key.pem');
            Severity: Minor
            Found in examples/nginxproxy/Gruntfile.js - About 1 hr to fix

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

                var specOptions = (options.images[imageName]
                    && options.images[imageName].options && options.images[imageName].options.run) ? options.images[imageName].options.run
                    : {};
              Severity: Major
              Found in lib/utils.js and 2 other locations - About 1 hr to fix
              lib/utils.js on lines 197..199
              lib/utils.js on lines 224..226

              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 74.

              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 3 locations. Consider refactoring.
              Open

                var specOptions = (options.images[imageName]
                    && options.images[imageName].options && options.images[imageName].options.push) ? options.images[imageName].options.push
                    : {};
              Severity: Major
              Found in lib/utils.js and 2 other locations - About 1 hr to fix
              lib/utils.js on lines 224..226
              lib/utils.js on lines 251..253

              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 74.

              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 3 locations. Consider refactoring.
              Open

                var specOptions = (options.images[imageName]
                    && options.images[imageName].options && options.images[imageName].options.pull) ? options.images[imageName].options.pull
                    : {};
              Severity: Major
              Found in lib/utils.js and 2 other locations - About 1 hr to fix
              lib/utils.js on lines 197..199
              lib/utils.js on lines 251..253

              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 74.

              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 runCommand has 48 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              var runCommand = function(grunt, dockerIn, options, done) {
              
                // Creates a container
                var runImage = function(docker, imageName, repoTag, cmd, createOptions,
                    startOptions, callback) {
              Severity: Minor
              Found in lib/run.js - About 1 hr to fix

                Function image has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                commands.image = function(grunt, docker, options, done) {
                
                  docker.listImages({all: true, filters:'{"dangling":["true"]}'}, function(err, images) {
                    if (err) {
                      return done(err);
                Severity: Minor
                Found in lib/clean.js - About 1 hr to fix

                  Function container has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  commands.container = function(grunt, docker, options, done) {
                  
                    docker.listContainers({all: true, filters:'{"status":["exited"]}'}, function(err, containers) {
                  
                      if (err) {
                  Severity: Minor
                  Found in lib/clean.js - About 1 hr to fix

                    Function pullCommand has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    var pullCommand = function(grunt, docker, options, done) {
                    
                      // Pulls an image
                      var pullImage = function(docker, repoTag, callback) {
                    
                    
                    Severity: Minor
                    Found in lib/pull.js - About 1 hr to fix

                      Function format has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      utils.format = function(name, value) {
                      
                        var format = "";
                      
                        switch (name) {
                      Severity: Minor
                      Found in lib/utils.js - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language