noydb/oworms-ui

View on GitHub

Showing 15 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

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                        const bars: Bar[] = keys
                            .sort((a: tuple, b: tuple) =>
                                new Date(a[0]).getTime() - new Date(b[0]).getTime()
                            )
                Severity: Minor
                Found in src/app/page/stats/pos-bar-graph/pos-bar-graphs.component.ts and 1 other location - About 55 mins to fix
                src/app/page/stats/word-bar-graph/word-bar-graph.component.ts on lines 37..43

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 53.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                        const bars: Bar[] = keys
                            .map(([date, words]: [string, Word[]]) =>
                                [new Date(date), words]
                            )
                            .sort((a: tuple, b: tuple) =>
                Severity: Minor
                Found in src/app/page/stats/word-bar-graph/word-bar-graph.component.ts and 1 other location - About 55 mins to fix
                src/app/page/stats/pos-bar-graph/pos-bar-graphs.component.ts on lines 36..39

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 53.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                            error: (e: HttpErrorResponse) => {
                                this.state = ComponentState.COMPLETE;
                                this.fieldErrors = e.error.fieldErrors;
                            }
                Severity: Minor
                Found in src/app/page/edit/word-edit.component.ts and 1 other location - About 50 mins to fix
                src/app/page/add/word-add.component.ts on lines 49..52

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 51.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                                error: (e: HttpErrorResponse) => {
                                    this.state = ComponentState.COMPLETE;
                                    this.fieldErrors = e.error.fieldErrors;
                                }
                Severity: Minor
                Found in src/app/page/add/word-add.component.ts and 1 other location - About 50 mins to fix
                src/app/page/edit/word-edit.component.ts on lines 52..55

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 51.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                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