opf/openproject

View on GitHub

Showing 635 of 1,693 total issues

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

  def self.lcs(a, b)
    astart = 0
    bstart = 0
    afinish = a.length - 1
    bfinish = b.length - 1
Severity: Minor
Found in lib_static/redmine/diff/array_string_diff.rb - About 1 hr to fix

    Function loadQuery has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      public loadQuery(visible = true, firstPage = false):Promise<QueryResource> {
    
        if (this.loadedQuery) {
          const query = this.loadedQuery;
          this.loadedQuery = undefined;

      Method render_group has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def render_group(type, initially_selected)
          initially_selected = initially_selected.map do |group_by|
            [group_by.class.underscore_name, h(group_by.class.label)]
          end
      
      
      Severity: Minor
      Found in modules/reporting/lib/widget/group_bys.rb - About 1 hr to fix

        Function init has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          protected init():void {
            // Set elements
            this
              .apiV3Service
              .projects

          Function checkForSpecialDisplaySituations has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            checkForSpecialDisplaySituations(renderInfo:RenderInfo, bar:HTMLElement) {
              const wp = renderInfo.workPackage;
              const row = bar.parentElement!.parentElement!;
              const selectionMode = renderInfo.viewParams.activeSelectionMode;
          
          

            Function show_filter has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              var show_filter = function (field, options) {
                var default_options = {
                  callback_func: function () {},
                  slowly: false,
                  show_filter: true,

              Method patch has 37 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def patch(diff)
                  newary = nil
                  newary = if diff.difftype == String
                             diff.difftype.new("")
                           else
              Severity: Minor
              Found in lib_static/redmine/diff/diffable.rb - About 1 hr to fix

                Method head has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def head
                    content_tag :thead do
                      content_tag :tr do
                        FIELDS.map do |field|
                          concat content_tag(:th) {
                Severity: Minor
                Found in modules/reporting/lib/widget/table/entry_table.rb - About 1 hr to fix

                  Function initializeDatepicker has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    private initializeDatepicker(minimalDate?:Date|null) {
                      this.datePickerInstance?.destroy();
                      this.datePickerInstance = new DatePicker(
                        this.injector,
                        this.id,

                    Function initializeDatepicker has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      private initializeDatepicker() {
                        this.datePickerInstance?.destroy();
                        this.datePickerInstance = new DatePicker(
                          this.injector,
                          '#flatpickr-input',

                      Function displayEditor has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          displayEditor: function (editor) {
                            var self = this,
                                baseClasses;
                      
                            baseClasses = 'ui-button ui-widget ui-state-default ui-corner-all';
                      Severity: Minor
                      Found in frontend/src/stimulus/controllers/dynamic/backlogs/model.js - About 1 hr to fix

                        Method render_popup_form has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          def render_popup_form
                            name = content_tag :p,
                                               class: "form--field -required -wide-label" do
                              label_tag(:query_name,
                                        class: "form--label -transparent") do
                        Severity: Minor
                        Found in modules/reporting/lib/widget/controls/save_as.rb - About 1 hr to fix

                          Function triggerContextMenuAction has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            public triggerContextMenuAction(action:WorkPackageAction) {
                              const { link } = action;
                              const id = this.workPackage.id as string;
                          
                              switch (action.key) {

                            Function createScrollSync has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export function createScrollSync($element:JQuery) {
                              const elTable = jQuery($element).find(selectorTableSide);
                              const elTimeline = jQuery($element).find(selectorTimelineSide);
                            
                              return (timelineVisible:boolean) => {

                              Function changeParent has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                public changeParent(workPackage:WorkPackageResource, parentId:string|null) {
                                  const payload:any = {
                                    lockVersion: workPackage.lockVersion,
                                  };
                              
                              

                                Function prepareUpload has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  private prepareUpload(href:string, uploadFile:AttachmentUploadFile):Observable<PrepareUploadData> {
                                    const fileName = uploadFile.file.name;
                                    const contentType = (uploadFile.file.type || (fileName && getType(fileName)) || '' as string);
                                    const metadata = {
                                      fileName,
                                Severity: Minor
                                Found in frontend/src/app/core/upload/fog-upload.service.ts - About 1 hr to fix

                                  Method update_done_ratio has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                    def update_done_ratio
                                      if WorkPackage.use_status_for_done_ratio?
                                        return unless work_package.status_id_changed?
                                  
                                        work_package.done_ratio = work_package.status.default_done_ratio
                                  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 unsupported_browser? has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                    def unsupported_browser?
                                      RequestStore.fetch(:unsupported_browser) do
                                        # Any version of IE
                                        return true if browser.ie?
                                  
                                  
                                  Severity: Minor
                                  Found in app/helpers/browser_helper.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 build_dep_lines has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      def build_dep_lines(page_groups)
                                        @all_work_packages.each do |work_package|
                                          work_package.relations.each do |relation|
                                            target_work_package = relation.other_work_package(work_package)
                                            next unless @all_work_packages.include?(target_work_package)
                                  Severity: Minor
                                  Found in app/models/work_package/pdf_export/gantt/gantt_builder.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 register! has a Cognitive Complexity of 12 (exceeds 5 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

                                  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

                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language