opf/openproject

View on GitHub

Showing 841 of 1,756 total issues

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 83 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

      Class User has 74 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

        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-2021 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 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

            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

              Class PermittedParams has 56 methods (exceeds 20 allowed). Consider refactoring.
              Open

              class PermittedParams
                # This class intends to provide a method for all params hashes coming from the
                # client and that are used for mass assignment.
                #
                # A method should look like the following:
              Severity: Major
              Found in app/models/permitted_params.rb - About 1 day to fix

                File user.rb has 496 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                require 'digest/sha1'
                
                class User < Principal
                  USER_FORMATS_STRUCTURE = {
                    firstname_lastname: %i[firstname lastname],
                Severity: Minor
                Found in app/models/user.rb - About 7 hrs to fix

                  Method permitted_attributes has 194 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def self.permitted_attributes
                      @whitelisted_params ||= begin
                        params = {
                          attribute_help_text: %i(
                            type
                  Severity: Major
                  Found in app/models/permitted_params.rb - About 7 hrs to fix

                    Class Chainable has 54 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                      class Chainable
                        include Enumerable
                        include Report::QueryUtils
                        extend Report::InheritedAttribute
                        extend Forwardable
                    Severity: Major
                    Found in modules/reporting/lib/report/chainable.rb - About 7 hrs to fix

                      File te-calendar.component.ts has 486 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import {
                        AfterViewInit,
                        ChangeDetectionStrategy,
                        Component,
                        ElementRef,

                        Function registerWidgets has 187 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export function registerWidgets(injector:Injector) {
                          const hookService = injector.get(HookService);
                          const i18n = injector.get(I18nService);
                        
                          hookService.register('gridWidgets', () => {
                        Severity: Major
                        Found in frontend/src/app/shared/components/grids/openproject-grids.module.ts - About 7 hrs to fix

                          File work_package_representer.rb has 475 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          module API
                            module V3
                              module WorkPackages
                                class WorkPackageRepresenter < ::API::Decorators::Single
                                  include API::Decorators::LinkedResource
                          Severity: Minor
                          Found in lib/api/v3/work_packages/work_package_representer.rb - About 7 hrs to fix

                            File permitted_params.rb has 473 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            require 'permitted_params/allowed_settings'
                            
                            class PermittedParams
                              # This class intends to provide a method for all params hashes coming from the
                              # client and that are used for mass assignment.
                            Severity: Minor
                            Found in app/models/permitted_params.rb - About 7 hrs to fix

                              Class Repository has 52 methods (exceeds 20 allowed). Consider refactoring.
                              Open

                              class Repository < ApplicationRecord
                                include Redmine::Ciphering
                                include OpenProject::SCM::ManageableRepository
                              
                                belongs_to :project
                              Severity: Major
                              Found in app/models/repository.rb - About 7 hrs to fix

                                Class Query has 50 methods (exceeds 20 allowed). Consider refactoring.
                                Open

                                class Query < ApplicationRecord
                                  include Timelines
                                  include Highlighting
                                  include ManualSorting
                                  include Queries::Filters::AvailableFilters
                                Severity: Minor
                                Found in app/models/query.rb - About 7 hrs to fix

                                  PathHelperService has 50 functions (exceeds 20 allowed). Consider refactoring.
                                  Open

                                  @Injectable({ providedIn: 'root' })
                                  export class PathHelperService {
                                    public readonly appBasePath = window.appBasePath || '';
                                  
                                    public readonly api = {
                                  Severity: Minor
                                  Found in frontend/src/app/core/path-helper/path-helper.service.ts - About 7 hrs to fix

                                    Method define_operators has 172 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                      def self.define_operators # :nodoc:
                                        # Defaults
                                        defaults do
                                          def_delegators :singleton_class, :forced?, :force!, :forced
                                    
                                    
                                    Severity: Major
                                    Found in modules/reporting/lib/report/operator.rb - About 6 hrs to fix

                                      Class ApplicationController has 49 methods (exceeds 20 allowed). Consider refactoring.
                                      Open

                                      class ApplicationController < ActionController::Base
                                        class_attribute :_model_object
                                        class_attribute :_model_scope
                                        class_attribute :accept_key_auth_actions
                                      
                                      
                                      Severity: Minor
                                      Found in app/controllers/application_controller.rb - About 6 hrs to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language