500tech/angular-kick

View on GitHub

Showing 37 of 37 total issues

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

module.exports = function (name, options) {
  name = Utils.ensureName('service', name);

  let subdirectories = name.split('/');
  name = subdirectories.pop();
Severity: Major
Found in lib/generators/service.js and 1 other location - About 2 days to fix
lib/generators/model.js on lines 15..59

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

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

module.exports = function (name, options) {
  name = Utils.ensureName('model', name);

  let subdirectories = name.split('/');
  name = subdirectories.pop();
Severity: Major
Found in lib/generators/model.js and 1 other location - About 2 days to fix
lib/generators/service.js on lines 15..57

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

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

module.exports = function (name) {
  name = Utils.ensureName('model', name);

  let subdirectories = name.split('/');
  name = subdirectories.pop();
Severity: Major
Found in lib/destroyers/model.js and 1 other location - About 1 day to fix
lib/destroyers/service.js on lines 14..45

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

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

module.exports = function (name) {
  name = Utils.ensureName('service', name);

  let subdirectories = name.split('/');
  name = subdirectories.pop();
Severity: Major
Found in lib/destroyers/service.js and 1 other location - About 1 day to fix
lib/destroyers/model.js on lines 14..45

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

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

module.exports = function (name, noController, abstract) {
  name = Utils.ensureName('state', name);

  const stateList = name.split('/');
  const rootState = Format.toFolderName(stateList.shift());
Severity: Major
Found in lib/generators/state.js - About 3 hrs to fix

    exports has 28 functions (exceeds 20 allowed). Consider refactoring.
    Open

    module.exports = class Templates {
    
      static directive(locals /* { directiveName } */) {
        return angularTemplate('directive', locals);
      }
    Severity: Minor
    Found in lib/templates.js - About 3 hrs to fix

      Function generateState has 70 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        function generateState (stateName) {
          const parents             = stateName.split('.');
          const stateControllerName = Format.toConstName(stateName);
          stateName                 = Format.toFolderName(parents.pop());
          const statePath           = Format.parentPath(parents) + stateName + '/';
      Severity: Major
      Found in lib/generators/state.js - About 2 hrs to fix

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

            if (parents.length) {
              fullStateName = Format.parentState(parents) + '.' + stateName;
              switch (stateName) {
                case 'list':
                  stateURL = '';
        Severity: Major
        Found in lib/destroyers/state.js and 1 other location - About 2 hrs to fix
        lib/generators/state.js on lines 51..66

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

        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 (parents.length) {
              fullStateName = Format.parentState(parents) + '.' + stateName;
              switch (stateName) {
                case 'list':
                  stateURL = '';
        Severity: Major
        Found in lib/generators/state.js and 1 other location - About 2 hrs to fix
        lib/destroyers/state.js on lines 46..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 87.

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

        module.exports = function (name) {
          name = Utils.ensureName('state', name);
        
          const parentStates  = name.split('/');
          const rootState     = Format.toFolderName(parentStates.shift());
        Severity: Major
        Found in lib/destroyers/state.js - About 2 hrs to fix

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

          function directive(name, args, opts) {
            const template = (opts.template || opts.t);
          
            generate.directive(name, template);
            args.map((otherName) => generate.directive(otherName, template));
          Severity: Major
          Found in lib/commands/generate.js and 1 other location - About 2 hrs to fix
          lib/commands/generate.js on lines 88..94

          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

          function partial(name, args, opts) {
            const controller = (opts.controller || opts.c);
          
            generate.partial(name, controller);
            args.map((otherName) => generate.partial(otherName, controller));
          Severity: Major
          Found in lib/commands/generate.js and 1 other location - About 2 hrs to fix
          lib/commands/generate.js on lines 62..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 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

          Function exports has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

          module.exports = function (name, noController, abstract) {
            name = Utils.ensureName('state', name);
          
            const stateList = name.split('/');
            const rootState = Format.toFolderName(stateList.shift());
          Severity: Minor
          Found in lib/generators/state.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 exports has 46 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          module.exports = function () {
            const type = process.argv[3];
            const name = process.argv[4];
          
            process.argv.splice(0,5);
          Severity: Minor
          Found in lib/commands/generate.js - About 1 hr to fix

            Function destroyState has 44 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              function destroyState (stateName) {
                const parents             = stateName.split('.');
                const stateControllerName = Format.toConstName(stateName);
                stateName                 = Format.toFolderName(parents.pop());
                const statePath           = Format.parentPath(parents) + stateName + '/';
            Severity: Minor
            Found in lib/destroyers/state.js - About 1 hr to fix

              Function exports has 43 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              module.exports = function () {
                const type = process.argv[3];
                const name = process.argv[4];
              
                process.argv.splice(0,5);
              Severity: Minor
              Found in lib/commands/destroy.js - About 1 hr to fix

                Function exports has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                module.exports = (config) => {
                  config.set({
                    basePath: '',
                
                    plugins: [
                Severity: Minor
                Found in templates/angular/app/karma.conf.js - About 1 hr to fix

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

                  module.exports = function () {
                    let appName = Format.toConstName(process.argv[3]);
                    let noSetup = (process.argv[4] || '').toLowerCase();
                  
                    noSetup = (noSetup === '--no-setup' || noSetup === '-ns');
                  Severity: Minor
                  Found in lib/commands/new.js - About 1 hr to fix

                    Function exports has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    module.exports = function () {
                      const term = process.argv[3];
                    
                      switch (term) {
                        case 'about':
                    Severity: Minor
                    Found in lib/commands/help.js - About 1 hr to fix

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

                      module.exports = function (name, template) {
                        name = Utils.ensureName('directive', name);
                      
                        let subdirectories = name.split('/');
                        name = subdirectories.pop();
                      Severity: Minor
                      Found in lib/generators/directive.js - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language