opf/openproject

View on GitHub

Showing 1,654 of 1,668 total issues

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

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

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

      {
        type: 'projectInput',
        expressionProperties: {},
        key: '_links.parent',
        templateOptions: {
frontend/src/app/shared/components/dynamic-forms/components/dynamic-form/dynamic-form.component.spec.ts on lines 221..242

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

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

      {
        type: 'selectInput',
        expressionProperties: {},
        key: '_links.parent',
        templateOptions: {
frontend/src/app/shared/components/dynamic-forms/services/dynamic-form/dynamic-form.service.spec.ts on lines 83..104

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

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

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

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

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

Method up has 80 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def up
    Migration::MigrationSquasher.squash(migrations) do
      create_table "cost_entries", id: :integer do |t|
        t.integer "user_id",                                                            null: false
        t.integer "project_id",                                                         null: false

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

      requireNonWorkingYear$(date:Date|string):Observable<IDay[]> {
        const from = moment(date).startOf('year').format('YYYY-MM-DD');
        const to = moment(date).endOf('year').format('YYYY-MM-DD');
    
        const filters:ApiV3ListFilter[] = [
    Severity: Major
    Found in frontend/src/app/core/state/days/day.service.ts and 1 other location - About 3 hrs to fix
    frontend/src/app/core/state/days/day.service.ts on lines 47..56

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

    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

      constructor(
        @Inject(OpModalLocalsToken) public locals:OpModalLocalsMap,
        readonly cdRef:ChangeDetectorRef,
        readonly I18n:I18nService,
        readonly elementRef:ElementRef,
    frontend/src/app/shared/components/grids/widgets/time-entries/current-user/configuration-modal/configuration.modal.ts on lines 34..45
    frontend/src/app/shared/components/storages/file-picker-modal/file-picker-modal.component.ts on lines 119..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 99.

    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

      requireNonWorkingYears$(start:Date|string, end:Date|string):Observable<IDay[]> {
        const from = moment(start).startOf('year').format('YYYY-MM-DD');
        const to = moment(end).endOf('year').format('YYYY-MM-DD');
    
        const filters:ApiV3ListFilter[] = [
    Severity: Major
    Found in frontend/src/app/core/state/days/day.service.ts and 1 other location - About 3 hrs to fix
    frontend/src/app/core/state/days/day.service.ts on lines 36..45

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

    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

      constructor(
        @Inject(OpModalLocalsToken) public locals:OpModalLocalsMap,
        readonly elementRef:ElementRef,
        readonly cdRef:ChangeDetectorRef,
        protected readonly sortFilesPipe:SortFilesPipe,
    frontend/src/app/features/job-status/job-status-modal/job-status.modal.ts on lines 70..85
    frontend/src/app/shared/components/grids/widgets/time-entries/current-user/configuration-modal/configuration.modal.ts on lines 34..45

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

    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

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

        this.renderTimeSlices(vp, 'quarter', 15, vp.dateDisplayStart, vp.dateDisplayEnd, (start, cell) => {
          cell.innerHTML = this.I18n.t('js.gantt_chart.quarter_label',
            { quarter_number: start.format('Q') });
          cell.classList.add('-top-border');
          cell.style.height = '30px';
    frontend/src/app/features/work-packages/components/wp-table/timeline/header/wp-timeline-header.directive.ts on lines 166..171

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

    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

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

        this.renderTimeSlices(vp, 'quarter', 15, vp.dateDisplayStart, vp.dateDisplayEnd, (start, cell) => {
          cell.innerHTML = this.I18n.t('js.gantt_chart.quarter_label',
            { quarter_number: start.format('Q') });
          cell.classList.add('-top-border');
          cell.style.height = '30px';
    frontend/src/app/features/work-packages/components/wp-table/timeline/header/wp-timeline-header.directive.ts on lines 185..190

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

    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

      constructor(@Inject(OpModalLocalsToken) public locals:OpModalLocalsMap,
        readonly I18n:I18nService,
        readonly injector:Injector,
        readonly appRef:ApplicationRef,
        readonly loadingIndicator:LoadingIndicatorService,
    frontend/src/app/features/job-status/job-status-modal/job-status.modal.ts on lines 70..85
    frontend/src/app/shared/components/storages/file-picker-modal/file-picker-modal.component.ts on lines 119..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 99.

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

    class ::Query::Results
      include ::Query::Results::GroupBy
      include ::Query::Results::Sums
      include Redmine::I18n
    
    
    Severity: Minor
    Found in app/models/query/results.rb - About 3 hrs to fix

      Class TableComponent has 27 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class TableComponent < ApplicationComponent
        def initialize(rows: [], **options)
          super(rows, **options)
        end
      
      
      Severity: Minor
      Found in app/components/table_component.rb - About 3 hrs to fix

        Class Budget has 27 methods (exceeds 20 allowed). Consider refactoring.
        Open

        class Budget < ApplicationRecord
          belongs_to :author, class_name: "User"
          belongs_to :project
          has_many :work_packages, dependent: :nullify
          has_many :material_budget_items, -> {
        Severity: Minor
        Found in modules/budgets/app/models/budget.rb - About 3 hrs to fix

          Class CreateContract has 27 methods (exceeds 20 allowed). Consider refactoring.
          Open

              class CreateContract < ::ModelContract
                include ::Bim::Bcf::Concerns::ManageBcfGuarded
          
                WHITELISTED_PROPERTIES = %w(guid
                                            index
          Severity: Minor
          Found in modules/bim/app/contracts/bim/bcf/viewpoints/create_contract.rb - About 3 hrs to fix

            Function initializeUiRouterListeners has 79 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function initializeUiRouterListeners(injector:Injector) {
              const $transitions:TransitionService = injector.get(TransitionService);
              const stateService = injector.get(StateService);
              const toastService:ToastService = injector.get(ToastService);
              const currentProject:CurrentProjectService = injector.get(CurrentProjectService);
            Severity: Major
            Found in frontend/src/app/core/routing/openproject.routes.ts - About 3 hrs to fix

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

                  void window.OpenProject.getPluginContext().then((pluginContext) => {
                    // eslint-disable-next-line no-new
                    new pluginContext.classes.DomAutoscrollService(
                      [
                        document.getElementById('content-wrapper') as HTMLElement,
              frontend/src/stimulus/controllers/dynamic/generic-drag-and-drop.controller.ts on lines 74..87

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

              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