TOTVSTEC/cloudbridge-cli

View on GitHub

Showing 179 of 179 total issues

Function spawn has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function spawn(command, args, options) {
    var deferred = Q.defer();
    var child = child_process.spawn(command, args, options);
    var capturedOut = '';
    var capturedErr = '';
Severity: Minor
Found in src/utils/spawn.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 copyTemplate has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

Utils.copyTemplate = function copyTemplate(origin, to, data, extensions) {
    var files = fs.readdirSync(origin);

    extensions = extensions || /\.(prw|js|ts|coffe|css|less|scss|html|md|json|xml|java)/;

Severity: Minor
Found in src/utils/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 getWindowsEnvironmentInfo has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

Info.getWindowsEnvironmentInfo = function getWindowsEnvironmentInfo() {
    // Windows version reference
    // http://en.wikipedia.org/wiki/Ver_%28command%29
    var version = os.release();
    var windowsVersion = null;
Severity: Minor
Found in src/utils/info.js - About 1 hr to fix

    Function fetchWrapper has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        static fetchWrapper(options) {
            var pack = new Package('cloudbridge-core-ionic');
    
            return Q()
                .then(function() {
    Severity: Minor
    Found in src/tasks/ionic/start.js - About 1 hr to fix

      Function run has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          run(cloudbridge, argv) {
              var _this = this,
                  platforms = _this.getPlatforms(argv);
      
              if (platforms.length === 0) {
      Severity: Minor
      Found in src/tasks/ionic/platform-add.js - About 1 hr to fix

        Function fetchWrapper has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            static fetchWrapper(options) {
                var pack = new Package('cloudbridge-core-advpl');
        
                return Q()
                    .then(function() {
        Severity: Minor
        Found in src/tasks/default/start.js - About 1 hr to fix

          Function printInfo has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          Info.printInfo = function printInfo(info) {
              logging.logger.info('\nYour system information:\n'.bold);
          
              if (info.gulp) {
                  logging.logger.info('Gulp version:', info.gulp);
          Severity: Minor
          Found in src/utils/info.js - About 1 hr to fix

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

                static buildCordova() {
                    var { args, options } = this.parseAguments(...arguments);
            
                    return this.spawn(['cordova', 'build'].concat(args), options);
                }
            Severity: Major
            Found in src/utils/ionic.js and 1 other location - About 1 hr to fix
            src/utils/ionic.js on lines 48..52

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

            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

                static runCordova() {
                    var { args, options } = this.parseAguments(...arguments);
            
                    return this.spawn(['cordova', 'run'].concat(args), options);
                }
            Severity: Major
            Found in src/utils/ionic.js and 1 other location - About 1 hr to fix
            src/utils/ionic.js on lines 42..46

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

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

                static create() {
                    var { args, options } = this.parseAguments(...arguments);
            
                    return this.spawn(['create'].concat(args), options);
                }
            Severity: Major
            Found in src/utils/cordova.js and 3 other locations - About 1 hr to fix
            src/utils/cordova.js on lines 41..45
            src/utils/cordova.js on lines 47..51
            src/utils/npm.js on lines 7..11

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

                static run() {
                    var { args, options } = this.parseAguments(...arguments);
            
                    return this.spawn(['run'].concat(args), options);
                }
            Severity: Major
            Found in src/utils/cordova.js and 3 other locations - About 1 hr to fix
            src/utils/cordova.js on lines 35..39
            src/utils/cordova.js on lines 41..45
            src/utils/npm.js on lines 7..11

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

                static install() {
                    var { args, options } = this.parseAguments(...arguments);
            
                    return this.spawn(['install'].concat(args), options);
                }
            Severity: Major
            Found in src/utils/npm.js and 3 other locations - About 1 hr to fix
            src/utils/cordova.js on lines 35..39
            src/utils/cordova.js on lines 41..45
            src/utils/cordova.js on lines 47..51

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

                static build() {
                    var { args, options } = this.parseAguments(...arguments);
            
                    return this.spawn(['build'].concat(args), options);
                }
            Severity: Major
            Found in src/utils/cordova.js and 3 other locations - About 1 hr to fix
            src/utils/cordova.js on lines 35..39
            src/utils/cordova.js on lines 47..51
            src/utils/npm.js on lines 7..11

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

                run(cloudbridge, argv) {
                    var _this = this,
                        platforms = _this.getPlatforms(argv);
            
                    if (platforms.length === 0) {
            Severity: Minor
            Found in src/tasks/default/platform-remove.js - About 1 hr to fix

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

                  fixProjectV1() {
                      var project = this.project.data(),
                          components = project.components || {},
                          platform = project.platform || {};
              
              
              Severity: Minor
              Found in src/tasks/default/app-task.js - About 1 hr to fix

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

                    if (child.stdout) {
                        child.stdout.on('data', function(data) {
                            capturedOut += data;
                            deferred.notify({ 'stdout': data });
                        });
                Severity: Major
                Found in src/utils/spawn.js and 1 other location - About 1 hr to fix
                src/utils/spawn.js on lines 19..24

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

                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 (child.stderr) {
                        child.stderr.on('data', function(data) {
                            capturedErr += data;
                            deferred.notify({ 'stderr': data });
                        });
                Severity: Major
                Found in src/utils/spawn.js and 1 other location - About 1 hr to fix
                src/utils/spawn.js on lines 12..17

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

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

                    run(cloudbridge, argv) {
                        var project = this.project.data(),
                            packagePath = path.join(this.projectDir, 'build', project.name + '-debug.apk'),
                            opts = {
                                replace: true
                Severity: Minor
                Found in src/tasks/default/run-android.js - About 1 hr to fix

                  Function run has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      run(cloudbridge, argv) {
                          var _this = this,
                              platforms = _this.getPlatforms(argv);
                  
                          if (platforms.length === 0) {
                  Severity: Minor
                  Found in src/tasks/default/platform-add.js - About 1 hr to fix

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

                        fetch() {
                            var _this = this,
                                homeDir = process.env.HOME || process.env.USERPROFILE || process.env.HOMEPATH,
                                packageDir = path.join(homeDir, '.cloudbridge', 'packages', this.group, this.name),
                                url = 'https://github.com/' + this.group + '/' + this.name + '/archive/';
                    Severity: Minor
                    Found in src/utils/package.js - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language