valor-software/ng2-select

View on GitHub

Showing 13 of 28 total issues

File select.ts has 529 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {
  Component,
  Input,
  Output,
  EventEmitter,
Severity: Major
Found in components/select/select.ts - About 1 day to fix

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

      public inputEvent(e:any, isUpMode:boolean = false) {
        // tab
        if (e.keyCode === 9) {
          return;
        }
    Severity: Minor
    Found in components/select/select.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

    Function inputEvent has 63 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      public inputEvent(e:any, isUpMode:boolean = false) {
        // tab
        if (e.keyCode === 9) {
          return;
        }
    Severity: Major
    Found in components/select/select.ts - About 2 hrs to fix

      Function mainClick has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        private mainClick(e:any) {
          if (this.inputMode === true || this._disabled === true) {
            return;
          }
      
      
      Severity: Minor
      Found in components/select/select.ts - About 1 hr to fix

        Consider simplifying this complex logical expression.
        Open

            if (isUpMode && (e.keyCode === 37 || e.keyCode === 39 || e.keyCode === 38 ||
              e.keyCode === 40 || e.keyCode === 13)) {
              e.preventDefault();
              return;
            }
        Severity: Major
        Found in components/select/select.ts - About 40 mins to fix

          Function mainClick has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

            private mainClick(e:any) {
              if (this.inputMode === true || this._disabled === true) {
                return;
              }
          
          
          Severity: Minor
          Found in components/select/select.ts - About 35 mins 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

          Avoid too many return statements within this function.
          Open

                return;
          Severity: Major
          Found in components/select/select.ts - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                  return;
            Severity: Major
            Found in components/select/select.ts - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                    return;
              Severity: Major
              Found in components/select/select.ts - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                      return;
                Severity: Major
                Found in components/select/select.ts - About 30 mins to fix

                  Function ensureHighlightVisible has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    public ensureHighlightVisible(optionsMap:Map<string, number> = null) {
                      let container = this.actor.element.nativeElement.querySelector('.ui-select-choices-content');
                  
                      if (!container) {
                        return;
                  Severity: Minor
                  Found in components/select/select.ts - About 25 mins 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 selectMatch has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    private selectMatch(value:SelectItem, e:Event = null) {
                      if (e) {
                        e.stopPropagation();
                        e.preventDefault();
                      }
                  Severity: Minor
                  Found in components/select/select.ts - About 25 mins 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 constructor has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    constructor(source:any) {
                      if (typeof source === 'string') {
                        this.id = this.text = source;
                      }
                  
                  
                  Severity: Minor
                  Found in components/select/select-item.ts - About 25 mins 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

                  Severity
                  Category
                  Status
                  Source
                  Language