opf/openproject

View on GitHub

Showing 610 of 1,650 total issues

ConfigurationService has 24 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 2 hrs to fix

    Function buildV3GetQueryFromJsonParams has 66 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      public buildV3GetQueryFromJsonParams(updateJson:string|null) {
        const queryData:Partial<QueryRequestParams> = {
          pageSize: this.paginationService.getPerPage(),
        };
    
    

      Function initialize has 65 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        private initialize():void {
          combineLatest([
            this.wpTableSortBy.onReadyWithAvailable(),
            this.wpTableSortBy.live$(),
          ])

        Method initialize has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

            def initialize(diff, options = {})
              options.assert_valid_keys(:type, :max_lines)
              diff = diff.split("\n") if diff.is_a?(String)
              @diff_type = options[:type] || "inline"
              lines = 0
        Severity: Minor
        Found in lib/redmine/unified_diff.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

        File filters.js has 272 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        //-- copyright
        // OpenProject is an open source project management software.
        // Copyright (C) 2012-2024 the OpenProject GmbH
        //
        // This program is free software; you can redistribute it and/or

          Function Task has 63 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          RB.Task = (function ($) {
            return RB.Object.create(RB.WorkPackage, {
          
              initialize: function (el) {
                this.$ = $(el);
          Severity: Major
          Found in frontend/src/stimulus/controllers/dynamic/backlogs/task.js - About 2 hrs to fix

            Class Version has 23 methods (exceeds 20 allowed). Consider refactoring.
            Open

            class Version < ApplicationRecord
              include ::Versions::ProjectSharing
              include ::Scopes::Scoped
            
              belongs_to :project
            Severity: Minor
            Found in app/models/version.rb - About 2 hrs to fix

              Class Base has 23 methods (exceeds 20 allowed). Consider refactoring.
              Open

                    class Base
                      include CheckoutInstructions
              
                      attr_accessor :url, :root_url
              
              
              Severity: Minor
              Found in lib/open_project/scm/adapters/base.rb - About 2 hrs to fix

                FiltersController has 23 functions (exceeds 20 allowed). Consider refactoring.
                Open

                export default class FiltersController extends Controller {
                  static targets = [
                    'filterFormToggle',
                    'filterForm',
                    'filter',
                Severity: Minor
                Found in frontend/src/stimulus/controllers/dynamic/filters.controller.ts - About 2 hrs to fix

                  TimezoneService has 23 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 RestoreQuery has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    Reporting.RestoreQuery = function($){
                    
                      var select_operator = function (field, operator) {
                        var select, i;
                        select = $("#operators_" + field);

                      Function edit has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          edit: function () {
                            var editor = this.getEditor(),
                                self = this,
                                maxTabIndex = 0;
                      
                      
                      Severity: Major
                      Found in frontend/src/stimulus/controllers/dynamic/backlogs/model.js - About 2 hrs to fix

                        Function initializeUiRouterListeners has 62 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 2 hrs to fix

                          File bcf-wp-attribute-group.component.ts has 268 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          // -- copyright
                          // OpenProject is an open source project management software.
                          // Copyright (C) 2012-2024 the OpenProject GmbH
                          //
                          // This program is free software; you can redistribute it and/or

                            Method fix_other_work_package_positions has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def fix_other_work_package_positions
                                  if changes.slice("project_id", "type_id", "version_id").present?
                                    if changes.slice("project_id", "version_id").blank? and
                                       Story.types.include?(type_id.to_i) and
                                       Story.types.include?(type_id_was.to_i)
                            Severity: Minor
                            Found in modules/backlogs/lib/open_project/backlogs/list.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

                            File wp-create.service.ts has 267 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            // -- copyright
                            // OpenProject is an open source project management software.
                            // Copyright (C) 2012-2024 the OpenProject GmbH
                            //
                            // This program is free software; you can redistribute it and/or

                              Method modify_conditions has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                def modify_conditions(node)
                                  if node.kind_of? Arel::TreeManager
                                    # We have another sub-tree, investigate its core, which is a SelectCore
                                    node.instance_variable_get(:@ast).instance_variable_get(:@cores).each do |core|
                                      modify_conditions(core)
                              Severity: Major
                              Found in app/models/journable/historic_active_record_relation.rb - About 2 hrs to fix

                                Function toggleFormat has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  private toggleFormat(format:string) {
                                    // defaults (reset these fields before doing anything else)
                                    this.activate(this.defaultBoolTargets, false);
                                    this.activate(this.defaultLongTextTargets, false);
                                    this.activate(this.multiSelectTargets, false);

                                  File links.rb has 265 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

                                  module OpenProject
                                    module Static
                                      module Links
                                        class << self
                                          def help_link_overridden?
                                  Severity: Minor
                                  Found in lib/open_project/static/links.rb - About 2 hrs to fix

                                    Function setupServerResponse has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    export function setupServerResponse() {
                                      initMainMenuExpandStatus();
                                      focusFirstErroneousField();
                                      activateFlashNotice();
                                      activateFlashError();
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language