trailsjs/generator-node

View on GitHub

Showing 13 of 13 total issues

Function default has 67 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  default: function () {
    if (this.options.travis) {
      this.composeWith('travis', {}, {
        local: require.resolve('generator-travis/generators/app')
      });
Severity: Major
Found in generators/app/index.js - About 2 hrs to fix

    File index.js has 274 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    'use strict';
    var _ = require('lodash');
    var extend = _.merge;
    var generators = require('yeoman-generator');
    var parseAuthor = require('parse-author');
    Severity: Minor
    Found in generators/app/index.js - About 2 hrs to fix

      Function constructor has 57 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        constructor: function () {
          generators.Base.apply(this, arguments);
      
          this.option('travis', {
            type: Boolean,
      Severity: Major
      Found in generators/app/index.js - About 2 hrs to fix

        Function askFor has 48 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            askFor: function () {
              var prompts = [{
                name: 'description',
                message: 'Description',
                when: !this.props.description
        Severity: Minor
        Found in generators/app/index.js - About 1 hr to fix

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

              package: function () {
                var pkg = this.fs.readJSON(this.destinationPath(this.options.generateInto, 'package.json'), {});
          
                extend(pkg, {
                  devDependencies: {
          Severity: Minor
          Found in generators/gulp/index.js - About 1 hr to fix

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

                  this.composeWith('node:boilerplate', {
                    options: {
                      name: this.props.name,
                      babel: this.props.babel
                    }
            Severity: Major
            Found in generators/app/index.js and 1 other location - About 1 hr to fix
            generators/app/index.js on lines 253..260

            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

                this.composeWith('node:git', {
                  options: {
                    name: this.props.name,
                    githubAccount: this.props.githubAccount
                  }
            Severity: Major
            Found in generators/app/index.js and 1 other location - About 1 hr to fix
            generators/app/index.js on lines 276..283

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

              constructor: function () {
                generators.Base.apply(this, arguments);
            
                this.option('generateInto', {
                  type: String,
            Severity: Minor
            Found in generators/gulp/index.js - About 1 hr to fix

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

                    }, {
                      name: 'authorEmail',
                      message: 'Author\'s Email',
                      when: !this.props.authorEmail,
                      default: this.user.git.email(),
              Severity: Minor
              Found in generators/app/index.js and 1 other location - About 50 mins to fix
              generators/app/index.js on lines 134..140

              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

                    }, {
                      name: 'authorName',
                      message: 'Author\'s Name',
                      when: !this.props.authorName,
                      default: this.user.git.name(),
              Severity: Minor
              Found in generators/app/index.js and 1 other location - About 50 mins to fix
              generators/app/index.js on lines 140..146

              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

                  if (this.options.eslint !== false) {
                    this.composeWith('node:eslint', {
                      options: {
                        es2015: this.props.babel
                      }
              Severity: Minor
              Found in generators/app/index.js and 1 other location - About 50 mins to fix
              generators/app/index.js on lines 286..294

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

              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 (this.options.cli) {
                    this.composeWith('node:cli', {
                      options: {
                        babel: this.props.babel
                      }
              Severity: Minor
              Found in generators/app/index.js and 1 other location - About 50 mins to fix
              generators/app/index.js on lines 243..251

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

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

                default: function () {
                  if (this.options.travis) {
                    this.composeWith('travis', {}, {
                      local: require.resolve('generator-travis/generators/app')
                    });
              Severity: Minor
              Found in generators/app/index.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

              Severity
              Category
              Status
              Source
              Language