opf/openproject

View on GitHub

Showing 1,603 of 1,617 total issues

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

export class ApiV3StatusesPaths extends ApiV3ResourceCollection<StatusResource, ApiV3StatusPaths> {
  constructor(protected apiRoot:ApiV3Service,
    protected basePath:string) {
    super(apiRoot, basePath, 'statuses', ApiV3StatusPaths);
  }
frontend/src/app/core/apiv3/endpoints/roles/apiv3-roles-paths.ts on lines 37..58

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

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 registerWidgets has 187 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function registerWidgets(injector:Injector) {
  const hookService = injector.get(HookService);
  const i18n = injector.get(I18nService);

  hookService.register('gridWidgets', () => {
Severity: Major
Found in frontend/src/app/shared/components/grids/openproject-grids.module.ts - About 7 hrs to fix

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

    export class GitActionsMenuDirective extends OpContextMenuTrigger {
      @Input('gitActionsCopyDropdown-workPackage') public workPackage:WorkPackageResource;
    
      constructor(readonly elementRef:ElementRef,
                  readonly opContextMenu:OPContextMenuService) {
    modules/github_integration/frontend/module/git-actions-menu/git-actions-menu.directive.ts on lines 39..58

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

    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

    export class GitActionsMenuDirective extends OpContextMenuTrigger {
      @Input('gitActionsCopyDropdown-workPackage') public workPackage:WorkPackageResource;
    
      constructor(readonly elementRef:ElementRef,
                  readonly opContextMenu:OPContextMenuService) {
    modules/gitlab_integration/frontend/module/git-actions-menu/git-actions-menu.directive.ts on lines 41..60

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

    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

    File storage.component.ts has 472 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

      Class SetAttributesService has 51 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class WorkPackages::SetAttributesService < BaseServices::SetAttributes
        include Attachments::SetReplacements
      
        private
      
      
      Severity: Major
      Found in app/services/work_packages/set_attributes_service.rb - About 7 hrs to fix

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

          public editCodeBlock(content:string, languageClass:string):Promise<{ content:string, languageClass:string }> {
            return new Promise<{ content:string, languageClass:string }>((resolve, _) => {
              this.opModalService.show(
                CodeBlockMacroModalComponent,
                this.injector,
        frontend/src/app/shared/components/modals/editor/editor-macros.service.ts on lines 46..58

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

        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 configureWorkPackageButton(typeName?:string, classes?:string):Promise<{ type:string, classes:string }> {
            return new Promise<{ type:string, classes:string }>((resolve, reject) => {
              this.opModalService.show(
                WpButtonMacroModalComponent,
                this.injector,
        frontend/src/app/shared/components/modals/editor/editor-macros.service.ts on lines 83..95

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

        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

        File dynamic-form.component.spec.ts has 461 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import { NgSelectModule } from '@ng-select/ng-select';
        import { NgOptionHighlightModule } from '@ng-select/ng-option-highlight';
        import {
          Component,
          forwardRef,

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

            text = {
              title: this.I18n.t('js.reminders.settings.alerts.title'),
              explanation: this.I18n.t('js.reminders.settings.alerts.explanation'),
              newsAdded: this.I18n.t('js.reminders.settings.alerts.news_added'),
              newsCommented: this.I18n.t('js.reminders.settings.alerts.news_commented'),
          frontend/src/app/core/setup/globals/components/admin/backup.component.ts on lines 55..66
          frontend/src/app/shared/components/modals/get-ical-url-modal/query-get-ical-url.modal.ts on lines 67..78

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

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

            public text = {
              label_ical_sharing: this.I18n.t('js.ical_sharing_modal.title'),
              description_ical_sharing: this.I18n.t('js.ical_sharing_modal.description'),
              ical_sharing_warning: this.I18n.t('js.ical_sharing_modal.warning'),
              token_name: this.I18n.t('js.ical_sharing_modal.token_name_label'),
          frontend/src/app/core/setup/globals/components/admin/backup.component.ts on lines 55..66
          frontend/src/app/features/user-preferences/reminder-settings/email-alerts/email-alerts-settings.component.ts on lines 38..49

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

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

            public text = {
              info: this.i18n.t('js.backup.info'),
              note: this.i18n.t('js.backup.note'),
              title: this.i18n.t('js.backup.title'),
              lastBackup: this.i18n.t('js.backup.last_backup'),
          frontend/src/app/features/user-preferences/reminder-settings/email-alerts/email-alerts-settings.component.ts on lines 38..49
          frontend/src/app/shared/components/modals/get-ical-url-modal/query-get-ical-url.modal.ts on lines 67..78

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

          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

          export class WorkPackagesGitlabMrsService extends WorkPackageLinkedResourceCache<HalResource[]> {
          
            constructor(public ConfigurationService:ConfigurationService) {
              super();
            }
          modules/gitlab_integration/frontend/module/tab-issue/wp-gitlab-issue.service.ts on lines 37..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 175.

          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

          export class WorkPackagesGitlabIssueService extends WorkPackageLinkedResourceCache<HalResource[]> {
          
            constructor(public ConfigurationService:ConfigurationService) {
              super();
            }
          modules/gitlab_integration/frontend/module/tab-mrs/wp-gitlab-mrs.service.ts on lines 37..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 175.

          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

          Method modify_conditions has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
          Open

            def modify_conditions(node)
              if node.kind_of? Arel::TreeManager
                # We have another sub-tree, investigate its core, which is a SelectCore
                node.instance_variable_get(:@ast).instance_variable_get(:@cores).each do |core|
                  modify_conditions(core)
          Severity: Minor
          Found in app/models/journable/historic_active_record_relation.rb - About 6 hrs 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

          File wp-timeline-container.directive.ts has 442 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

            TeamPlannerComponent has 47 functions (exceeds 20 allowed). Consider refactoring.
            Open

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

              Function registerWorkPackageMouseHandler has 160 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function registerWorkPackageMouseHandler(this:void,
                injector:Injector,
                getRenderInfo:() => RenderInfo,
                workPackageTimeline:WorkPackageTimelineTableController,
                halEditing:HalResourceEditingService,

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

                  constructor(
                    readonly states:States,
                    readonly apiV3Service:ApiV3Service,
                    readonly $state:StateService,
                    private element:ElementRef,
                frontend/src/app/features/work-packages/components/wp-card-view/wp-card-view.component.ts on lines 121..140

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

                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

                  constructor(readonly querySpace:IsolatedQuerySpace,
                    readonly states:States,
                    readonly injector:Injector,
                    readonly $state:StateService,
                    readonly I18n:I18nService,
                frontend/src/app/features/calendar/te-calendar/te-calendar.component.ts on lines 193..212

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

                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

                Severity
                Category
                Status
                Source
                Language