CautemocSg/ng-ip-address

View on GitHub
src/ngIpAddress.vanilla.js

Summary

Maintainability
C
1 day
Test Coverage

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

          There are no issues that match your filters.

          Category
          Status