noydb/oworms-ui

View on GitHub

Showing 11 of 15 total issues

Function getWords has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private getWords(): void {
        let filtering: boolean = false;

        this.route
        .queryParamMap
Severity: Minor
Found in src/app/page/list/words.component.ts - About 2 hrs to fix

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

        private getQueryParams(): Subscription {
            return this.route
                .queryParamMap
                .pipe(
                    take(1),
    Severity: Minor
    Found in src/app/component/filter/modal/filter-modal.component.ts - About 1 hr to fix

      Function ngOnChanges has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          ngOnChanges(changes: SimpleChanges): void {
              if (!this.stats) {
                  return;
              }
      
      
      Severity: Minor
      Found in src/app/page/stats/word-bar-graph/word-bar-graph.component.ts - About 1 hr to fix

        Function getFilterHttpParams has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private getFilterHttpParams(wordFilter: WordFilter): HttpParams | undefined {
                if (!wordFilter) {
                    return undefined;
                }
        
        
        Severity: Minor
        Found in src/app/service/word.http.service.ts - About 1 hr to fix

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

              static getFilterLabels(qParamsMap: ParamMap): string[] {
                  let filters: string[] = [];
          
                  const word: string = qParamsMap.get('word');
                  if (!!word?.trim()) {
          Severity: Minor
          Found in src/app/util/filter.util.ts - About 1 hr to fix

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

                onBtnClick(cancel?: boolean): void {
                    if (cancel) {
                        this.form.reset();
                        this.secondBtnClick.emit();
                        this.selectedPos = undefined;
            Severity: Minor
            Found in src/app/component/word/form/word-form.component.ts - About 1 hr to fix

              Function getMessage has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  static getMessage(e: HttpErrorResponse): string {
                      const status: number = e.status;
                      const apiError: ApiErrorResponse = e.error;
              
                      let message = '';
              Severity: Minor
              Found in src/app/util/error.util.ts - About 1 hr to fix

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

                    private setSelectedPos(partsOfSpeech: string[]): void {
                        if (!partsOfSpeech || partsOfSpeech.length === 0) {
                            return;
                        }
                
                
                Severity: Minor
                Found in src/app/component/filter/modal/filter-modal.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 getFilterLabels has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    static getFilterLabels(qParamsMap: ParamMap): string[] {
                        let filters: string[] = [];
                
                        const word: string = qParamsMap.get('word');
                        if (!!word?.trim()) {
                Severity: Minor
                Found in src/app/util/filter.util.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 ngOnChanges has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    ngOnChanges(changes: SimpleChanges): void {
                        if (!this.stats) {
                            return;
                        }
                
                
                Severity: Minor
                Found in src/app/page/stats/word-bar-graph/word-bar-graph.component.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 filter has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    filter(): void {
                        const queryParams: QueryParamFilters = {};
                
                        const { word, definition, origin, example, note } = this.form.value;
                
                
                Severity: Minor
                Found in src/app/component/filter/modal/filter-modal.component.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

                Severity
                Category
                Status
                Source
                Language