swimlane/ngx-ui

View on GitHub

Showing 139 of 731 total issues

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

export function defaultInputFormat(
  displayMode: DATE_DISPLAY_TYPES,
  inputType: DateTimeType,
  precision: unitOfTime.StartOf
) {

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 onMonthDown has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  onMonthDown(event: KeyboardEvent) {
    let stop = false;

    if (this.currentView === CalendarView.Month) {
      switch (event.code) {

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

      onAmPmChange(newVal, type) {
        if (type === 'start') {
          if (this.range.startDate) {
            const hourClone = this.range.startDate.getHours();
            if (newVal === 'AM' && this.startAmPmVal === 'PM') {

    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 getWeeksForDays has 47 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function getWeeksForDays(days: CalendarDay[], startDay: number) {
      const weeks: CalendarMonth = [];
      let offset = 7;
    
      // fill front row

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

      export function defaultInputFormat(
        displayMode: DATE_DISPLAY_TYPES,
        inputType: DateTimeType,
        precision: unitOfTime.StartOf
      ) {

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

        export function defaultDisplayFormat(
          displayMode: DATE_DISPLAY_TYPES,
          inputType: DateTimeType,
          precision: unitOfTime.StartOf
        ) {

          Function onYearDown has 44 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            onYearDown(event: KeyboardEvent) {
              let stop = false;
          
              if (this.currentView === CalendarView.Year) {
                switch (event.code) {

            Function indexProperties has 44 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              indexProperties(): void {
                const props = this.schemaBuilderMode ? this.schemaRef.properties : this.model;
            
                for (const prop in props) {
                  if (this.isIndexed(prop)) {

              Function filterByObject has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

              export const filterByObject = (filter: any) => {
                return (value: unknown): boolean => {
                  for (const key in filter) {
                    // eslint-disable-next-line no-prototype-builtins
                    if (!value.hasOwnProperty(key)) {

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

              export function containsFilter(
                value: any,
                keyword: string,
                options: { filterCaseSensitive?: boolean },
                depth = 0

              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 createDialog has 41 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                private createDialog(options: DialogOptions, type: AlertTypes) {
                  const subject = new Subject<{ type: string; data: any }>();
                  const {
                    title,
                    content,

                Function close has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function close(element: JQuery<Element>): Cypress.Chainable<JQuery<Element>> {
                  switch (getTagName(element)) {
                    case NGX.SELECT:
                      if (element.hasClass('active')) {
                        element.find('.ngx-select-caret').trigger('click', LOG);
                Severity: Minor
                Found in projects/swimlane/ngx-ui-testing/src/functions.ts - About 1 hr to fix

                  Function decrement has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                    private decrement(event: MouseEvent) {
                      event.preventDefault();
                  
                      if (!this.disabled) {
                        const el = this.element.nativeElement as HTMLInputElement;

                  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 update has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    private update() {
                      this.internalDatetime = undefined;
                      this.timeValues = {};
                      this.titleValue = '';
                      this.dateInvalid = true;

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

                    export const shouldFlip = (
                      elDimensions: Dimensions,
                      popoverDimensions: Dimensions,
                      placement: PlacementTypes,
                      alignment: AlignmentTypes,

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

                      hourChanged(newVal: number, type: string) {
                        newVal = +newVal % 12;
                        if (type === 'start') {
                          if (this.range.startDate) {
                            if (this.startAmPmVal === 'PM') newVal = 12 + newVal;

                    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 jsonToTree has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export const jsonToTree = (value: any, label?: string): TreeNode => {
                      const type = getType(value);
                    
                      let children: any[];
                      let expandable = false;

                      Function createSubscriptions has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        createSubscriptions(component: ComponentRef<DrawerComponent>, isRoot = true, parentContainer?) {
                          if (isRoot) {
                            this.overlayService.show({
                              triggerComponent: component,
                              zIndex: this.zIndex

                        Function exports has 33 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/swimlane/ngx-ui/karma.conf.js - About 1 hr to fix

                          Function calculateGroups has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            private calculateGroups(groupBy: string, options: any[], filter?: string): any[] {
                              if (!options) return [];
                          
                              const filterOptions = { filterCaseSensitive: this.filterCaseSensitive };
                          
                          
                            Severity
                            Category
                            Status
                            Source
                            Language