Innqube/ngx-iq-datepicker

View on GitHub

Showing 7 of 41 total issues

File iq-datepicker.component.spec.ts has 283 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {async, ComponentFixture, fakeAsync, TestBed, tick} from '@angular/core/testing';

import {IqDatepickerComponent} from './iq-datepicker.component';
import {FormBuilder, FormGroup, ReactiveFormsModule} from '@angular/forms';
import {IqDatepickerEnglishTranslation} from './iq-datepicker-english-translation';

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

    @Component({
        selector: 'iq-datepicker',
        templateUrl: './iq-datepicker.component.html',
        styleUrls: ['./iq-datepicker.component.css'],
        providers: [VALUE_ACCESSOR]

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

      @Component({
          selector: 'iq-calendar',
          templateUrl: './iq-calendar.component.html',
          styleUrls: ['./iq-calendar.component.css']
      })

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

            ngOnInit() {
                this.setDefaults();
                this.buildDateMask();
                this.selectedDateInput
                    .valueChanges

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

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

            Function dateToString has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                private dateToString(date: Date): string {
                    if (date) {
                        let dateStr: string = this.getDateFormat();
                        const month = date.getMonth() + 1;
                        const day = date.getDate();

            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 completeValuesAndHide has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                private completeValuesAndHide(event: any) {
                    const textInput = this.selectedDateInput.value;
            
                    if (textInput) {
                        const year = textInput.substring(this.yearIndex, this.yearIndex + 4);

            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