dustinspecker/generator-ng-poly

View on GitHub

Showing 28 of 28 total issues

Function prompting has 104 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  prompting() {
    this.log(yosay('Welcome to ngPoly!'));

    // ask for app name
    // get preferred langugaes
Severity: Major
Found in lib/app/index.js - About 4 hrs to fix

    Function writing has 75 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      async writing() {
        const config = await this.getConfig();
    
        const dependency = config.ngRoute ? 'ngRoute' : 'ui.router';
    
    
    Severity: Major
    Found in lib/route/index.js - About 3 hrs to fix

      Function copyFile has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

        async copyFile(type, component, dest, context) {
          const pluralComponent = component === 'factory' ? 'factories' : component + 's';
      
          let fileName, src;
      
      
      Severity: Minor
      Found in lib/genBase/index.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 askForModuleName has 64 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        askForModuleName(params) {
          const config = this.config
            , name = this.name
            , options = this.options;
      
      
      Severity: Major
      Found in lib/genBase/index.js - About 2 hrs to fix

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

          configuring() {
            // create a directory named `appName`
            this.destinationRoot(this.appName);
        
            // save config
        Severity: Major
        Found in lib/app/index.js - About 2 hrs to fix

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

          module.exports = genBase.extend({
            prompting() {
              return this.askForModuleName();
            },
          
          
          Severity: Major
          Found in lib/constant/index.js and 7 other locations - About 2 hrs to fix
          lib/controller/index.js on lines 5..16
          lib/decorator/index.js on lines 5..16
          lib/factory/index.js on lines 5..16
          lib/filter/index.js on lines 5..16
          lib/provider/index.js on lines 5..16
          lib/service/index.js on lines 5..16
          lib/value/index.js on lines 5..16

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

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

          module.exports = genBase.extend({
            prompting() {
              return this.askForModuleName();
            },
          
          
          Severity: Major
          Found in lib/value/index.js and 7 other locations - About 2 hrs to fix
          lib/constant/index.js on lines 5..16
          lib/controller/index.js on lines 5..16
          lib/decorator/index.js on lines 5..16
          lib/factory/index.js on lines 5..16
          lib/filter/index.js on lines 5..16
          lib/provider/index.js on lines 5..16
          lib/service/index.js on lines 5..16

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

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

          module.exports = genBase.extend({
            prompting() {
              return this.askForModuleName();
            },
          
          
          Severity: Major
          Found in lib/service/index.js and 7 other locations - About 2 hrs to fix
          lib/constant/index.js on lines 5..16
          lib/controller/index.js on lines 5..16
          lib/decorator/index.js on lines 5..16
          lib/factory/index.js on lines 5..16
          lib/filter/index.js on lines 5..16
          lib/provider/index.js on lines 5..16
          lib/value/index.js on lines 5..16

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

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

          module.exports = genBase.extend({
            prompting() {
              return this.askForModuleName();
            },
          
          
          Severity: Major
          Found in lib/provider/index.js and 7 other locations - About 2 hrs to fix
          lib/constant/index.js on lines 5..16
          lib/controller/index.js on lines 5..16
          lib/decorator/index.js on lines 5..16
          lib/factory/index.js on lines 5..16
          lib/filter/index.js on lines 5..16
          lib/service/index.js on lines 5..16
          lib/value/index.js on lines 5..16

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

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

          module.exports = genBase.extend({
            prompting() {
              return this.askForModuleName();
            },
          
          
          Severity: Major
          Found in lib/factory/index.js and 7 other locations - About 2 hrs to fix
          lib/constant/index.js on lines 5..16
          lib/controller/index.js on lines 5..16
          lib/decorator/index.js on lines 5..16
          lib/filter/index.js on lines 5..16
          lib/provider/index.js on lines 5..16
          lib/service/index.js on lines 5..16
          lib/value/index.js on lines 5..16

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

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

          module.exports = genBase.extend({
            prompting() {
              return this.askForModuleName();
            },
          
          
          Severity: Major
          Found in lib/controller/index.js and 7 other locations - About 2 hrs to fix
          lib/constant/index.js on lines 5..16
          lib/decorator/index.js on lines 5..16
          lib/factory/index.js on lines 5..16
          lib/filter/index.js on lines 5..16
          lib/provider/index.js on lines 5..16
          lib/service/index.js on lines 5..16
          lib/value/index.js on lines 5..16

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

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

          module.exports = genBase.extend({
            prompting() {
              return this.askForModuleName();
            },
          
          
          Severity: Major
          Found in lib/decorator/index.js and 7 other locations - About 2 hrs to fix
          lib/constant/index.js on lines 5..16
          lib/controller/index.js on lines 5..16
          lib/factory/index.js on lines 5..16
          lib/filter/index.js on lines 5..16
          lib/provider/index.js on lines 5..16
          lib/service/index.js on lines 5..16
          lib/value/index.js on lines 5..16

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

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

          module.exports = genBase.extend({
            prompting() {
              return this.askForModuleName();
            },
          
          
          Severity: Major
          Found in lib/filter/index.js and 7 other locations - About 2 hrs to fix
          lib/constant/index.js on lines 5..16
          lib/controller/index.js on lines 5..16
          lib/decorator/index.js on lines 5..16
          lib/factory/index.js on lines 5..16
          lib/provider/index.js on lines 5..16
          lib/service/index.js on lines 5..16
          lib/value/index.js on lines 5..16

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

          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 findRoutesFile(routesPath) {
              const routesFile = await findFile(routesPath, true);
          
              if (routesFile.indexOf('-routes') === -1) {
                console.log(chalk.red('Routes file names without a `-routes` prefix are deprecated. Official support will be ' +
          Severity: Major
          Found in lib/utils/module.js and 1 other location - About 1 hr to fix
          lib/utils/module.js on lines 131..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 72.

          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 findModuleFile(modulePath) {
              const moduleFile = await findFile(modulePath, false);
          
              if (moduleFile.indexOf('-module') === -1) {
                console.log(chalk.red('Module file names without a `-module` prefix are deprecated. Official support will be ' +
          Severity: Major
          Found in lib/utils/module.js and 1 other location - About 1 hr to fix
          lib/utils/module.js on lines 147..156

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

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

            async getConfig() {
              const config = {
                name: this.name,
                markup: this.options.markup || this.config.get('markup'),
                appScript: this.options['app-script'] || this.config.get('appScript'),
          Severity: Minor
          Found in lib/genBase/index.js - About 1 hr to fix

            Function copyFile has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              async copyFile(type, component, dest, context) {
                const pluralComponent = component === 'factory' ? 'factories' : component + 's';
            
                let fileName, src;
            
            
            Severity: Minor
            Found in lib/genBase/index.js - About 1 hr to fix

              Function analyzeLines has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const analyzeLines = (lines, config) => {
                const newRoute = config.ngRoute ? 'when' : 'state';
              
                let braceCount = 0;
              
              
              Severity: Minor
              Found in lib/utils/route.js - About 1 hr to fix

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

                      if (this.module.charAt(this.module.length - 1) === '/' || this.module.charAt(this.module.length - 1) === '\\') {
                        this.module = this.module.slice(0, this.module.length - 1);
                      }
                Severity: Major
                Found in lib/genBase/index.js and 1 other location - About 1 hr to fix
                lib/module/index.js on lines 20..22

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

                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 (this.module.charAt(this.module.length - 1) === '/' || this.module.charAt(this.module.length - 1) === '\\') {
                      this.module = this.module.slice(0, this.module.length - 1);
                    }
                Severity: Major
                Found in lib/module/index.js and 1 other location - About 1 hr to fix
                lib/genBase/index.js on lines 82..84

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

                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