preston/bittorious

View on GitHub
lib/assets/bower_components/angular-translate/angular-translate.js

Summary

Maintainability
F
2 wks
Test Coverage

Function $translate has 917 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function $translate($STORAGE_KEY, $windowProvider, $translateSanitizationProvider, pascalprechtTranslateOverrider) {

  'use strict';

  var $translationTable = {},
Severity: Major
Found in lib/assets/bower_components/angular-translate/angular-translate.js - About 4 days to fix

    File angular-translate.js has 1340 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*!
     * angular-translate - v2.7.2 - 2015-06-01
     * http://github.com/angular-translate/angular-translate
     * Copyright (c) 2015 ; Licensed MIT
     */
    Severity: Major
    Found in lib/assets/bower_components/angular-translate/angular-translate.js - About 3 days to fix

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

          function ($log, $injector, $rootScope, $q) {
      
            var Storage,
                defaultInterpolator = $injector.get($interpolationFactory || '$translateDefaultInterpolation'),
                pendingLoader = false,
      Severity: Major
      Found in lib/assets/bower_components/angular-translate/angular-translate.js - About 2 days to fix

        Function translateDirective has 169 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function translateDirective($translate, $q, $interpolate, $compile, $parse, $rootScope) {
        
          'use strict';
        
          /**
        Severity: Major
        Found in lib/assets/bower_components/angular-translate/angular-translate.js - About 6 hrs to fix

          Function compile has 159 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              compile: function (tElement, tAttr) {
          
                var translateValuesExist = (tAttr.translateValues) ?
                  tAttr.translateValues : undefined;
          
          
          Severity: Major
          Found in lib/assets/bower_components/angular-translate/angular-translate.js - About 6 hrs to fix

            Function linkFn has 150 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  return function linkFn(scope, iElement, iAttr) {
            
                    scope.interpolateParams = {};
                    scope.preText = '';
                    scope.postText = '';
            Severity: Major
            Found in lib/assets/bower_components/angular-translate/angular-translate.js - About 6 hrs to fix

              Function $translateSanitizationProvider has 112 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function $translateSanitizationProvider () {
              
                'use strict';
              
                var $sanitize,
              Severity: Major
              Found in lib/assets/bower_components/angular-translate/angular-translate.js - About 4 hrs to fix

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

                      var $translate = function (translationId, interpolateParams, interpolationId, defaultTranslationText) {
                
                        // Duck detection: If the first argument is an array, a bunch of translations was requested.
                        // The result is an object.
                        if (angular.isArray(translationId)) {
                Severity: Major
                Found in lib/assets/bower_components/angular-translate/angular-translate.js - About 2 hrs to fix

                  Function refresh has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        $translate.refresh = function (langKey) {
                          if (!$loaderFactory) {
                            throw new Error('Couldn\'t refresh translation table, no loader registered!');
                          }
                  
                  
                  Severity: Minor
                  Found in lib/assets/bower_components/angular-translate/angular-translate.js - About 2 hrs to fix

                    Function instant has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                          $translate.instant = function (translationId, interpolateParams, interpolationId) {
                    
                            // Detect undefined and null values to shorten the execution and prevent exceptions
                            if (translationId === null || angular.isUndefined(translationId)) {
                              return translationId;
                    Severity: Minor
                    Found in lib/assets/bower_components/angular-translate/angular-translate.js - About 1 hr to fix

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

                            var loadAsync = function (key) {
                              if (!key) {
                                throw 'No language key specified for loading.';
                              }
                      
                      
                      Severity: Minor
                      Found in lib/assets/bower_components/angular-translate/angular-translate.js - About 1 hr to fix

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

                          this.$get = ['$injector', '$log', function ($injector, $log) {
                        
                            var applyStrategies = function (value, mode, selectedStrategies) {
                              angular.forEach(selectedStrategies, function (selectedStrategy) {
                                if (angular.isFunction(selectedStrategy)) {
                        Severity: Minor
                        Found in lib/assets/bower_components/angular-translate/angular-translate.js - About 1 hr to fix

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

                                $translate.use = function (key) {
                                  if (!key) {
                                    return $uses;
                                  }
                          
                          
                          Severity: Minor
                          Found in lib/assets/bower_components/angular-translate/angular-translate.js - About 1 hr to fix

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

                                  var determineTranslation = function (translationId, interpolateParams, interpolationId, defaultTranslationText) {
                            
                                    var deferred = $q.defer();
                            
                                    var table = $uses ? $translationTable[$uses] : $translationTable,
                            Severity: Minor
                            Found in lib/assets/bower_components/angular-translate/angular-translate.js - About 1 hr to fix

                              Function negotiateLocale has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                var negotiateLocale = function (preferred) {
                              
                                  var avail = [],
                                      locale = angular.lowercase(preferred),
                                      i = 0,
                              Severity: Minor
                              Found in lib/assets/bower_components/angular-translate/angular-translate.js - About 1 hr to fix

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

                                      var determineTranslationInstant = function (translationId, interpolateParams, interpolationId) {
                                
                                        var result, table = $uses ? $translationTable[$uses] : $translationTable,
                                            Interpolator = defaultInterpolator;
                                
                                
                                Severity: Minor
                                Found in lib/assets/bower_components/angular-translate/angular-translate.js - About 1 hr to fix

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

                                  function translateDirective($translate, $q, $interpolate, $compile, $parse, $rootScope) {
                                  Severity: Minor
                                  Found in lib/assets/bower_components/angular-translate/angular-translate.js - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                                    if (!langPromises[$fallbackLanguage[i]]) {
                                                      langPromises[$fallbackLanguage[i]] = loadAsync($fallbackLanguage[i]);
                                                    }
                                    Severity: Major
                                    Found in lib/assets/bower_components/angular-translate/angular-translate.js - About 45 mins to fix

                                      Function resolveForFallbackLanguage has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                      Open

                                            var resolveForFallbackLanguage = function (fallbackLanguageIndex, translationId, interpolateParams, Interpolator, defaultTranslationText) {
                                      Severity: Minor
                                      Found in lib/assets/bower_components/angular-translate/angular-translate.js - About 35 mins to fix

                                        Function updateTranslation has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                        Open

                                                var updateTranslation = function(translateAttr, translationId, scope, interpolateParams, defaultTranslationText) {
                                        Severity: Minor
                                        Found in lib/assets/bower_components/angular-translate/angular-translate.js - About 35 mins to fix

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

                                                  bcp47: function (tag) {
                                                    var temp = (tag || '').split('_').join('-');
                                                    var parts = temp.split('-');
                                                    return parts.length > 1 ? (parts[0].toLowerCase() + '-' + parts[1].toUpperCase()) : temp;
                                                  }
                                          lib/assets/bower_components/angular-translate/angular-translate.js on lines 359..363

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

                                          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

                                                  java: function (tag) {
                                                    var temp = (tag || '').split('-').join('_');
                                                    var parts = temp.split('_');
                                                    return parts.length > 1 ? (parts[0].toLowerCase() + '_' + parts[1].toUpperCase()) : temp;
                                                  },
                                          lib/assets/bower_components/angular-translate/angular-translate.js on lines 364..368

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

                                          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.statefulFilter = function (state) {
                                              if (state === undefined) {
                                                // getter
                                                return statefulFilter;
                                              } else {
                                          lib/assets/bower_components/angular-translate/angular-translate.js on lines 1204..1213

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

                                          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.directivePriority = function (priority) {
                                              if (priority === undefined) {
                                                // getter
                                                return directivePriority;
                                              } else {
                                          lib/assets/bower_components/angular-translate/angular-translate.js on lines 1229..1238

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

                                          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

                                          There are no issues that match your filters.

                                          Category
                                          Status