opf/openproject

View on GitHub

Showing 1,636 of 1,650 total issues

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

  private showStopModal(active:TimeEntryResource):Promise<void> {
    return new Promise<void>((resolve, reject) => {
      this
        .modalService
        .show(StopExistingTimerModalComponent, this.injector, { timer: active })
frontend/src/app/shared/components/modals/confirm-dialog/confirm-dialog.service.ts on lines 62..76

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

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 confirm(options:ConfirmDialogOptions):Promise<void> {
    return new Promise<void>((resolve, reject) => {
      this.opModalService.show(
        ConfirmDialogModalComponent,
        this.injector,
frontend/src/app/features/work-packages/components/wp-timer-button/wp-timer-button.component.ts on lines 149..162

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

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 area.service.ts has 311 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { Injectable } from '@angular/core';
import { GridWidgetArea } from 'core-app/shared/components/grids/areas/grid-widget-area';
import { GridArea } from 'core-app/shared/components/grids/areas/grid-area';
import { GridGap } from 'core-app/shared/components/grids/areas/grid-gap';
import { GridResource } from 'core-app/features/hal/resources/grid-resource';
Severity: Minor
Found in frontend/src/app/shared/components/grids/grid/area.service.ts - About 3 hrs to fix

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

        content: {
          empty: this.i18n.t('js.storages.files.empty_folder'),
          emptyHint: this.i18n.t('js.storages.files.empty_folder_location_hint'),
          noConnection: (storageType:string) => this.i18n.t('js.storages.no_connection', { storageType }),
          noConnectionHint: (storageType:string) => this.i18n.t('js.storages.information.connection_error', { storageType }),
    frontend/src/app/shared/components/storages/file-picker-modal/file-picker-modal.component.ts on lines 65..70

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

    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

        content: {
          empty: this.i18n.t('js.storages.files.empty_folder'),
          emptyHint: this.i18n.t('js.storages.files.empty_folder_location_hint'),
          noConnection: (storageType:string) => this.i18n.t('js.storages.no_connection', { storageType }),
          noConnectionHint: (storageType:string) => this.i18n.t('js.storages.information.connection_error', { storageType }),
    frontend/src/app/shared/components/storages/location-picker-modal/location-picker-modal.component.ts on lines 66..71

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

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

    Reporting.Controls = function($){
      var toggle_delete_form = function (e) {
        e.preventDefault();
    
        var offset = $('#query-icon-delete').offsetLeft;

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

      export class ShareUpsaleComponent {
        video = videoPath('sharing/share-work-package.mp4');
      
        text = {
          title: this.I18n.t('js.work_packages.sharing.title'),
      frontend/src/app/features/in-app-notifications/date-alerts-upsale/ian-date-alerts-upsale.component.ts on lines 10..21

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

      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 interface BcfOrthogonalCamera {
        camera_view_point:{ x:number, y:number, z:number }
        camera_direction:{ x:number, y:number, z:number }
        camera_up_vector:{ x:number, y:number, z:number }
        view_to_world_scale:number
      Severity: Major
      Found in frontend/src/app/features/bim/bcf/api/bcf-api.model.ts and 1 other location - About 3 hrs to fix
      frontend/src/app/features/bim/bcf/api/bcf-api.model.ts on lines 69..74

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

      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 interface BcfPerspectiveCamera {
        camera_view_point:{ x:number, y:number, z:number }
        camera_direction:{ x:number, y:number, z:number }
        camera_up_vector:{ x:number, y:number, z:number }
        field_of_view:number
      Severity: Major
      Found in frontend/src/app/features/bim/bcf/api/bcf-api.model.ts and 1 other location - About 3 hrs to fix
      frontend/src/app/features/bim/bcf/api/bcf-api.model.ts on lines 62..67

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

      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 InAppNotificationsDateAlertsUpsaleComponent {
        video = videoPath('notification-center/date-alert-notifications.mp4');
      
        text = {
          title: this.I18n.t('js.notifications.date_alerts.upsale.title'),
      frontend/src/app/features/enterprise/share-upsale/share-upsale.component.ts on lines 10..21

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

      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

      WorkPackageViewFiltersService has 28 functions (exceeds 20 allowed). Consider refactoring.
      Open

      @Injectable()
      export class WorkPackageViewFiltersService extends WorkPackageQueryStateService<QueryFilterInstanceResource[]> {
        public hidden:string[] = [
          'datesInterval',
          'precedes',

        WorkPackageViewColumnsService has 28 functions (exceeds 20 allowed). Consider refactoring.
        Open

        @Injectable()
        export class WorkPackageViewColumnsService extends WorkPackageQueryStateService<QueryColumn[]> {
          public constructor(readonly states:States, readonly querySpace:IsolatedQuerySpace) {
            super(querySpace);
          }

          TimelineCellRenderer has 28 functions (exceeds 20 allowed). Consider refactoring.
          Open

          export class TimelineCellRenderer {
            @InjectField() wpTableTimeline:WorkPackageViewTimelineService;
          
            @InjectField() weekdayService:WeekdayService;
          
          

            OpWorkPackagesCalendarService has 28 functions (exceeds 20 allowed). Consider refactoring.
            Open

            @Injectable()
            export class OpWorkPackagesCalendarService extends UntilDestroyedMixin {
              static MAX_DISPLAYED = 500;
            
              tooManyResultsText:string|null;

              Function RestoreQuery has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
              Open

              Reporting.RestoreQuery = function($){
              
                var select_operator = function (field, operator) {
                  var select, i;
                  select = $("#operators_" + field);

              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

              Method update has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
              Open

                def update
                  # TODO: copied over from edit
                  # remove code where appropriate
                  if @project
                    # Hourly Rate
              Severity: Minor
              Found in modules/costs/app/controllers/hourly_rates_controller.rb - About 3 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

              Method lcs has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
              Open

                def self.lcs(a, b)
                  astart = 0
                  bstart = 0
                  afinish = a.length - 1
                  bfinish = b.length - 1
              Severity: Minor
              Found in lib_static/redmine/diff/array_string_diff.rb - About 3 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

              Function renderRelation has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
              Open

                private renderRelation(vp:TimelineViewParameters,
                  e:TimelineRelationElement,
                  idxFrom:number,
                  idxTo:number,
                  startCell:WorkPackageTimelineCell,

              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 initializeCalendar has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
              Open

                private initializeCalendar() {
                  const additionalOptions:{ [key:string]:unknown } = {
                    locales: allLocales,
                    locale: this.I18n.locale,
                    height: '100%',

              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

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

                    elTable.on(`scroll${jQueryScrollSyncEventNamespace}`, (ev:JQuery.TriggeredEvent) => {
                      syncedLeft = true;
                      if (!syncedRight) {
                        elTimeline[0].scrollTop = ev.target.scrollTop;
                      }
              frontend/src/app/features/work-packages/components/wp-table/wp-table-scroll-sync.ts on lines 116..125

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

              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