opf/openproject

View on GitHub

Showing 1,789 of 1,819 total issues

File team-planner.component.ts has 756 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {
  ChangeDetectionStrategy,
  Component,
  ElementRef,
  HostListener,

    Function Filters has a Cognitive Complexity of 85 (exceeds 5 allowed). Consider refactoring.
    Open

    Reporting.Filters = function($){
      var load_available_values_for_filter = function  (filter_name, callback_func) {
        var select, radio_options, post_select_values;
        select = $('.filter-value[data-filter-name="' + filter_name + '"]').first();
        // check if we might have a radio-box

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

    RB.Model = (function ($) {
      return RB.Object.create({
    
        initialize: function (el) {
          this.$ = $(el);
    Severity: Major
    Found in frontend/src/app/core/augmenting/dynamic-scripts/backlogs/model.js - About 1 day to fix

      Class ApiV3Path has 84 methods (exceeds 20 allowed). Consider refactoring.
      Open

              class ApiV3Path
                extend API::Utilities::UrlHelper
      
                def self.index(name, path = nil)
                  plural_name = name.to_s.pluralize
      Severity: Major
      Found in lib/api/v3/utilities/path_helper.rb - About 1 day to fix

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

          public addColumn(column:number, excludeRow:number) {
            this.numColumns++;
        
            const movedWidgets:GridWidgetArea[] = [];
        
        
        frontend/src/app/shared/components/grids/grid/area.service.ts on lines 290..316

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

        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 addRow(row:number, excludeColumn:number) {
            this.numRows++;
        
            const movedWidgets:GridWidgetArea[] = [];
        
        
        frontend/src/app/shared/components/grids/grid/area.service.ts on lines 262..288

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

        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 work with positive local offset (1)', () => {
            const localWeekdays = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'];
            const localOffset = 1;
            const orderedDaysData = service.getOrderedDaysData(daysCheckedValues, localWeekdays, localOffset);
        
        
        frontend/src/app/shared/components/grids/widgets/time-entries/current-user/configuration-modal/services/configuration-modal/configuration-modal.service.spec.ts on lines 63..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 266.

        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 work with positive local offset (3)', () => {
            const localWeekdays = ['Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday', 'Monday', 'Tuesday'];
            const localOffset = 3;
            const orderedDaysData = service.getOrderedDaysData(daysCheckedValues, localWeekdays, localOffset);
        
        
        frontend/src/app/shared/components/grids/widgets/time-entries/current-user/configuration-modal/services/configuration-modal/configuration-modal.service.spec.ts on lines 43..61

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

        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 hal-resource.spec.ts has 616 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
        Severity: Major
        Found in frontend/src/app/features/hal/resources/hal-resource.spec.ts - About 1 day to fix

          Class User has 72 methods (exceeds 20 allowed). Consider refactoring.
          Open

          class User < Principal
            USER_FORMATS_STRUCTURE = {
              firstname_lastname: %i[firstname lastname],
              firstname: [:firstname],
              lastname_firstname: %i[lastname firstname],
          Severity: Major
          Found in app/models/user.rb - About 1 day to fix

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

              const formSchema = {
                _type: 'Form',
                _embedded: {
                  payload: {
                    name: 'Project 1',
            frontend/src/app/shared/components/dynamic-forms/components/dynamic-form/dynamic-form.component.spec.ts on lines 43..98

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

            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

              const formSchema:any = {
                _type: 'Form',
                _embedded: {
                  payload: {
                    name: 'Project 1',
            frontend/src/app/shared/components/dynamic-forms/services/dynamic-form/dynamic-form.service.spec.ts on lines 16..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 225.

            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

              private renderLabelsMonths(vp:TimelineViewParameters) {
                this.renderTimeSlices(vp, 'year', 0, vp.dateDisplayStart, vp.dateDisplayEnd, (start, cell) => {
                  cell.innerHTML = start.format('YYYY');
                  cell.classList.add('wp-timeline--header-top-bold-element');
                });
            frontend/src/app/features/work-packages/components/wp-table/timeline/header/wp-timeline-header.directive.ts on lines 121..137

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

            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

              private renderLabelsWeeks(vp:TimelineViewParameters) {
                this.renderTimeSlices(vp, 'month', 0, vp.dateDisplayStart, vp.dateDisplayEnd, (start, cell) => {
                  cell.innerHTML = start.format('MMM YYYY');
                  cell.classList.add('wp-timeline--header-top-bold-element');
                });
            frontend/src/app/features/work-packages/components/wp-table/timeline/header/wp-timeline-header.directive.ts on lines 139..155

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

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

            class WorkPackage < ApplicationRecord
              include WorkPackage::Validations
              include WorkPackage::SchedulingRules
              include WorkPackage::StatusTransitions
              include WorkPackage::AskBeforeDestruction
            Severity: Major
            Found in app/models/work_package.rb - About 1 day to fix

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

                public text = {
                  close_popup: this.I18n.t('js.close_popup_title'),
              
                  free_board: this.I18n.t('js.boards.board_type.free'),
                  free_board_text: this.I18n.t('js.boards.board_type.free_text'),
              frontend/src/app/features/team-planner/team-planner/planner/team-planner.component.ts on lines 251..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 210.

              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

                text = {
                  add_existing: this.I18n.t('js.team_planner.add_existing'),
                  assignee: this.I18n.t('js.label_assignee'),
                  add_assignee: this.I18n.t('js.team_planner.add_assignee'),
                  remove_assignee: this.I18n.t('js.team_planner.remove_assignee'),
              frontend/src/app/features/boards/new-board-modal/new-board-modal.component.ts on lines 68..84

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

              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 ApiV3PlaceholderUsersPaths
                extends ApiV3ResourceCollection<PlaceholderUserResource, ApiV3PlaceholderUserPaths>
                implements ApiV3ListResourceInterface<PlaceholderUserResource> {
                constructor(protected apiRoot:ApiV3Service,
                  protected basePath:string) {
              frontend/src/app/core/apiv3/endpoints/groups/apiv3-groups-paths.ts on lines 41..72

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

              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 ApiV3GroupsPaths
                extends ApiV3ResourceCollection<GroupResource, ApiV3GroupPaths>
                implements ApiV3ListResourceInterface<GroupResource> {
                constructor(protected apiRoot:ApiV3Service,
                  protected basePath:string) {
              frontend/src/app/core/apiv3/endpoints/placeholder-users/apiv3-placeholder-users-paths.ts on lines 41..72

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

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

              Reporting.Filters = function($){
                var load_available_values_for_filter = function  (filter_name, callback_func) {
                  var select, radio_options, post_select_values;
                  select = $('.filter-value[data-filter-name="' + filter_name + '"]').first();
                  // check if we might have a radio-box
                Severity
                Category
                Status
                Source
                Language