opf/openproject

View on GitHub
frontend/src/app/features/work-packages/components/wp-table/context-menu-helper/wp-context-menu-helper.service.ts

Summary

Maintainability
B
5 hrs
Test Coverage

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

  private getAllowedRelationActions(workPackage:WorkPackageResource, allowSplitScreenActions:boolean) {
    const allowedActions:WorkPackageAction[] = [];

    if (!!workPackage.addRelation && this.wpViewTimeline.isVisible) {
      allowedActions.push({

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

      constructor(private HookService:HookService,
        private UrlParamsHelper:UrlParamsHelperService,
        private wpViewRepresentation:WorkPackageViewDisplayRepresentationService,
        private wpViewTimeline:WorkPackageViewTimelineService,
        private wpViewIndent:WorkPackageViewHierarchyIdentationService,
    frontend/src/app/features/boards/board/board-list/board-list-menu.component.ts on lines 51..57
    frontend/src/app/features/boards/board/board-list/board-lists.service.ts on lines 22..30
    frontend/src/app/features/enterprise/enterprise-trial-waiting/ee-trial-waiting.component.ts on lines 67..73
    frontend/src/app/features/in-app-notifications/center/menu/menu.component.ts on lines 167..174
    frontend/src/app/features/invite-user-modal/project-selection/project-selection.component.ts on lines 93..100
    frontend/src/app/features/work-packages/components/filters/query-filter/query-filter.component.ts on lines 90..98
    frontend/src/app/features/work-packages/components/wp-relations/wp-relations-hierarchy/wp-relations-hierarchy.service.ts on lines 40..47
    frontend/src/app/features/work-packages/components/wp-table/configuration-modal/tabs/highlighting-tab.component.ts on lines 60..66
    frontend/src/app/features/work-packages/components/wp-tabs/components/wp-tabs/wp-tabs.component.ts on lines 35..43
    frontend/src/app/shared/components/datepicker/sheet/date-picker-sheet.component.ts on lines 80..88
    frontend/src/app/shared/components/header-project-select/list/header-project-select-list.component.ts on lines 52..59

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

    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

        _.each(permittedActions, (permittedAction:any) => {
          bulkPermittedActions.push({
            key: permittedAction.key,
            text: permittedAction.text,
            icon: permittedAction.icon,
    frontend/src/app/features/work-packages/components/wp-table/context-menu-helper/wp-context-menu-helper.service.ts on lines 101..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 57.

    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

        _.each(allowedActions, (allowedAction) => {
          singularPermittedActions.push({
            key: allowedAction.key,
            text: allowedAction.text,
            icon: allowedAction.icon,
    frontend/src/app/features/work-packages/components/wp-table/context-menu-helper/wp-context-menu-helper.service.ts on lines 131..138

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

    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

          if (workPackage[action.link as string] !== undefined) {
            const index = action.indexBy ? action.indexBy(allowedActions) : allowedActions.length;
            allowedActions.splice(index, 0, action);
          }
    frontend/src/app/shared/components/op-context-menu/wp-context-menu/wp-single-context-menu.ts on lines 109..112

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

    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