JoTrdl/grunt-dock

View on GitHub

Showing 46 of 46 total issues

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

  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: Major
Found in examples/nginxproxy/Gruntfile.js and 1 other location - About 1 hr to fix
examples/simple/Gruntfile.js on lines 19..21

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

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

  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: Major
Found in examples/simple/Gruntfile.js and 1 other location - About 1 hr to fix
examples/nginxproxy/Gruntfile.js on lines 19..21

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

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

    var process = function(tag, confImage, callback) {

      grunt.log.subhead(actioning[action] + ' image [' + tag + ']');

      async.waterfall([
Severity: Minor
Found in lib/container.js - About 1 hr to fix

    Function pushCommand has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var pushCommand = function(grunt, docker, options, done) {
    
      // Pushes an image
      // NOTE: since it has to change the image name to please Dockerode, the name
      // of the image is saved in a property and then restored
    Severity: Minor
    Found in lib/push.js - About 1 hr to fix

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

          table.total('CONTAINER ID', {
            printer: function() {
              return table.rows.length + ' ' + (table.rows.length > 1 ? 'containers' : 'container');
            }
          });
      Severity: Major
      Found in lib/list.js and 1 other location - About 1 hr to fix
      lib/list.js on lines 64..68

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

      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

          table.total('REPOSITORY', {
            printer: function() { 
              return table.rows.length + ' ' + (table.rows.length > 1 ? 'images' : 'image');
            }
          });
      Severity: Major
      Found in lib/list.js and 1 other location - About 1 hr to fix
      lib/list.js on lines 111..115

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

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

      commands.image = function(grunt, docker, options, done) {
      
        var table = new Table();
      
        table.total('REPOSITORY', tableOptions.accumulator, tableOptions.print);
      Severity: Minor
      Found in lib/list.js - About 1 hr to fix

        Function exports has 30 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/simple/Gruntfile.js - About 1 hr to fix

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

          commands.container = function(grunt, docker, options, done) {
          
            var table = new Table();
          
            table.total('CONTAINER ID', tableOptions.accumulator, tableOptions.print);
          Severity: Minor
          Found in lib/list.js - About 1 hr to fix

            Function format has a Cognitive Complexity of 10 (exceeds 5 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

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

              var processCommand = function(command, arg) {
                if (!arg) {
                  arg = 'default';
                }
            
            
            Severity: Minor
            Found in tasks/dock.js - About 1 hr to fix

              Function pullCommand has a Cognitive Complexity of 9 (exceeds 5 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 55 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 shouldIgnore has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

              utils.shouldIgnore = function(directives, s) {
                var ignore = false;
              
                for (var i = 0; i < directives.length; i++) {
                  if (!directives[i] || directives[i] === '') continue;
              Severity: Minor
              Found in lib/utils.js - About 55 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 runImage has 7 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                var runImage = function(docker, imageName, repoTag, cmd, createOptions,
                    startOptions, callback) {
              Severity: Major
              Found in lib/run.js - About 50 mins to fix

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

                  imageNames.forEach(function(imageName) {
                    var dockers = utils.composeRunOptions(options, imageName).docker;
                    nruns += dockers.length;
                  });
                Severity: Minor
                Found in lib/run.js and 1 other location - About 50 mins to fix
                lib/pull.js on lines 58..61

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

                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

                  imageNames.forEach(function(imageName) {
                    var dockers = utils.composePullOptions(options, imageName).docker;
                    npulls += dockers.length;
                  });
                Severity: Minor
                Found in lib/pull.js and 1 other location - About 50 mins to fix
                lib/run.js on lines 66..69

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

                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

                Consider simplifying this complex logical expression.
                Open

                          if (container) {
                            var dockcontainer = docker.getContainer(container.Id);
                            if (utils.getContainerStatus(container) === "RUNNING") {
                              grunt.log
                                  .writeln("Found a matched running container, killed it.");
                Severity: Major
                Found in lib/container.js - About 40 mins to fix

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

                  commands.default = function(grunt, docker, options, done) {
                    async.applyEachSeries([commands.image, commands.container], grunt, docker, options, done);
                  };
                  Severity: Minor
                  Found in lib/clean.js and 1 other location - About 40 mins to fix
                  lib/list.js on lines 131..133

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

                  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

                  commands.default = function(grunt, docker, options, done) {
                    async.applyEachSeries([commands.image, commands.container], grunt, docker, options, done);
                  };
                  Severity: Minor
                  Found in lib/list.js and 1 other location - About 40 mins to fix
                  lib/clean.js on lines 153..155

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

                  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 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  var buildCommands = function(grunt, docker, options, done, tag) {
                  Severity: Minor
                  Found in lib/build.js - About 35 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language