CautemocSg/ng-ip-address

View on GitHub
src/ngIpAddress.js

Summary

Maintainability
D
2 days
Test Coverage

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

      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

          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

              There are no issues that match your filters.

              Category
              Status