CautemocSg/ng-ip-address

View on GitHub

Showing 10 of 10 total issues

Function ngIpAddress has 125 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function ngIpAddress() {
        return {
            restrict: 'A',
            require: '?ngModel',
            scope: {
Severity: Major
Found in src/ngIpAddress.js - About 5 hrs to fix

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

                link: function(scope, element, attrs, ngModelCtrl) {
                    if (!ngModelCtrl) {
                        return;
                    }
    
    
    Severity: Major
    Found in src/ngIpAddress.js - About 4 hrs to fix

      Function ngIpAddress has 80 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function ngIpAddress() {
              return {
                  restrict: 'A',
                  require: '?ngModel',
                  link: function(scope, element, attrs, ngModelCtrl) {
      Severity: Major
      Found in src/ngIpAddress.vanilla.js - About 3 hrs to fix

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

                    link: function(scope, element, attrs, ngModelCtrl) {
                        if (!ngModelCtrl) {
                            return;
                        }
        
        
        Severity: Major
        Found in src/ngIpAddress.vanilla.js - About 2 hrs to fix

          Consider simplifying this complex logical expression.
          Open

                              if ((event.which < 46 && event.which !== 0 && event.which !== 8 && event.which !== 13)
                                  || event.which === 47
                                  || (event.which === 58 && !allowPort)
                                  || event.which > 58 && !(ctrlDown && (event.which === 99 || event.which === 118 || event.which === 120))) {
                                  // Stop key press from propagating
          Severity: Critical
          Found in src/ngIpAddress.js - About 2 hrs to fix

            Function evalInput has 62 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                            function evalInput(val) {
                                // If val is falsey (undefined, empty string, etc)...
                                if (!val) {
                                    // Set the field validity to true since it should be the responsibility of 'required' to stop blank entries
                                    ngModelCtrl.$setValidity('ipAddress', true);
            Severity: Major
            Found in src/ngIpAddress.js - About 2 hrs to fix

              Consider simplifying this complex logical expression.
              Open

                                  if ((event.which < 46 && event.which !== 0 && event.which !== 8 && event.which !== 13)
                                      || event.which === 47
                                      || event.which > 57 && !(ctrlDown && (event.which === 99 || event.which === 118 || event.which === 120))) {
                                      // Stop key press from propagating
                                      event.preventDefault();
              Severity: Critical
              Found in src/ngIpAddress.vanilla.js - About 2 hrs to fix

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

                                function evalInput(val) {
                                    // If val is falsy (undefined, empty string, etc)...
                                    if (!val) {
                                        // Set the field validity to true since it should be the responsibility of 'required' to stop blank entries
                                        ngModelCtrl.$setValidity('ipAddress', true);
                Severity: Minor
                Found in src/ngIpAddress.vanilla.js - About 1 hr to fix

                  Avoid deeply nested control flow statements.
                  Open

                                                      if (!port || !isNumeric(arrayVal) || port > 65535) {
                                                          // Set validity tracker to false
                                                          validationResult = false;
                                                      }
                  Severity: Major
                  Found in src/ngIpAddress.js - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                                    else if (requirePort) {
                                                        // Set validity tracker to false
                                                        validationResult = false;
                                                    }
                    Severity: Major
                    Found in src/ngIpAddress.js - About 45 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language