feigi/TemplatePrefetch

View on GitHub

Showing 11 of 11 total issues

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

        it('Service should resolve templateUrl functions', function () {
            currentStateMock.name = "state1";
            statesMap['state2'] = {
                templateUrl: function () {
                    return 'test-template.html'
Severity: Major
Found in src/test/template-prefetch.spec.js and 1 other location - About 4 hrs to fix
src/test/template-prefetch.spec.js on lines 297..312

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

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

        it('Service should resolve templateUrl functions', function () {
            currentStateMock.name = "state1";
            statesMap['state2'] = {
                templateUrl: function () {
                    return 'test-template.html'
Severity: Major
Found in src/test/template-prefetch.spec.js and 1 other location - About 4 hrs to fix
src/test/template-prefetch.spec.js on lines 314..329

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

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

module.exports = function (grunt) {
    // Add require for connect-modewrite
    var modRewrite = require('connect-modrewrite');

    // Define the configuration for all the tasks
Severity: Major
Found in Gruntfile.js - About 3 hrs to fix

    File template-prefetch.spec.js has 301 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /**
     * Created by zieglerc on 25/06/15.
     */
    describe('Template Prefetch Module', function () {
    
    
    Severity: Minor
    Found in src/test/template-prefetch.spec.js - About 3 hrs to fix

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

                      function ($rootScope, $state, $stateParams, $templateCache, $http, $log) {
      
                          $log.debug('TemplatePrefetch: Instantiated');
      
                          var prefetch = function (fromState, fromParams) {
      Severity: Major
      Found in src/main/template-prefetch.js - About 2 hrs to fix

        Function initMocks has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                var initMocks = function () {
        
                    rootScopeMock = {
                        $on: jasmine.createSpy('rootScope.on').and.callFake(function (event, callback) {
                            if (event === '$stateChangeSuccess') {
        Severity: Minor
        Found in src/test/template-prefetch.spec.js - About 1 hr to fix

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

          module.exports = function (config) {
              config.set({
          
                  // base path that will be used to resolve all patterns (eg. files, exclude)
                  basePath: '../..',
          Severity: Minor
          Found in src/test/karma.conf.js - About 1 hr to fix

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

                                var prefetch = function (fromState, fromParams) {
            
                                    $log.debug('TemplatePrefetch: Called with fromState ' + fromState + ', fromParams ' + JSON.stringify(fromParams));
            
                                    var edge = findRouteWithFrom(createNode(fromState, fromParams));
            Severity: Minor
            Found in src/main/template-prefetch.js - About 1 hr to fix

              Function $get has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                              function ($rootScope, $state, $stateParams, $templateCache, $http, $log) {
              Severity: Minor
              Found in src/main/template-prefetch.js - About 45 mins to fix

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

                            expect(testee.getRoutesFor('from')).toEqual([
                                {name: 'to1', stateParams: {i: 0}},
                                {name: 'to2'}
                            ]);
                Severity: Minor
                Found in src/test/template-prefetch.spec.js and 1 other location - About 40 mins to fix
                src/test/template-prefetch.spec.js on lines 103..106

                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

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

                            expect(testee.getRoutesFor('from')).toEqual([
                                {name: 'to1', stateParams: {i: 0}},
                                {name: 'to2'}
                            ]);
                Severity: Minor
                Found in src/test/template-prefetch.spec.js and 1 other location - About 40 mins to fix
                src/test/template-prefetch.spec.js on lines 92..95

                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

                Severity
                Category
                Status
                Source
                Language