opf/openproject

View on GitHub

Showing 635 of 1,693 total issues

Function detectOnboardingTour has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function detectOnboardingTour():void {
  // ------------------------------- Global -------------------------------
  const url = new URL(window.location.href);
  const isMobile = document.body.classList.contains('-browser-mobile');
  const demoProjectsAvailable = jQuery('meta[name=demo_projects_available]').attr('content') === 'true';

    Function registerWorkPackageMouseHandler has 13 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    export function registerWorkPackageMouseHandler(this:void,
      injector:Injector,
      getRenderInfo:() => RenderInfo,
      workPackageTimeline:WorkPackageTimelineTableController,
      halEditing:HalResourceEditingService,

      Method initialize has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def initialize
          self.issue_attributes = {}
      
          opts = GetoptLong.new(
            ["--help",           "-h", GetoptLong::NO_ARGUMENT],
      Severity: Minor
      Found in extra/mail_handler/rdm-mailhandler.rb - About 1 hr to fix

        Method to_html has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def to_html
                words = self.words.map { |word| h(word) }
                words_add = 0
                words_del = 0
                dels = 0
        Severity: Minor
        Found in lib/redmine/helpers/diff.rb - About 1 hr to fix

          Function insertInList has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const insertInList = (
            projects:IProject[],
            project:IProject,
            list:IProjectData[],
            ancestors:IHalResourceLink[],

            Function initializeCoreDisplayFields has 40 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function initializeCoreDisplayFields(displayFieldService:DisplayFieldService) {
              return () => {
                displayFieldService.defaultFieldType = 'text';
                displayFieldService
                  .addFieldType(TextDisplayField, 'text', ['String'])

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

                ngOnInit():void {
                  this.storage = this.storagesResourceService.requireEntity(this.projectStorage._links.storage.href);
              
                  this.fileLinks = this.collectionKey()
                    .pipe(

                Function showForm has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  protected showForm() {
                    this
                      .createdWorkPackage()
                      .then((changeset:WorkPackageChangeset) => {
                        this.change = changeset;

                  Function handleMouseMoveOnEmptyCell has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    function handleMouseMoveOnEmptyCell(ev:MouseEvent) {
                      const wp = renderInfo.workPackage;
                  
                      if (!renderer.isEmpty(wp)) {
                        return;

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

                      public ngOnInit() {
                        super.ngOnInit();
                    
                        this.htmlId = `user_activity_edit_field_${this.activityNo}`;
                        this.updateCommentText();

                      Function setQueryProps has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        private setQueryProps():void {
                          const filters:any[] = [];
                          let columns = ['id', 'project', 'subject', 'type', 'status', 'updatedAt'];
                      
                          if (this.globalSearchService.searchTermIsId) {

                        Method replace has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def replace(avatar)
                              if avatar.nil?
                                return ServiceResult.failure.tap do |_result|
                                  return error_result(I18n.t(:empty_file_error))
                                end
                        Severity: Minor
                        Found in modules/avatars/app/services/avatars/update_service.rb - About 1 hr 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_remaining_hours has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def update_remaining_hours
                            if WorkPackage.use_status_for_done_ratio?
                              update_remaining_hours_from_percent_complete
                            elsif WorkPackage.use_field_for_done_ratio? &&
                              work_package.estimated_hours_changed?
                        Severity: Minor
                        Found in app/services/work_packages/set_attributes_service.rb - About 1 hr 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 inspect_response has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                        Open

                              def inspect_response(auth_hash)
                                response = auth_hash.dig(:extra, :response_object)
                                if response
                                  code = response.status_code ? "(CODE #{response.status_code})" : nil
                                  message = response.status_message ? "(MESSAGE #{response.status_code})" : nil
                        Severity: Minor
                        Found in modules/auth_saml/lib/open_project/auth_saml/inspector.rb - About 1 hr 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 try_context_object has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                        Open

                                    def try_context_object
                                      if params[:context]
                                        context = parse_context
                                        namespace = context[:namespace]
                        
                        
                        Severity: Minor
                        Found in lib/api/v3/render/render_api.rb - About 1 hr 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 replaceDatesWithNewSelection has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                        Open

                          private replaceDatesWithNewSelection(activeField:DateFields, selectedDate:Date) {
                            /**
                             Overwrite flatpickr default behavior by not starting a new date range everytime but preserving either start or end date.
                             There are three cases to cover.
                             1. Everything before the current start date will become the new start date (independent of the active field)

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

                          private replaceDatesWithNewSelection(activeField:DateFields, selectedDate:Date) {
                            /**
                             Overwrite flatpickr default behavior by not starting a new date range everytime but preserving either start or end date.
                             There are three cases to cover.
                             1. Everything before the current start date will become the new start date (independent of the active field)

                        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 39 lines of code (exceeds 25 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 1 hr to fix

                          Method register! has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  def register!
                                    # Listen to enqueues
                                    ActiveSupport::Notifications.subscribe(/enqueue(_at)?\.active_job/) do |_name, _started, _call, _id, payload|
                                      job = payload[:job]
                                      next unless job
                          Severity: Minor
                          Found in modules/job_status/lib/open_project/job_status/event_listener.rb - About 1 hr to fix

                            Method rebuild_silently! has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                def rebuild_silently!(roots = nil)
                                  # Don't rebuild a valid tree.
                                  return true if valid?
                            
                                  scope = lambda { |_node| }
                            Severity: Minor
                            Found in lib/open_project/nested_set/rebuild_patch.rb - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language