nikrolls/angular-nz-input-formats

View on GitHub

Showing 5 of 16 total issues

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

        protected formatter(output:string):string {
            if (!output) {
                return output;
            }

Severity: Minor
Found in src/nz-phone-number.directive.ts - 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

SimpleInputMask has 21 functions (exceeds 20 allowed). Consider refactoring.
Open

    export class SimpleInputMask {
        // Directive properties
        public require = 'ngModel';
        public restrict = 'A';
        public link: Function = null;
Severity: Minor
Found in src/simple-input-mask.directive.ts - About 2 hrs to fix

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

            protected formatter(output:string):string {
                if (!output) {
                    return output;
                }
    
    
    Severity: Minor
    Found in src/nz-phone-number.directive.ts - About 1 hr to fix

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

                          scope: angular.IScope, elem: angular.IAugmentedJQuery, attrs: angular.IAttributes,
                          ctrl: any, transclude: angular.ITranscludeFunction
      Severity: Minor
      Found in src/simple-input-mask.directive.ts - About 35 mins to fix

        Avoid too many return statements within this function.
        Open

                    return this.checksum(value);
        Severity: Major
        Found in src/nz-bank-number.directive.ts - About 30 mins to fix
          Severity
          Category
          Status
          Source
          Language