swimlane/ngx-ui

View on GitHub

Showing 139 of 731 total issues

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

  ngOnInit() {
    if (!this.schema) {
      this.schema = {
        ...inferType(this.model, this.typeCheckOverrides)
      };

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

export function open(element: JQuery<Element>): Cypress.Chainable<JQuery<Element>> {
  switch (getTagName(element)) {
    case NGX.SELECT:
      if (!element.hasClass('active')) {
        element.find('.ngx-select-caret').trigger('click');
Severity: Minor
Found in projects/swimlane/ngx-ui-testing/src/functions.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 projectComponentBindings has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  projectComponentBindings(component: ComponentRef<any>, bindings: Record<string, any>): ComponentRef<any> {
    if (bindings) {
      if (bindings.inputs !== undefined) {
        const bindingKeys = Object.getOwnPropertyNames(bindings.inputs);
        for (const bindingName of bindingKeys) {

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 close has a Cognitive Complexity of 11 (exceeds 5 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

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

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

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

export const debounce = (func: () => void, wait: number, immediate?: boolean): (() => any) => {
  let timeout: any;
  let args: IArguments;
  let context: any;
  let timestamp: Date;
Severity: Minor
Found in projects/swimlane/ngx-ui/src/lib/utils/debounce/debounce.util.ts - About 1 hr to fix

    Function value has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      @Input()
      set value(val: Date | string) {
        if (typeof val === 'string') {
          val = val.trim();
        }

      Function addHideListeners has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        addHideListeners(tooltip: HTMLElement): void {
          // on mouse enter, cancel the hide triggered by the leave
          this.mouseEnterContentEvent = this.renderer.listen(
            tooltip,
            'mouseenter',

        Function throttle has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function throttle(func: () => void, wait: number, options?: ThrottleOptions): any {
          options = options || {};
        
          let context: any;
          let args: IArguments;
        Severity: Minor
        Found in projects/swimlane/ngx-ui/src/lib/utils/throttle/throttle.util.ts - About 1 hr to fix

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

            ngOnInit() {
              if (!this.schema) {
                this.schema = {
                  ...inferType(this.model, this.typeCheckOverrides)
                };

            Function open has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

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

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

                addRequiredProperties(): void {
                  if (this.schema && this.schema.properties) {
                    for (const propName in this.schema.properties) {
                      if (this.model[propName] !== undefined) {
                        continue;

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

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

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

                initializeTime(): void {
                  this.startHour = this.range.startDate
                    ? this.range.startDate.getHours() % 12
                    : +moment('2001-01-01T00:00:00').format('hh') % 12;
                  this.endHour = this.range.endDate

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

                onInput() {
                  if (this._enabled) {
                    const nativeEl = this.element.nativeElement;
              
                    if (this.nodeName === 'TEXTAREA') {

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

                private calcSelectedOptions(selected: any[]) {
                  const results: SelectDropdownOption[] = [];
              
                  // result out if nothing here
                  if (!selected) return results;

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

                private initSchemasTypeByModelValue(): void {
                  const prevSchemas = this.schemas ? [...this.schemas] : [];
                  this.schemas = [];
                  if (Array.isArray(this.model)) {
                    this.model.forEach((value, index) => {

                Function exports has 27 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 src/karma.conf.js - About 1 hr to fix

                  Function addArrayItem has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    addArrayItem(dataType?: JsonSchemaDataType): void {
                      let schema;
                      if (dataType) {
                        if (dataType.name === 'String') {
                          dataType.schema = { type: 'string' };

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

                      onDaySelectRange(day: CalendarDay) {
                        this.focusDate = day.date.clone();
                    
                        if (this.range.startDate === undefined && this.range.endDate === undefined) {
                          this.range.startDate = this.focusDate.toDate();

                    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