valor-software/angular2-bootstrap

View on GitHub

Showing 272 of 791 total issues

ModalDirective has 22 functions (exceeds 20 allowed). Consider refactoring.
Open

@Directive({
  selector: '[bsModal]',
  exportAs: 'bs-modal'
})
export class ModalDirective implements OnDestroy, OnInit {
Severity: Minor
Found in src/modal/modal.directive.ts - About 2 hrs to fix

    Function configFromStringAndFormat has 55 lines of code (exceeds 25 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: Major
    Found in src/chronos/create/from-string-and-format.ts - About 2 hrs to fix

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

      @Component({
        selector: 'pagination',
        templateUrl: './pagination.component.html',
        providers: [PAGINATION_CONTROL_VALUE_ACCESSOR]
      })
      Severity: Minor
      Found in src/pagination/pagination.component.ts - About 2 hrs to fix

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

        @Component({
          selector: 'pager',
          templateUrl: './pager.component.html',
          providers: [PAGER_CONTROL_VALUE_ACCESSOR]
        })
        Severity: Minor
        Found in src/pagination/pager.component.ts - About 2 hrs to fix

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

          @Directive({
            selector: '[tooltip], [tooltipHtml]',
            exportAs: 'bs-tooltip'
          })
          export class TooltipDirective implements OnInit, OnDestroy {
          Severity: Minor
          Found in src/tooltip/tooltip.directive.ts - About 2 hrs to fix

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

            @Component({
              selector: 'carousel',
              templateUrl: './carousel.component.html'
            })
            export class CarouselComponent implements OnDestroy {
            Severity: Minor
            Found in src/carousel/carousel.component.ts - About 2 hrs to fix

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

              @Directive({selector: '[typeahead]', exportAs: 'bs-typeahead'})
              export class TypeaheadDirective implements OnInit, OnDestroy {
                /** options source, can be Array of strings, objects or
                 * an Observable for external matching process
                 */
              Severity: Minor
              Found in src/typeahead/typeahead.directive.ts - About 2 hrs to fix

                Function weekdaysParse has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                  weekdaysParse(weekdayName?: string, format?: string, strict?: boolean): number {
                    let i;
                    let regex;
                
                    if (this._weekdaysParseExact) {
                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 pluralForm has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                const pluralForm = function (num: number): number {
                  return num === 0 ? 0 : num === 1 ? 1 : num === 2 ? 2 : num % 100 >= 3 && num % 100 <= 10 ? 3 : num % 100 >= 11 ? 4 : 5;
                };
                Severity: Minor
                Found in src/chronos/i18n/ar.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 ngOnInit has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  ngOnInit(): void {
                    const self = this;
                
                    this.datePicker.stepDay = { months: 1 };
                
                
                Severity: Major
                Found in src/datepicker/daypicker.component.ts - About 2 hrs to fix

                  Function configFromISO has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export function configFromISO(config: DateParsingConfig): DateParsingConfig {
                    if (!isString(config._i)) {
                      return config;
                    }
                  
                  
                  Severity: Major
                  Found in src/chronos/create/from-string.ts - About 2 hrs to fix

                    Function registerDatepickerSideEffects has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      registerDatepickerSideEffects(): BsDatepickerEffects {
                        this._subs.push(
                          this._store.select(state => state.view).subscribe(view => {
                            this._store.dispatch(this._actions.calculate());
                          })
                    Severity: Major
                    Found in src/datepicker/reducer/bs-datepicker.effects.ts - About 2 hrs to fix

                      Function translate has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function translate(num: number, withoutSuffix: boolean, key: string, isFuture: boolean): string {
                        const result = num + ' ';
                      
                        switch (key) {
                          case 's':  // a few seconds / in a few seconds / a few seconds ago
                      Severity: Major
                      Found in src/chronos/i18n/cs.ts - About 2 hrs to fix

                        Function timepickerControls has 49 lines of code (exceeds 25 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 1 hr to fix

                          Function convertDuration has 48 lines of code (exceeds 25 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 1 hr to fix

                            Function translate has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function translate(num: number, withoutSuffix: boolean, key: string): string {
                              let result = num + ' ';
                              switch (key) {
                                case 'ss':
                                  return result + (plural(num) ? 'sekundy' : 'sekund');
                            Severity: Minor
                            Found in src/chronos/i18n/pl.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 translate has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function translate(num: number, withoutSuffix: boolean, key: string, isFuture: boolean) {
                              switch (key) {
                                case 's':
                                  return withoutSuffix ? 'хэдхэн секунд' : 'хэдхэн секундын';
                                case 'ss':
                            Severity: Minor
                            Found in src/chronos/i18n/mn.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 configFromArray has 47 lines of code (exceeds 25 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 1 hr to fix

                              Function showElement has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                protected showElement(): void {
                                  // todo: replace this with component loader usage
                                  if (
                                    !this._element.nativeElement.parentNode ||
                                    this._element.nativeElement.parentNode.nodeType !== Node.ELEMENT_NODE
                              Severity: Minor
                              Found in src/modal/modal.directive.ts - About 1 hr to fix

                                Function flagReducer has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                function flagReducer(state: BsDatepickerState,
                                                     action: Action): BsDatepickerState {
                                  if (state.view.mode === 'day') {
                                    const flaggedMonths = state.formattedMonths.map(
                                      (formattedMonth, monthIndex) =>
                                Severity: Minor
                                Found in src/datepicker/reducer/bs-datepicker.reducer.ts - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language