opf/openproject

View on GitHub

Showing 1,636 of 1,650 total issues

Function initializeCalendar has 110 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  private initializeCalendar() {
    void this.weekdayService.loadWeekdays()
      .toPromise()
      .then(() => {
        this.calendarOptions$.next(

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

      constructor(
        readonly injector:Injector,
        readonly I18n:I18nService,
        readonly apiV3Service:ApiV3Service,
        readonly timeEntryService:TimeEntryTimerService,
    frontend/src/app/features/work-packages/components/wp-inline-create/wp-inline-create.component.ts on lines 109..122

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

    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(public readonly injector:Injector,
        protected readonly elementRef:ElementRef,
        protected readonly schemaCache:SchemaCacheService,
        protected readonly I18n:I18nService,
        protected readonly querySpace:IsolatedQuerySpace,
    frontend/src/app/features/work-packages/components/wp-timer-button/wp-timer-button.component.ts on lines 88..103

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

    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 url-params-helper.ts has 347 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

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

        public parseEnd(date:string|null) {
          if (date === null || !validDate(date)) {
            return;
          }
      
      
      frontend/src/app/features/work-packages/components/filters/filter-date-times-value/filter-date-times-value.component.ts on lines 105..121

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

      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 parseBegin(date:string|null) {
          if (date === null || !validDate(date)) {
            return;
          }
      
      
      frontend/src/app/features/work-packages/components/filters/filter-date-times-value/filter-date-times-value.component.ts on lines 123..139

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

      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 global-search-input.component.ts has 345 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

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

            this.entryLocation()
              .pipe(
                this.untilDestroyed(),
                switchMap((location:string) => this.storageFilesResourceService.files(makeFilesCollectionLink(this.storage._links.self, location))),
              )
        frontend/src/app/shared/components/storages/file-picker-base-modal/file-picker-base-modal.component.ts on lines 155..168

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

        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

            this.loadingSubscription = this.storageFilesResourceService
              .files(makeFilesCollectionLink(this.storage._links.self, ancestor.location))
              .subscribe({
                next: (storageFiles) => {
                  this.currentDirectory = storageFiles.parent;
        frontend/src/app/shared/components/storages/file-picker-base-modal/file-picker-base-modal.component.ts on lines 112..128

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

        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

        Class CostQuery has 33 methods (exceeds 20 allowed). Consider refactoring.
        Open

        class CostQuery < ApplicationRecord
          extend Forwardable
          include Enumerable
          include Engine
        
        
        Severity: Minor
        Found in modules/reporting/app/models/cost_query.rb - About 4 hrs to fix

          WorkPackageTimelineTableController has 33 functions (exceeds 20 allowed). Consider refactoring.
          Open

          @Component({
            selector: 'wp-timeline-container',
            templateUrl: './wp-timeline-container.html',
          })
          export class WorkPackageTimelineTableController extends UntilDestroyedMixin implements AfterViewInit {

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

              isWpEndDateInCurrentView(workPackage:WorkPackageResource):boolean {
                const { dueDate } = workPackage;
            
                if (!dueDate) {
                  return !!workPackage.date;
            frontend/src/app/features/team-planner/team-planner/planner/team-planner.component.ts on lines 708..719

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

            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

              isWpStartDateInCurrentView(workPackage:WorkPackageResource):boolean {
                const { startDate } = workPackage;
            
                if (!startDate) {
                  return !!workPackage.date;
            frontend/src/app/features/team-planner/team-planner/planner/team-planner.component.ts on lines 695..706

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

            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

              $transitions.onEnter({}, (transition:Transition, state:StateDeclaration) => {
                // Add body class when entering this state
                bodyClass(_.get(state, 'data.bodyClasses'), 'add');
                if (transition.from().data && _.get(state, 'data.menuItem') !== transition.from().data.menuItem) {
                  updateMenuItem(_.get(state, 'data.menuItem'), 'add');
            Severity: Major
            Found in frontend/src/app/core/routing/openproject.routes.ts and 1 other location - About 4 hrs to fix
            frontend/src/app/core/routing/openproject.routes.ts on lines 258..264

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

            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

              updateDate(key:DateKeys, val:string|null):void {
                if ((val === null || validDate(val)) && this.datePickerInstance) {
                  this.dates[key] = mappedDate(val);
                  const dateValue = parseDate(val || '') || undefined;
                  this.enforceManualChangesToDatepicker(dateValue);
            frontend/src/app/shared/components/datepicker/wp-multi-date-form/wp-multi-date-form.component.ts on lines 371..378

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

            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

              updateDate(key:DateKeys, val:string|null):void {
                if ((val === null || validDate(val)) && this.datePickerInstance) {
                  this.dates[key] = mappedDate(val);
                  const dateValue = parseDate(val || '') || undefined;
                  this.enforceManualChangesToDatepicker(dateValue);
            frontend/src/app/shared/components/datepicker/multi-date-picker/multi-date-picker.component.ts on lines 250..257

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

            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

              $transitions.onExit({}, (transition:Transition, state:StateDeclaration) => {
                // Remove body class when leaving this state
                bodyClass(_.get(state, 'data.bodyClasses'), 'remove');
                if (transition.to().data && _.get(state, 'data.menuItem') !== transition.to().data.menuItem) {
                  updateMenuItem(_.get(state, 'data.menuItem'), 'remove');
            Severity: Major
            Found in frontend/src/app/core/routing/openproject.routes.ts and 1 other location - About 4 hrs to fix
            frontend/src/app/core/routing/openproject.routes.ts on lines 250..256

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

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

            export function initializeHalProperties<T extends HalResource>(halResourceService:HalResourceService, halResource:T) {
              setSource();
              setupLinks();
              setupEmbedded();
              proxyProperties();
            Severity: Minor
            Found in frontend/src/app/features/hal/helpers/hal-resource-builder.ts - About 4 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

            ResourceChangeset has 32 functions (exceeds 20 allowed). Consider refactoring.
            Open

            export class ResourceChangeset<T extends HalResource = HalResource> {
              /** Maintain a single change set while editing */
              protected changeset = new Changeset();
            
              /** Reference and load promise for the current form */

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

                constructor(
                  readonly elementRef:ElementRef,
                  @Inject(OpModalLocalsToken) public locals:OpModalLocalsMap,
                  readonly I18n:I18nService,
                  readonly states:States,
              frontend/src/app/features/boards/board/add-list-modal/add-list-modal.component.ts on lines 113..124

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

              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