valor-software/angular2-bootstrap

View on GitHub

Showing 272 of 791 total issues

Function configFromISO has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

export function configFromISO(config: DateParsingConfig): DateParsingConfig {
  if (!isString(config._i)) {
    return config;
  }

Severity: Minor
Found in src/chronos/create/from-string.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 convertDuration has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

function convertDuration(input: any, key: string): Partial<DateObject> {
  // checks for null or undefined
  if (input == null) {
    return {};
  }
Severity: Minor
Found in src/chronos/duration/create.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 processRelativeTime has 79 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function processRelativeTime(number: number, withoutSuffix: boolean, key: string, isFuture: boolean): string {
  var result = number + ' ';
  switch (key) {
    case 's':
      return withoutSuffix || isFuture ? 'nekaj sekund' : 'nekaj sekundami';
Severity: Major
Found in src/chronos/i18n/sl.ts - About 3 hrs to fix

    Function relativeTime has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

    export function relativeTime(posNegDuration: Duration, withoutSuffix: boolean, locale: Locale): string {
      const duration = createDuration(posNegDuration).abs();
      const seconds = round(duration.as('s'));
      const minutes = round(duration.as('m'));
      const hours = round(duration.as('h'));
    Severity: Minor
    Found in src/chronos/duration/humanize.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 configFromStringAndFormat has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

    export function configFromStringAndFormat(config: DateParsingConfig): DateParsingConfig {
      // TODO: Move this to another part of the creation flow to prevent circular deps
      if (config._f === ISO_8601) {
        return configFromISO(config);
      }
    Severity: Minor
    Found in src/chronos/create/from-string-and-format.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

    Consider simplifying this complex logical expression.
    Open

      if (config._isValid == null) {
        const flags = getParsingFlags(config);
        const parsedParts = Array.prototype.some.call(flags.parsedDateParts, function (i: number) {
          return i != null;
        });
    Severity: Critical
    Found in src/chronos/create/valid.ts - About 3 hrs to fix

      Function timepickerControls has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

      export function timepickerControls(
        value: Date,
        state: TimepickerComponentState
      ): TimepickerControls {
        const hoursPerDayHalf = 12;
      Severity: Minor
      Found in src/timepicker/timepicker-controls.util.ts - About 2 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 configFromArray has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

      export function configFromArray(config: DateParsingConfig): DateParsingConfig {
        const input = [];
        let i;
        let date;
        let currentDate;
      Severity: Minor
      Found in src/chronos/create/from-array.ts - About 2 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

      File timepicker.component.ts has 282 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /* tslint:disable:no-forward-ref max-file-line-count */
      import {
        ChangeDetectionStrategy,
        ChangeDetectorRef,
        Component,
      Severity: Minor
      Found in src/timepicker/timepicker.component.ts - About 2 hrs to fix

        Function timepickerReducer has 69 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function timepickerReducer(state = initialState, action: Action) {
          switch (action.type) {
            case TimepickerActions.WRITE_VALUE: {
              return Object.assign({}, state, { value: action.payload });
            }
        Severity: Major
        Found in src/timepicker/reducer/timepicker.reducer.ts - About 2 hrs to fix

          File component-loader.class.ts has 278 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          // tslint:disable:max-file-line-count
          // todo: add delay support
          // todo: merge events onShow, onShown, etc...
          // todo: add global positioning configuration?
          import {
          Severity: Minor
          Found in src/component-loader/component-loader.class.ts - About 2 hrs to fix

            Consider simplifying this complex logical expression.
            Open

              if (a && getParsingFlags(config).overflow === -2) {
                // todo: fix this sh*t
                overflow =
                  a[MONTH] < 0 || a[MONTH] > 11 ? MONTH :
                    a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE :
            Severity: Critical
            Found in src/chronos/create/check-overflow.ts - About 2 hrs to fix

              Function handleWeekStrictParse has 66 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                private handleWeekStrictParse(weekdayName: string, format: string, strict: boolean): number {
                  let ii;
                  const llc = weekdayName.toLocaleLowerCase();
                  if (!this._weekdaysParse) {
                    this._weekdaysParse = [];
              Severity: Major
              Found in src/chronos/locale/locale.class.ts - About 2 hrs to fix

                Function flagDaysCalendar has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function flagDaysCalendar(
                  formattedMonth: DaysCalendarViewModel,
                  options: FlagDaysCalendarOptions
                ): DaysCalendarViewModel {
                  formattedMonth.weeks.forEach((week: WeekViewModel, weekIndex: number) => {
                Severity: Major
                Found in src/datepicker/engine/flag-days-calendar.ts - About 2 hrs to fix

                  File bs-datepicker.reducer.ts has 275 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  // tslint:disable:max-file-line-count
                  import { BsDatepickerState, initialDatepickerState } from './bs-datepicker.state';
                  import { Action } from '../../mini-ngrx/index';
                  import { BsDatepickerActions } from './bs-datepicker.actions';
                  import { calcDaysCalendar } from '../engine/calc-days-calendar';
                  Severity: Minor
                  Found in src/datepicker/reducer/bs-datepicker.reducer.ts - About 2 hrs to fix

                    TimepickerComponent has 23 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    @Component({
                      selector: 'timepicker',
                      changeDetection: ChangeDetectionStrategy.OnPush,
                      providers: [TIMEPICKER_CONTROL_VALUE_ACCESSOR, TimepickerStore],
                      templateUrl: './timepicker.component.html',
                    Severity: Minor
                    Found in src/timepicker/timepicker.component.ts - About 2 hrs to fix

                      TypeaheadContainerComponent has 23 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      @Component({
                        selector: 'typeahead-container',
                        // tslint:disable-next-line
                        templateUrl: './typeahead-container.component.html',
                        host: {
                      Severity: Minor
                      Found in src/typeahead/typeahead-container.component.ts - About 2 hrs to fix

                        Function handleMonthStrictParse has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                        Open

                          private handleMonthStrictParse(monthName: string, format: string, strict?: boolean) {
                            const llc = monthName.toLocaleLowerCase();
                            let i;
                            let ii;
                            let mom;
                        Severity: Minor
                        Found in src/chronos/locale/locale.class.ts - About 2 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 bsDatepickerReducer has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                        Open

                        export function bsDatepickerReducer(state = initialDatepickerState,
                                                            action: Action): BsDatepickerState {
                          switch (action.type) {
                            case BsDatepickerActions.CALCULATE: {
                              return calculateReducer(state);
                        Severity: Minor
                        Found in src/datepicker/reducer/bs-datepicker.reducer.ts - About 2 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 dayOfYearFromWeekInfo has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function dayOfYearFromWeekInfo(config: DateParsingConfig): DateParsingConfig {
                          let w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow;
                        
                          w = config._w;
                          if (w.GG != null || w.W != null || w.E != null) {
                        Severity: Minor
                        Found in src/chronos/create/from-array.ts - About 2 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

                        Severity
                        Category
                        Status
                        Source
                        Language