opf/openproject

View on GitHub
frontend/src/app/shared/components/project-include/project-include.component.ts

Summary

Maintainability
F
5 days
Test Coverage

OpProjectIncludeComponent has 24 functions (exceeds 20 allowed). Consider refactoring.
Open

@Component({
  selector: 'op-project-include',
  changeDetection: ChangeDetectionStrategy.OnPush,
  templateUrl: './project-include.component.html',
  styleUrls: ['./project-include.component.sass'],

    File project-include.component.ts has 259 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // -- copyright
    // OpenProject is an open source project management software.
    // Copyright (C) 2012-2024 the OpenProject GmbH
    //
    // This program is free software; you can redistribute it and/or

      Avoid too many return statements within this function.
      Open

                    return false;

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

          public projects$ = combineLatest([
            this.searchableProjectListService.allProjects$,
            this.displayMode$.pipe(distinctUntilChanged()),
            this.includeSubprojects$.pipe(debounceTime(20)),
            this.searchableProjectListService.searchText$.pipe(debounceTime(200)),
        frontend/src/stimulus/controllers/dynamic/generic-drag-and-drop.controller.ts on lines 149..196

        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 698.

        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

        Similar blocks of code found in 4 locations. Consider refactoring.
        Open

          public text = {
            toggle_title: this.I18n.t('js.include_projects.toggle_title'),
            title: this.I18n.t('js.include_projects.title'),
            filter_all: this.I18n.t('js.include_projects.selected_filter.all'),
            filter_selected: this.I18n.t('js.include_projects.selected_filter.selected'),
        frontend/src/app/features/enterprise/enterprise-base.component.ts on lines 43..53
        frontend/src/app/features/work-packages/components/filters/query-filters/query-filters.component.ts on lines 81..91
        frontend/src/app/features/work-packages/components/wp-table/configuration-modal/wp-table-configuration.modal.ts on lines 45..57

        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 159.

        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

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

          public loading$ = this.searchableProjectListService.fetchingProjects$.pipe(
            filter((fetching) => fetching),
            take(1),
            mergeMap(() => this.projects$),
            mergeMap(() => this.searchableProjectListService.fetchingProjects$),
        frontend/src/app/shared/components/header-project-select/header-project-select.component.ts on lines 136..141

        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 64.

        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

                      if (searchText.length) {
                        const matches = project.name.toLowerCase().includes(searchText.toLowerCase());
        
                        if (!matches) {
                          return false;
        frontend/src/app/shared/components/header-project-select/header-project-select.component.ts on lines 84..90

        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 56.

        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

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

                projects
                  .filter(
                    (project) => {
                      if (searchText.length) {
                        const matches = project.name.toLowerCase().includes(searchText.toLowerCase());
        frontend/src/app/shared/components/header-project-select/header-project-select.component.ts on lines 81..108

        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 46.

        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

        There are no issues that match your filters.

        Category
        Status