opf/openproject

View on GitHub
frontend/src/app/features/work-packages/components/wp-baseline/baseline-legends/baseline-legends.component.ts

Summary

Maintainability
D
1 day
Test Coverage

Function getFilterName has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  public getFilterName(timestamps:string[]) {
    const datesAndTimes = timestamps.map((el) => el.split(/[@T]/));
    const baselineValue = baselineFilterFromValue(this.wpTableBaseline.current);
    const changesSinceOrBetween = this.deriveChangesSinceOrBetween(baselineValue);
    let description = '';

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

          case 'lastWorkingDay':
            [upstreamDate, localDate] = this.deriveSingleDate(this.wpTableBaseline.lastWorkingDate(), datesAndTimes[0][1]);
            description = this.I18n.t('js.baseline.drop_down.last_working_day');
            description += ` (${upstreamDate})`;
            break;
    frontend/src/app/features/work-packages/components/wp-baseline/baseline-legends/baseline-legends.component.ts on lines 132..136
    frontend/src/app/features/work-packages/components/wp-baseline/baseline-legends/baseline-legends.component.ts on lines 142..146
    frontend/src/app/features/work-packages/components/wp-baseline/baseline-legends/baseline-legends.component.ts on lines 147..151

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

    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

          case 'oneWeekAgo':
            [upstreamDate, localDate] = this.deriveSingleDate(this.wpTableBaseline.lastweekDate(), datesAndTimes[0][1]);
            description = this.I18n.t('js.baseline.drop_down.last_week');
            description += ` (${upstreamDate})`;
            break;
    frontend/src/app/features/work-packages/components/wp-baseline/baseline-legends/baseline-legends.component.ts on lines 132..136
    frontend/src/app/features/work-packages/components/wp-baseline/baseline-legends/baseline-legends.component.ts on lines 137..141
    frontend/src/app/features/work-packages/components/wp-baseline/baseline-legends/baseline-legends.component.ts on lines 147..151

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

    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

          case 'oneDayAgo':
            [upstreamDate, localDate] = this.deriveSingleDate(this.wpTableBaseline.yesterdayDate(), datesAndTimes[0][1]);
            description = this.I18n.t('js.baseline.drop_down.yesterday');
            description += ` (${upstreamDate})`;
            break;
    frontend/src/app/features/work-packages/components/wp-baseline/baseline-legends/baseline-legends.component.ts on lines 137..141
    frontend/src/app/features/work-packages/components/wp-baseline/baseline-legends/baseline-legends.component.ts on lines 142..146
    frontend/src/app/features/work-packages/components/wp-baseline/baseline-legends/baseline-legends.component.ts on lines 147..151

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

    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

          case 'oneMonthAgo':
            [upstreamDate, localDate] = this.deriveSingleDate(this.wpTableBaseline.lastMonthDate(), datesAndTimes[0][1]);
            description = this.I18n.t('js.baseline.drop_down.last_month');
            description += ` (${upstreamDate})`;
            break;
    frontend/src/app/features/work-packages/components/wp-baseline/baseline-legends/baseline-legends.component.ts on lines 132..136
    frontend/src/app/features/work-packages/components/wp-baseline/baseline-legends/baseline-legends.component.ts on lines 137..141
    frontend/src/app/features/work-packages/components/wp-baseline/baseline-legends/baseline-legends.component.ts on lines 142..146

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

    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 7 locations. Consider refactoring.
    Open

      constructor(
        readonly I18n:I18nService,
        readonly wpTableBaseline:WorkPackageViewBaselineService,
        readonly querySpace:IsolatedQuerySpace,
        readonly schemaCache:SchemaCacheService,
    frontend/src/app/features/boards/boards-sidebar/boards-menu.component.ts on lines 64..74
    frontend/src/app/features/user-preferences/notifications-settings/page/notifications-settings-page.component.ts on lines 139..149
    frontend/src/app/features/work-packages/components/wp-buttons/wp-create-button/wp-create-button.component.ts on lines 66..76
    frontend/src/app/features/work-packages/components/wp-custom-actions/wp-custom-actions/wp-custom-action.component.ts on lines 57..67
    frontend/src/app/features/work-packages/components/wp-relations/wp-relation-row/wp-relation-row.component.ts on lines 68..76
    frontend/src/app/shared/components/dynamic-forms/components/dynamic-form/dynamic-form.component.ts on lines 222..232

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

    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 18 locations. Consider refactoring.
    Open

      public text = {
        now_meets_filter_criteria: this.I18n.t('js.baseline.legends.now_meets_filter_criteria'),
        no_longer_meets_filter_criteria: this.I18n.t('js.baseline.legends.no_longer_meets_filter_criteria'),
        maintained_with_changes: this.I18n.t('js.baseline.legends.maintained_with_changes'),
        in_your_timezone: this.I18n.t('js.baseline.legends.in_your_timezone'),
    frontend/src/app/features/bim/ifc_models/pages/viewer/ifc-viewer-page.component.ts on lines 96..101
    frontend/src/app/features/projects/components/new-project/new-project.component.ts on lines 40..45
    frontend/src/app/features/user-preferences/reminder-settings/pause-reminders/pause-reminders.component.ts on lines 30..35
    frontend/src/app/features/work-packages/components/work-package-comment/work-package-comment.component.ts on lines 71..76
    frontend/src/app/features/work-packages/components/wp-activity/user/user-activity.component.ts on lines 94..99
    frontend/src/app/features/work-packages/components/wp-baseline/baseline-modal/baseline-modal.component.ts on lines 46..52
    frontend/src/app/features/work-packages/components/wp-breadcrumb/wp-breadcrumb-parent.component.ts on lines 48..53
    frontend/src/app/features/work-packages/components/wp-buttons/wp-create-button/wp-create-button.component.ts on lines 59..64
    frontend/src/app/features/work-packages/components/wp-timer-button/wp-timer-button.component.ts on lines 81..86
    frontend/src/app/shared/components/grids/widgets/time-entries/current-user/configuration-modal/configuration.modal.ts on lines 18..23
    frontend/src/app/shared/components/modals/export-modal/wp-table-export.modal.ts on lines 39..44
    frontend/src/app/shared/components/modals/share-modal/query-sharing-form.component.ts on lines 27..33
    frontend/src/app/shared/components/table-pagination/table-pagination.component.ts on lines 63..68
    frontend/src/app/shared/components/time_entries/edit/trigger-actions-entry.component.ts on lines 55..60
    frontend/src/app/shared/components/work-package-graphs/configuration-modal/wp-graph-configuration.modal.ts on lines 42..48
    modules/github_integration/frontend/module/pull-request/pull-request.component.ts on lines 57..62
    modules/gitlab_integration/frontend/module/merge-request/merge-request.component.ts on lines 48..53

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

    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