Mairu/meteor-electrify

View on GitHub

Showing 39 of 39 total issues

Function Env has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

function Env(input, output, settings, cli, buildSettings) {
  // shortcuts
  var join = path.join;

  // electrify version
Severity: Minor
Found in lib/env.js - About 4 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 Env has 111 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function Env(input, output, settings, cli, buildSettings) {
  // shortcuts
  var join = path.join;

  // electrify version
Severity: Major
Found in lib/env.js - About 4 hrs to fix

    Function package has 106 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    Electron.prototype.package = function(packager_options, done) {
      var packager = require('electron-packager');
    
      var electronVersion = requireElectron('package.json').version.replace(/^v/, '');
    
    
    Severity: Major
    Found in lib/electron.js - About 4 hrs to fix

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

      Electron.prototype.package = function(packager_options, done) {
        var packager = require('electron-packager');
      
        var electronVersion = requireElectron('package.json').version.replace(/^v/, '');
      
      
      Severity: Minor
      Found in lib/electron.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 parse_packager_options has 87 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function parse_packager_options(){
        var names = [
          // all platforms
          '--all',
          '--app-copyright',
      Severity: Major
      Found in bin/cli.js - About 3 hrs to fix

        Function start has 56 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        MongoDB.prototype.start = function(done) {
          if (this.$.env.app.config.mongo) {
            if (typeof this.$.env.app.config.mongo === 'object' && this.$.env.app.config.mongo.MONGO_URL) {
              this.log.info('Use external MONGO_URL');
              this.env.MONGO_URL = this.$.env.app.config.mongo.MONGO_URL;
        Severity: Major
        Found in lib/plugins/mongodb.js - About 2 hrs to fix

          Function bundle_meteor has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          App.prototype.bundle_meteor = function( /* server_url, */ done) {
            this.log.info('bundling meteor');
          
            var tmp_dir             = join(this.$.env.core.tmp, 'bundling');
            var bundled_dir         = join(tmp_dir, 'bundle');
          Severity: Minor
          Found in lib/app.js - About 1 hr to fix

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

              if(program.input && !fs.existsSync(program.input)) {
                console.error('input folder doesn\'t exist\n  ' + program.input);
                process.exit();
              }
            Severity: Major
            Found in bin/cli.js and 1 other location - About 1 hr to fix
            bin/cli.js on lines 154..157

            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

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

              if(program.input && !fs.existsSync(program.input)) {
                console.error('input folder doesn\'t exist\n  ' + program.input);
                process.exit();
              }
            Severity: Major
            Found in bin/cli.js and 1 other location - About 1 hr to fix
            bin/cli.js on lines 117..120

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

            function Socket($, logger){
              this.$ = $;
              this.log = require('../log')($, 'electrify:plugins:socket');
              
              this.name = 'socket';
            Severity: Minor
            Found in lib/plugins/socket.js - About 1 hr to fix

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

              NodeJS.prototype.start = function(done) {
                this.env = {
                  ELECTRIFY_VERSION     : this.$.env.version,
                  ELECTRIFY_API_VERSION : this.$.env.apiVersion,
                  ELECTRON_VERSION      : process.versions.electron,
              Severity: Minor
              Found in lib/plugins/nodejs.js - About 1 hr to fix

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

                  if(program.output && !fs.existsSync(program.output)) {
                    console.error('output folder doesn\'t exist\n  ' + program.output);
                    process.exit();
                  }
                Severity: Major
                Found in bin/cli.js and 1 other location - About 1 hr to fix
                bin/cli.js on lines 134..137

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

                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

                  if(program.temp && !fs.existsSync(program.temp)) {
                    console.error('temp folder doesn\'t exist\n  ' + program.temp);
                    process.exit();
                  }
                Severity: Major
                Found in bin/cli.js and 1 other location - About 1 hr to fix
                bin/cli.js on lines 129..132

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

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

                App.prototype.ensure_deps = function(done) {
                  this.log.info('ensuring electrify dependencies');
                  var npm_cmd = 'npm' + (this.$.env.os.is_windows ? '.cmd' : '');
                
                  // in development mode, use local electrify version
                Severity: Minor
                Found in lib/app.js - About 1 hr to fix

                  Function prepare has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  Scaffold.prototype.prepare = function() {
                  
                    this.log.info('ensuring basic structure');
                    
                    shell.mkdir('-p' , this.$.env.app.bin);
                  Severity: Minor
                  Found in lib/scaffold.js - About 1 hr to fix

                    Function electrify has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function electrify() {
                      var input;
                    
                      // validates input dir (app-root folder)
                      if(program.input && !fs.existsSync(program.input)) {
                    Severity: Minor
                    Found in bin/cli.js - About 1 hr to fix

                      Function start has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                      MongoDB.prototype.start = function(done) {
                        if (this.$.env.app.config.mongo) {
                          if (typeof this.$.env.app.config.mongo === 'object' && this.$.env.app.config.mongo.MONGO_URL) {
                            this.log.info('Use external MONGO_URL');
                            this.env.MONGO_URL = this.$.env.app.config.mongo.MONGO_URL;
                      Severity: Minor
                      Found in lib/plugins/mongodb.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

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

                      Log.prototype.trace = function(){
                        if(/TRACE|ALL/i.test(level()))
                          log(this.prefix, 'TRACE', slice(arguments));
                      };
                      Severity: Major
                      Found in lib/log.js and 4 other locations - About 50 mins to fix
                      lib/log.js on lines 20..23
                      lib/log.js on lines 25..28
                      lib/log.js on lines 30..33
                      lib/log.js on lines 35..38

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

                      Log.prototype.info = function(){
                        if(/INFO|ALL/i.test(level()))
                          log(this.prefix, 'INFO', slice(arguments));
                      };
                      Severity: Major
                      Found in lib/log.js and 4 other locations - About 50 mins to fix
                      lib/log.js on lines 25..28
                      lib/log.js on lines 30..33
                      lib/log.js on lines 35..38
                      lib/log.js on lines 40..43

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

                      Log.prototype.warn = function(){
                        if(/WARN|ALL/i.test(level()))
                          log(this.prefix, 'WARN', slice(arguments));
                      };
                      Severity: Major
                      Found in lib/log.js and 4 other locations - About 50 mins to fix
                      lib/log.js on lines 20..23
                      lib/log.js on lines 30..33
                      lib/log.js on lines 35..38
                      lib/log.js on lines 40..43

                      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

                      Severity
                      Category
                      Status
                      Source
                      Language