amercier/generator-angular-php

View on GitHub

Showing 28 of 28 total issues

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

  if (typeof this.env.options.appPath === 'undefined') {
    this.env.options.appPath = this.options.appPath;

    if (!this.env.options.appPath) {
      try {
Severity: Major
Found in decorator/index.js and 2 other locations - About 7 hrs to fix
view/index.js on lines 11..21
script-base.js on lines 22..32

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

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

  if (typeof this.env.options.appPath === 'undefined') {
    this.env.options.appPath = this.options.appPath;

    if (!this.env.options.appPath) {
      try {
Severity: Major
Found in view/index.js and 2 other locations - About 7 hrs to fix
decorator/index.js on lines 15..25
script-base.js on lines 22..32

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

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

  if (typeof this.env.options.appPath === 'undefined') {
    this.env.options.appPath = this.options.appPath;

    if (!this.env.options.appPath) {
      try {
Severity: Major
Found in script-base.js and 2 other locations - About 7 hrs to fix
decorator/index.js on lines 15..25
view/index.js on lines 11..21

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

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

var Generator = module.exports = function Generator(args, options) {
  yeoman.generators.Base.apply(this, arguments);
  this.argument('appname', { type: String, required: false });
  this.appname = this.appname || path.basename(process.cwd());
  this.appname = this._.camelize(this._.slugify(this._.humanize(this.appname)));
Severity: Major
Found in app/index.js - About 3 hrs to fix

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

    'use strict';
    var fs = require('fs');
    var path = require('path');
    var util = require('util');
    var angularUtils = require('../util.js');
    Severity: Minor
    Found in app/index.js - About 3 hrs to fix

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

      Generator.prototype.appTemplate = function (src, dest) {
        yeoman.generators.Base.prototype.template.apply(this, [
          src + this.scriptSuffix,
          path.join(this.env.options.appPath, dest.toLowerCase()) + this.scriptSuffix
        ]);
      Severity: Major
      Found in script-base.js and 1 other location - About 3 hrs to fix
      script-base.js on lines 75..80

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

      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

      Generator.prototype.testTemplate = function (src, dest) {
        yeoman.generators.Base.prototype.template.apply(this, [
          src + this.scriptSuffix,
          path.join(this.env.options.testPath, dest.toLowerCase()) + this.scriptSuffix
        ]);
      Severity: Major
      Found in script-base.js and 1 other location - About 3 hrs to fix
      script-base.js on lines 68..73

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

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

      module.exports = function (grunt) {
        require('load-grunt-tasks')(grunt);
      
        grunt.initConfig({
          pkg: require('./package.json'),
      Severity: Major
      Found in Gruntfile.js - About 2 hrs to fix

        Function askForModules has 66 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        Generator.prototype.askForModules = function askForModules() {
          var cb = this.async();
        
          var prompts = [{
            type: 'checkbox',
        Severity: Major
        Found in app/index.js - About 2 hrs to fix

          Function Generator has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

          var Generator = module.exports = function Generator() {
            yeoman.generators.NamedBase.apply(this, arguments);
          
            try {
              this.appname = require(path.join(process.cwd(), 'bower.json')).name;
          Severity: Minor
          Found in script-base.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 Generator has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          var Generator = module.exports = function Generator() {
            yeoman.generators.NamedBase.apply(this, arguments);
          
            try {
              this.appname = require(path.join(process.cwd(), 'bower.json')).name;
          Severity: Minor
          Found in script-base.js - About 1 hr to fix

            Function Generator has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

            var Generator = module.exports = function Generator(args, options) {
              yeoman.generators.Base.apply(this, arguments);
              this.argument('appname', { type: String, required: false });
              this.appname = this.appname || path.basename(process.cwd());
              this.appname = this._.camelize(this._.slugify(this._.humanize(this.appname)));
            Severity: Minor
            Found in app/index.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 rewriteAppJs has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            Generator.prototype.rewriteAppJs = function () {
              var coffee = this.env.options.coffee;
            
              if (!this.foundWhenForRoute) {
                this.on('end', function () {
            Severity: Minor
            Found in route/index.js - About 1 hr to fix

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

                        $http({method: 'GET', url: thing.href}).
                          success(function (data) {
                            thing.loading = false;
                            thing.description = data.description;
                          }).
              Severity: Minor
              Found in templates/javascript/controller.js and 1 other location - About 40 mins to fix
              templates/javascript/controller.js on lines 25..50

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

              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

                  $http({method: 'GET', url: '/api/features'}).
              
                    success(function (data) {
                      $scope.loading = false;
                      $scope.awesomeThings = data;
              Severity: Minor
              Found in templates/javascript/controller.js and 1 other location - About 40 mins to fix
              templates/javascript/controller.js on lines 35..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 49.

              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

              Generator.prototype.createControllerFiles = function createControllerFiles() {
                this.generateSourceAndTest(
                  'controller',
                  'spec/controller',
                  'controllers',
              Severity: Major
              Found in controller/index.js and 7 other locations - About 40 mins to fix
              constant/index.js on lines 12..19
              directive/index.js on lines 12..19
              factory/index.js on lines 12..19
              filter/index.js on lines 12..19
              provider/index.js on lines 12..19
              service/index.js on lines 12..19
              value/index.js on lines 12..19

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

              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

              Generator.prototype.createServiceFiles = function createServiceFiles() {
                this.generateSourceAndTest(
                  'service/service',
                  'spec/service',
                  'services',
              Severity: Major
              Found in service/index.js and 7 other locations - About 40 mins to fix
              constant/index.js on lines 12..19
              controller/index.js on lines 18..25
              directive/index.js on lines 12..19
              factory/index.js on lines 12..19
              filter/index.js on lines 12..19
              provider/index.js on lines 12..19
              value/index.js on lines 12..19

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

              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

              Generator.prototype.createDirectiveFiles = function createDirectiveFiles() {
                this.generateSourceAndTest(
                  'directive',
                  'spec/directive',
                  'directives',
              Severity: Major
              Found in directive/index.js and 7 other locations - About 40 mins to fix
              constant/index.js on lines 12..19
              controller/index.js on lines 18..25
              factory/index.js on lines 12..19
              filter/index.js on lines 12..19
              provider/index.js on lines 12..19
              service/index.js on lines 12..19
              value/index.js on lines 12..19

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

              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

              Generator.prototype.createServiceFiles = function createServiceFiles() {
                this.generateSourceAndTest(
                  'service/factory',
                  'spec/service',
                  'services',
              Severity: Major
              Found in factory/index.js and 7 other locations - About 40 mins to fix
              constant/index.js on lines 12..19
              controller/index.js on lines 18..25
              directive/index.js on lines 12..19
              filter/index.js on lines 12..19
              provider/index.js on lines 12..19
              service/index.js on lines 12..19
              value/index.js on lines 12..19

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

              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

              Generator.prototype.createServiceFiles = function createServiceFiles() {
                this.generateSourceAndTest(
                  'service/value',
                  'spec/service',
                  'services',
              Severity: Major
              Found in value/index.js and 7 other locations - About 40 mins to fix
              constant/index.js on lines 12..19
              controller/index.js on lines 18..25
              directive/index.js on lines 12..19
              factory/index.js on lines 12..19
              filter/index.js on lines 12..19
              provider/index.js on lines 12..19
              service/index.js on lines 12..19

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

              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