netceteragroup/valdr

View on GitHub

Showing 15 of 72 total issues

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

module.exports = function (grunt) {

  require('load-grunt-tasks')(grunt);

  grunt.initConfig({
Severity: Major
Found in Gruntfile.js - About 5 hrs to fix

    File valdrMessage-directive.spec.js has 315 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    describe('valdrMessage input directive', function () {
    
      var $scope, $compile;
    
      beforeEach(module('valdr'));
    Severity: Minor
    Found in src/message/valdrMessage-directive.spec.js - About 3 hrs to fix

      Function valdrFormItemDirectiveDefinitionFactory has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

      var valdrFormItemDirectiveDefinitionFactory = function (restrict) {
          return ['valdrEvents', 'valdr', 'valdrUtil', function (valdrEvents, valdr, valdrUtil) {
            return {
              restrict: restrict,
              require: ['?^valdrType', '?^ngModel', '?^valdrFormGroup', '?^valdrEnabled'],
      Severity: Minor
      Found in src/core/valdrFormItem-directive.js - About 3 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 $get has 82 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              function ($log, $injector, $rootScope, $http, valdrEvents, valdrUtil, valdrClasses) {
      
                // inject all validators
                angular.forEach(validatorNames, function (validatorName) {
                  var validator = $injector.get(validatorName);
      Severity: Major
      Found in src/core/valdr-service.js - About 3 hrs to fix

        Function valdrFormGroupDirectiveDefinition has 71 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          ['valdrClasses', 'valdrConfig', function (valdrClasses, valdrConfig) {
            return  {
              restrict: 'EA',
              link: function (scope, element) {
                if (valdrConfig.addFormGroupClass) {
        Severity: Major
        Found in src/core/valdrFormGroup-directive.js - About 2 hrs to fix

          Function link has 64 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                link: function (scope, element, attrs, controllers) {
                  var formController = controllers[0],
                    valdrTypeController = controllers[1] || nullValdrType;
          
                  var updateTranslations = function () {
          Severity: Major
          Found in src/message/valdrMessage-directive.js - About 2 hrs to fix

            Function controller has 61 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  controller: ['$scope', '$element', function ($scope, $element) {
            
                    var formItems = [],
                      messageElements = {};
            
            
            Severity: Major
            Found in src/core/valdrFormGroup-directive.js - About 2 hrs to fix

              Function valdrFormItemDirectiveDefinitionFactory has 57 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              var valdrFormItemDirectiveDefinitionFactory = function (restrict) {
                  return ['valdrEvents', 'valdr', 'valdrUtil', function (valdrEvents, valdr, valdrUtil) {
                    return {
                      restrict: restrict,
                      require: ['?^valdrType', '?^ngModel', '?^valdrFormGroup', '?^valdrEnabled'],
              Severity: Major
              Found in src/core/valdrFormItem-directive.js - About 2 hrs to fix

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

                    this.$get = ['$templateCache', '$injector', function ($templateCache, $injector) {
                
                      var angularMessagesEnabled = false;
                
                      function getTranslateService() {
                Severity: Minor
                Found in src/message/valdrMessage-service.js - About 1 hr to fix

                  Function link has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          link: function (scope, element, attrs, controllers) {
                  
                            var valdrTypeController = controllers[0],
                              ngModelController = controllers[1],
                              valdrFormGroupController = controllers[2] || nullValdrFormGroupController,
                  Severity: Minor
                  Found in src/core/valdrFormItem-directive.js - About 1 hr to fix

                    Function runFormItemCommonTests has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      function runFormItemCommonTests() {
                        it('should set the validity to false on ngModelController if validation fails', function () {
                          // when
                          $scope.$apply(function () {
                            $scope.myObject.field = 'invalid';
                    Severity: Minor
                    Found in src/core/valdrFormItem-directive.spec.js - About 1 hr to fix

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

                                  validate: function (typeName, fieldName, value) {
                      
                                    var validResult = { valid: true },
                                      typeConstraints = constraintsForType(typeName);
                      
                      
                      Severity: Minor
                      Found in src/core/valdr-service.js - About 1 hr to fix

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

                          ['valdrClasses', 'valdrConfig', function (valdrClasses, valdrConfig) {
                            return  {
                              restrict: 'EA',
                              link: function (scope, element) {
                                if (valdrConfig.addFormGroupClass) {
                        Severity: Minor
                        Found in src/core/valdrFormGroup-directive.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 33 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        module.exports = function (config) {
                          config.set({
                        
                            basePath: '',
                        
                        
                        Severity: Minor
                        Found in karma.conf.js - About 1 hr to fix

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

                                  function ($log, $injector, $rootScope, $http, valdrEvents, valdrUtil, valdrClasses) {
                          Severity: Major
                          Found in src/core/valdr-service.js - About 50 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language