UiPath/angular-components

View on GitHub

Showing 16 of 66 total issues

UiSuggestComponent has 109 functions (exceeds 20 allowed). Consider refactoring.
Open

@Component({
    selector: 'ui-suggest',
    styleUrls: ['./ui-suggest.component.scss'],
    templateUrl: './ui-suggest.component.html',
    encapsulation: ViewEncapsulation.None,
Severity: Major
Found in projects/angular/components/ui-suggest/src/ui-suggest.component.ts - About 2 days to fix

    FixtureTestingUtils has 30 functions (exceeds 20 allowed). Consider refactoring.
    Open

    export class FixtureTestingUtils<T> {
        get component() {
            return this.fixture.componentInstance;
        }
    
    
    Severity: Minor
    Found in projects/angular/testing/src/utilities/fixture-testing-utils.ts - About 3 hrs to fix

      Function constructor has 86 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

          constructor(
              @Optional()
              public intl: UiGridIntl,
              protected _ref: ElementRef,
              protected _cd: ChangeDetectorRef,
      Severity: Major
      Found in projects/angular/components/ui-grid/src/ui-grid.component.ts - About 2 hrs to fix

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

        export class SelectionManager<T extends IGridDataEntry> {
            get selected(): T[] {
                return Array.from(this._selection.values());
            }
        
        
        Severity: Minor
        Found in projects/angular/components/ui-grid/src/managers/selection-manager.ts - About 2 hrs to fix

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

          @Component({
              standalone: true,
              imports: [
                  CommonModule,
                  MatListModule,

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

                updateValue(inputValue: ISuggestValue | string, closeAfterSelect = true, refocus = true) {
                    let value = toSuggestValue(inputValue, this._isOnCustomValueIndex);
                    if (this.maxSelectionConfig.count <= this.value.length && !this.isItemSelected(value)) { return; }
                    if (value.loading !== VirtualScrollItemStatus.loaded || value.disabled === true) { return; }
            
            
            Severity: Minor
            Found in projects/angular/components/ui-suggest/src/ui-suggest.component.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 ngOnInit has 55 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

                ngOnInit() {
                    if (this.alwaysExpanded || this.expandInline) {
                        this.open();
                    }
            
            
            Severity: Major
            Found in projects/angular/components/ui-suggest/src/ui-suggest.component.ts - About 1 hr to fix

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

                  ngAfterViewInit() {
                      if (this.multiple) {
                          this._renderer.setProperty(this._fileInput, 'multiple', '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 _adjustLoadingRange has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  private _adjustLoadingRange(
                      start: number,
                      end: number,
                      buffer: number,
                      items: VirtualScrollItem[] | readonly VirtualScrollItem[]): ListRange {

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

                  private _getFocusableNode(el: HTMLElement): HTMLElement | undefined {
                      if (this._checker.isFocusable(el)) {
                          return el;
                      }
              
              
              Severity: Minor
              Found in projects/angular/directives/ui-autofocus/src/ui-autofocus.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 mapInitialItems has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  { total = 0, data = [] }: ISuggestValues<any>,
                  displayPriority: SuggestDisplayPriority,
                  value: ISuggestValue[],
                  loadingLabel: string,
                  isDown: boolean,
              Severity: Minor
              Found in projects/angular/components/ui-suggest/src/utils/items.utils.ts - About 45 mins to fix

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

                    private _emitFiles(files: FileList) {
                        if (
                            !files?.length ||
                            this.disabled
                        ) { return; }

                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 (
                        !isArray(left) && !isArray(right) &&
                        !isDate(left) && !isDate(right) &&
                        isObject(left) && isObject(right)
                    ) {
                Severity: Major
                Found in projects/angular/components/ui-grid/src/managers/data-manager.ts - About 40 mins to fix

                  Function processFilesFromFileList has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      processFilesFromFileList(filesReceived: FileList, ignoreFoldersOrEmptyFiles = false) {
                          if (!filesReceived) {
                              return;
                          }
                  
                  
                  Severity: Minor
                  Found in projects/angular/directives/ui-file-drop-zone/src/file-reader.service.ts - About 35 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 filterItemsByPredicate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function filterItemsByPredicate(
                      arr: ISuggestValue[],
                      predicate: (item: ISuggestValue) => boolean,
                      limit = 0,
                  ) {
                  Severity: Minor
                  Found in projects/angular/components/ui-suggest/src/utils/items.utils.ts - About 25 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 update has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      update(data: T[] | null) {
                          this.pristine = this.pristine &&
                              data == null;
                  
                          data = cloneDeep(data ?? []);
                  Severity: Minor
                  Found in projects/angular/components/ui-grid/src/managers/data-manager.ts - About 25 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

                  Severity
                  Category
                  Status
                  Source
                  Language