valor-software/angular2-bootstrap

View on GitHub

Showing 272 of 791 total issues

Function onChange has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  @HostListener('keyup', ['$event'])
  onChange(e: any): void {
    if (this._container) {
      // esc
      if (e.keyCode === 27) {
Severity: Minor
Found in src/typeahead/typeahead.directive.ts - About 55 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 meridiem has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  meridiem(hour, minute, isLower) {
    if (hour < 5) {
      return 'לפנות בוקר';
    } else if (hour < 10) {
      return 'בבוקר';
Severity: Minor
Found in src/chronos/i18n/he.ts - About 55 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 meridiemHour has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  meridiemHour(hour, meridiem) {
    if (hour === 12) {
      hour = 0;
    }
    if (meridiem === 'रात') {
Severity: Minor
Found in src/chronos/i18n/hi.ts - About 55 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 relativeTimeWithPlural has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

function relativeTimeWithPlural(num: number, withoutSuffix, key): string {
  let format: { [key: string]: string } = {
    ss: withoutSuffix ? 'секунда_секунди_секунд' : 'секунду_секунди_секунд',
    mm: withoutSuffix ? 'хвилина_хвилини_хвилин' : 'хвилину_хвилини_хвилин',
    hh: withoutSuffix ? 'година_години_годин' : 'годину_години_годин',
Severity: Minor
Found in src/chronos/i18n/uk.ts - About 55 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 createDate has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

export function createDate(y?: number,
                           m = 0,
                           d = 1,
                           h = 0,
                           M = 0,
Severity: Major
Found in src/chronos/create/date-from-array.ts - About 50 mins to fix

    Function select has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      select(date: Date, isManual = true): void {
        if (this.datepickerMode === this.minMode) {
          if (!this.activeDate) {
            this.activeDate = new Date(0, 0, 0, 0, 0, 0, 0);
          }
    Severity: Minor
    Found in src/datepicker/datepicker-inner.component.ts - About 45 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 visitClassDeclaration has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      visitClassDeclaration(fileName, classDeclaration) {
        const symbol = this.program.getTypeChecker().getSymbolAtLocation(classDeclaration.name);
        const description = getDescription(symbol);
        const className = classDeclaration.name.text;
        let directiveInfo, members;
    Severity: Minor
    Found in scripts/docs/api-doc.js - About 45 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 extractFromRFC2822Strings has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    function extractFromRFC2822Strings(yearStr: string, monthStr: string, dayStr: string, hourStr: string, minuteStr: string, secondStr: string): DateArray {
    Severity: Minor
    Found in src/chronos/create/from-string.ts - About 45 mins to fix

      Function _setInputValue has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        _setInputValue(date: Date[]): void {
          let range = '';
          if (date) {
            const start = !date[0] ? ''
              : formatDate(date[0],
      Severity: Minor
      Found in src/datepicker/bs-daterangepicker-input.directive.ts - About 45 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 canChangeValue has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      export function canChangeValue(
        state: TimepickerComponentState,
        event?: TimeChangeEvent
      ): boolean {
        if (state.readonlyInput || state.disabled) {
      Severity: Minor
      Found in src/timepicker/timepicker-controls.util.ts - About 45 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 meridiemHour has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        meridiemHour(hour, meridiem) {
          if (hour === 12) {
            hour = 0;
          }
          if (meridiem === '凌晨' || meridiem === '早上' ||
      Severity: Minor
      Found in src/chronos/i18n/zh-cn.ts - About 45 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 getSetWeekYearHelper has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      function getSetWeekYearHelper(date: Date, input: number, week: number,
                                    weekday: number, dow: number, doy: number): number | Date {
      Severity: Minor
      Found in src/chronos/units/week-year.ts - About 45 mins to fix

        Function setScrollableMode has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          setScrollableMode(): void {
            if (!this.ulElement) {
              this.ulElement = this.element;
            }
            if (this.liElements.first) {
        Severity: Minor
        Found in src/typeahead/typeahead-container.component.ts - About 45 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 add has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          add(value: T, position: number = this.length): void {
            if (position < 0 || position > this.length) {
              throw new Error('Position is out of the list');
            }
        
        
        Severity: Minor
        Found in src/utils/linked-list.class.ts - About 45 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 preventEmptyHrefNav has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          @HostListener('document:click', ['$event'])
          preventEmptyHrefNav(event: MouseEvent & {target: Element}): void {
            let element: Element = event.target;
            let preventNav = element.getAttribute('href') === '#';
        
        

        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 setWeekAll has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        function setWeekAll(date: Date, weekYear: number, week: number,
                            weekday: number, dow: number, doy: number): Date {
        Severity: Minor
        Found in src/chronos/units/week-year.ts - About 45 mins to fix

          Function ngOnInit has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            ngOnInit(): void {
              this.typeaheadOptionsLimit = this.typeaheadOptionsLimit || 20;
              this.typeaheadMinLength =
                this.typeaheadMinLength === void 0 ? 1 : this.typeaheadMinLength;
              this.typeaheadWaitMs = this.typeaheadWaitMs || 0;
          Severity: Minor
          Found in src/typeahead/typeahead.directive.ts - About 45 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 pickBy has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          function pickBy(fn: Function, dates: Date[] | Date[][]): Date {
            let _dates: Date[];
            const _firstArg = dates[0];
            if (isArray<Date>(_firstArg) && dates.length === 1) {
              _dates = _firstArg;
          Severity: Minor
          Found in src/chronos/moment/min-max.ts - About 45 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 listenToTriggers has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          export function listenToTriggers(renderer: Renderer2,
                                           target: any,
                                           triggers: string,
                                           showFn: BsEventCallback,
                                           hideFn: BsEventCallback,
          Severity: Minor
          Found in src/utils/triggers.ts - About 45 mins to fix

            Consider simplifying this complex logical expression.
            Open

              if (!((milliseconds >= 0 && days >= 0 && months >= 0) ||
                  (milliseconds <= 0 && days <= 0 && months <= 0))) {
                milliseconds += absCeil(monthsToDays(months) + days) * 864e5;
                days = 0;
                months = 0;
            Severity: Major
            Found in src/chronos/duration/bubble.ts - About 40 mins to fix
              Severity
              Category
              Status
              Source
              Language