Innqube/ng2-iq-select2

View on GitHub

Showing 7 of 15 total issues

IqSelect2Component has 36 functions (exceeds 20 allowed). Consider refactoring.
Open

@Component({
    selector: 'iq-select2',
    templateUrl: './iq-select2.component.html',
    styleUrls: ['./iq-select2.component.css'],
    providers: [VALUE_ACCESSOR]
Severity: Minor
Found in projects/ng2-iq-select2/src/lib/iq-select2/iq-select2.component.ts - About 4 hrs to fix

    File iq-select2.component.ts has 322 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import {AfterViewInit, Component, EventEmitter, forwardRef, Input, Output, TemplateRef, ViewChild} from '@angular/core';
    import {IqSelect2Item} from './iq-select2-item';
    import {IqSelect2ResultsComponent} from '../iq-select2-results/iq-select2-results.component';
    import {ControlValueAccessor, FormControl, NG_VALUE_ACCESSOR} from '@angular/forms';
    import {Messages} from './messages';
    Severity: Minor
    Found in projects/ng2-iq-select2/src/lib/iq-select2/iq-select2.component.ts - About 3 hrs to fix

      Function ngOnInit has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          ngOnInit() {
              this.form = this.formBuilder.group({
                  firstname: {
                      value: '',
                      disabled: true
      Severity: Minor
      Found in src/app/app.component.ts - About 1 hr to fix

        Function onKeyUp has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            onKeyUp(ev) {
                if (this.results) {
                    if (ev.keyCode === KEY_CODE_DOWN_ARROW) {
                        this.results.activeNext();
                    } else if (ev.keyCode === KEY_CODE_UP_ARROW) {
        Severity: Minor
        Found in projects/ng2-iq-select2/src/lib/iq-select2/iq-select2.component.ts - About 1 hr 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 exports has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        module.exports = function (config) {
            config.set({
                basePath: '',
                frameworks: ['jasmine', '@angular-devkit/build-angular'],
                plugins: [
        Severity: Minor
        Found in src/karma.conf.js - About 1 hr to fix

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

          module.exports = function (config) {
              config.set({
                  basePath: '',
                  frameworks: ['jasmine', '@angular-devkit/build-angular'],
                  plugins: [
          Severity: Minor
          Found in projects/ng2-iq-select2/karma.conf.js - About 1 hr to fix

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

                onKeyDown(ev) {
                    if (this.results) {
                        if (ev.keyCode === KEY_CODE_TAB) {
                            this.results.selectCurrentItem();
                        }
            Severity: Minor
            Found in projects/ng2-iq-select2/src/lib/iq-select2/iq-select2.component.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

            Severity
            Category
            Status
            Source
            Language