opf/openproject

View on GitHub

Showing 1,448 of 1,464 total issues

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

    for (const [start, end] of inViewportAndBoundaries) {
      const cell = document.createElement('div');
      cell.classList.add(timelineElementCssClass, timelineGridElementCssClass);
      cell.style.left = calculatePositionValueForDayCount(vp, start.diff(startView, 'days'));
      cell.style.width = calculatePositionValueForDayCount(vp, end.diff(start, 'days') + 1);
frontend/src/app/features/work-packages/components/wp-table/timeline/grid/wp-timeline-grid.directive.ts on lines 177..184

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

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 openproject-work-packages.module.ts has 375 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// -- copyright
// OpenProject is an open source project management software.
// Copyright (C) 2012-2022 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

    export class ApiV3GroupPaths extends ApiV3GettableResource<GroupResource> {
      /**
       * Update a placeholder user resource or payload
       * @param resource
       */
    frontend/src/app/core/apiv3/endpoints/placeholder-users/apiv3-placeholder-user-paths.ts on lines 33..54

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

    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

      fetchPrincipals(params:ApiV3ListParameters):Observable<IHALCollection<IPrincipal>> {
        const collectionURL = collectionKey(params);
    
        return this
          .http
    Severity: Major
    Found in frontend/src/app/core/state/principals/principals.service.ts and 1 other location - About 4 hrs to fix
    frontend/src/app/core/state/projects/projects.service.ts on lines 68..81

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

    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

      fetchProjects(params:ApiV3ListParameters):Observable<IHALCollection<IProject>> {
        const collectionURL = collectionKey(params);
    
        return this
          .http
    Severity: Major
    Found in frontend/src/app/core/state/projects/projects.service.ts and 1 other location - About 4 hrs to fix
    frontend/src/app/core/state/principals/principals.service.ts on lines 62..75

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

    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 ApiV3PlaceholderUserPaths extends ApiV3GettableResource<PlaceholderUserResource> {
      /**
       * Update a placeholder user resource or payload
       * @param resource
       */
    frontend/src/app/core/apiv3/endpoints/groups/apiv3-group-paths.ts on lines 33..54

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

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

    Reporting.GroupBys = (function($){
      var group_by_container_ids = function() {
        var ids = ['group-by--columns', 'group-by--rows'];
    
        return _.filter(ids, function (i) {

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

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

        export class BcfSplitLeftComponent implements OnInit {
          showViewer$:Observable<boolean>;
        
          constructor(private readonly bcfView:BcfViewService) {}
        
        
        frontend/src/app/features/bim/ifc_models/bcf/split/right/bcf-split-right.component.ts on lines 43..54

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

        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 BcfSplitRightComponent implements OnInit {
          showWorkPackages$:Observable<boolean>;
        
          constructor(private readonly bcfView:BcfViewService) {}
        
        
        frontend/src/app/features/bim/ifc_models/bcf/split/left/bcf-split-left.component.ts on lines 43..54

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

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

        RB.Taskboard = (function ($) {
          return RB.Object.create(RB.Model, {
        
            initialize: function (el) {
              var self = this; // So we can bind the event handlers to this object

          Function Attachable has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
          Open

          export function Attachable<TBase extends Constructor<HalResource>>(Base:TBase) {
            return class extends Base {
              public attachments:AttachmentCollectionResource;
          
              private ToastService:ToastService;
          Severity: Minor
          Found in frontend/src/app/features/hal/resources/mixins/attachable-mixin.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

          GridAreaService has 36 functions (exceeds 20 allowed). Consider refactoring.
          Open

          @Injectable()
          export class GridAreaService {
            private resource:GridResource;
          
            public schema:SchemaResource;
          Severity: Minor
          Found in frontend/src/app/shared/components/grids/grid/area.service.ts - About 4 hrs to fix

            File dynamic-fields.service.ts has 361 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import { Injectable } from '@angular/core';
            import { FormlyFieldConfig } from '@ngx-formly/core';
            import { Observable, of } from 'rxjs';
            import { map } from 'rxjs/operators';
            import { HttpClient } from '@angular/common/http';

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

                  it('should have a callable beaver', () => {
                    spyOn(halResourceService, 'request').and.callFake((verb:string, path:string) => {
                      if (verb === 'get' && path === 'justin/420') {
                        return of(halResourceService.createHalResource({})) as any;
                      }
              Severity: Major
              Found in frontend/src/app/features/hal/resources/hal-resource.spec.ts and 1 other location - About 4 hrs to fix
              frontend/src/app/features/hal/resources/hal-resource.spec.ts on lines 378..387

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

              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

                  it('should have a callable self link', () => {
                    spyOn(halResourceService, 'request').and.callFake((verb:string, path:string) => {
                      if (verb === 'get' && path === 'unicorn/69') {
                        return of(halResourceService.createHalResource({})) as any;
                      }
              Severity: Major
              Found in frontend/src/app/features/hal/resources/hal-resource.spec.ts and 1 other location - About 4 hrs to fix
              frontend/src/app/features/hal/resources/hal-resource.spec.ts on lines 389..398

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

              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 BaseActivityProvider has 35 methods (exceeds 20 allowed). Consider refactoring.
              Open

              class Activities::BaseActivityProvider
                include I18n
                include Redmine::I18n
                include OpenProject::StaticRouting
              
              
              Severity: Minor
              Found in app/models/activities/base_activity_provider.rb - About 4 hrs to fix

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

                      for (const [start, end] of rest) {
                        const cell = this.addLabelCell();
                        cell.style.top = `${marginTop}px`;
                        cell.style.left = calculatePositionValueForDayCount(vp, start.diff(startView, 'days'));
                        cell.style.width = calculatePositionValueForDayCount(vp, end.diff(start, 'days') + 1);
                frontend/src/app/features/work-packages/components/wp-table/timeline/header/wp-timeline-header.directive.ts on lines 206..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 124.

                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

                    for (const [start, end] of inViewportAndBoundaries) {
                      const cell = this.addLabelCell();
                      cell.style.top = `${marginTop}px`;
                      cell.style.left = calculatePositionValueForDayCount(vp, start.diff(startView, 'days'));
                      cell.style.width = calculatePositionValueForDayCount(vp, end.diff(start, 'days') + 1);
                frontend/src/app/features/work-packages/components/wp-table/timeline/header/wp-timeline-header.directive.ts on lines 214..220

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

                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

                  public text = {
                    label_choose_avatar: this.I18n.t('js.avatars.label_choose_avatar'),
                    upload_instructions: this.I18n.t('js.avatars.text_upload_instructions'),
                    error_too_large: this.I18n.t('js.avatars.error_image_too_large'),
                    wrong_file_format: this.I18n.t('js.avatars.wrong_file_format'),
                frontend/src/app/features/work-packages/components/wp-table/configuration-modal/tabs/timelines-tab.component.ts on lines 42..50
                frontend/src/app/shared/components/modals/editor/macro-child-pages-modal/child-pages-macro.modal.ts on lines 59..67
                frontend/src/app/shared/components/op-view-select/op-view-select.component.ts on lines 66..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 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

                Severity
                Category
                Status
                Source
                Language