opf/openproject

View on GitHub

Showing 635 of 1,693 total issues

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

        ConfigurationService has 27 functions (exceeds 20 allowed). Consider refactoring.
        Open

        @Injectable({ providedIn: 'root' })
        export class ConfigurationService {
          // fetches configuration from the ApiV3 endpoint
          // TODO: this currently saves the request between page reloads,
          // but could easily be stored in localStorage
        Severity: Minor
        Found in frontend/src/app/core/config/configuration.service.ts - 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

            Method controller_work_package_new_after_save has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
            Open

                def controller_work_package_new_after_save(context = {})
                  params = context[:params]
                  work_package = context[:work_package]
            
                  return unless work_package.backlogs_enabled?
            Severity: Minor
            Found in modules/backlogs/lib/open_project/backlogs/hooks/layout_hook.rb - About 3 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

            Method update has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
            Open

              def update
                wiki_menu_setting = wiki_menu_item_params[:setting]
                parent_wiki_menu_item = params[:parent_wiki_menu_item]
            
                get_data_from_params(params)
            Severity: Minor
            Found in app/controllers/wiki_menu_items_controller.rb - About 3 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

            Function buildItems has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
            Open

              private buildItems() {
                this.items = [
                  {
                    // Configuration modal
                    disabled: false,

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

              private selectPreviousResult(activeID:ID|null, allProjects:IProjectData[]):void {
                if (activeID === null) {
                  return;
                }
            
            

            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

            File chronic_duration.spec.ts has 294 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            
            /*
             * NOTE:
             * Changes to this file should be kept in sync with
             * lib/chronic_duration_spec.rb.
            Severity: Minor
            Found in frontend/src/app/shared/helpers/chronic_duration.spec.ts - About 3 hrs to fix

              Function buildQueries has 76 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                public buildQueries():IStaticQuery[] {
                  let items:IStaticQuery[] = [
                    {
                      title: this.text.all_open,
                      uiSref: 'work-packages',

                Function makeSplitViewRoutes has 76 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function makeSplitViewRoutes(baseRoute:string,
                  menuItemClass:string|undefined,
                  showComponent:ComponentType<unknown>,
                  newComponent:ComponentType<unknown> = WorkPackageNewSplitViewComponent,
                  makeFullWidth?:boolean,

                  StorageComponent has 26 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  @Component({
                    selector: 'op-storage',
                    templateUrl: './storage.component.html',
                    changeDetection: ChangeDetectionStrategy.OnPush,
                    providers: [{ provide: OpUploadService, useClass: StorageUploadService }],

                    Function initializeGlobalListeners has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export function initializeGlobalListeners():void {
                      document
                        .documentElement
                        .addEventListener('click', (evt:MouseEvent) => {
                          const target = evt.target as HTMLElement;
                    Severity: Major
                    Found in frontend/src/app/core/setup/globals/global-listeners.ts - About 2 hrs to fix

                      Method search has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                      Open

                                def search(tokens, projects = nil, options = {})
                                  tokens = Array(tokens)
                                  projects = [] << projects unless projects.nil? || projects.is_a?(Array)
                      
                                  find_order = "#{searchable_options[:order_column]} " + (options[:before] ? "DESC" : "ASC")
                      Severity: Minor
                      Found in lib_static/plugins/acts_as_searchable/lib/acts_as_searchable.rb - About 2 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

                      Class HistoricActiveRecordRelation has 25 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                      class Journable::HistoricActiveRecordRelation < ActiveRecord::Relation
                        attr_accessor :timestamp
                      
                        include ActiveRecord::Delegation::ClassSpecificRelation
                      
                      
                      Severity: Minor
                      Found in app/models/journable/historic_active_record_relation.rb - About 2 hrs to fix

                        TopMenuService has 25 functions (exceeds 20 allowed). Consider refactoring.
                        Open

                        @Injectable({ providedIn: 'root' })
                        export class TopMenuService {
                          private hover = false;
                        
                          private menuIsOpen = false;
                        Severity: Minor
                        Found in frontend/src/app/core/top-menu/top-menu.service.ts - About 2 hrs to fix

                          TimezoneService has 25 functions (exceeds 20 allowed). Consider refactoring.
                          Open

                          @Injectable({ providedIn: 'root' })
                          export class TimezoneService {
                            constructor(
                              readonly configurationService:ConfigurationService,
                              readonly I18n:I18nService,
                          Severity: Minor
                          Found in frontend/src/app/core/datetime/timezone.service.ts - About 2 hrs to fix

                            Function ngOnInit has 70 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              ngOnInit():void {
                                this.form.disable();
                                this.eeShowBanners = this.bannersService.eeShowBanners;
                            
                                this

                              Function listenToSettingChanges has 70 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export function listenToSettingChanges() {
                                jQuery('#settings_session_ttl_enabled').on('change', function () {
                                  jQuery('#settings_session_ttl_container').toggle(jQuery(this).is(':checked'));
                                }).trigger('change');
                              
                              
                              Severity: Major
                              Found in frontend/src/app/core/setup/globals/global-listeners/settings.ts - About 2 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language