backlogs/redmine_backlogs

View on GitHub
app/models/rb_story.rb

Summary

Maintainability
D
2 days
Test Coverage

Class RbStory has 37 methods (exceeds 20 allowed). Consider refactoring.
Open

class RbStory < Issue
  unloadable

  RELEASE_RELATIONSHIP = %w(auto initial continued added)

Severity: Minor
Found in app/models/rb_story.rb - About 4 hrs to fix

    File rb_story.rb has 366 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    class RbStory < Issue
      unloadable
    
      RELEASE_RELATIONSHIP = %w(auto initial continued added)
    
    
    Severity: Minor
    Found in app/models/rb_story.rb - About 4 hrs to fix

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

        def burndown(sprint = nil, status=nil)
          return nil unless self.is_story?
          sprint ||= self.fixed_version.becomes(RbSprint) if self.fixed_version
          return nil if sprint.nil? || !sprint.has_burndown?
      
      
      Severity: Minor
      Found in app/models/rb_story.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

      Method story_follow_task_state has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

        def story_follow_task_state
          return if Setting.plugin_redmine_backlogs[:story_follow_task_status] != 'close' && Setting.plugin_redmine_backlogs[:story_follow_task_status] != 'loose'
          return if self.status.is_closed? #bail out if we are closed
      
          self.reload #we might be stale at this point
      Severity: Minor
      Found in app/models/rb_story.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

      Method calculate_release_burndown_data has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def calculate_release_burndown_data(days, release_burndown_id)
          baseline = [0] * days.size
      
          series = Backlogs::MergedArray.new
          series.merge(:total_points => baseline.dup)
      Severity: Minor
      Found in app/models/rb_story.rb - About 1 hr to fix

        Method calculate_release_burndown_data has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

          def calculate_release_burndown_data(days, release_burndown_id)
            baseline = [0] * days.size
        
            series = Backlogs::MergedArray.new
            series.merge(:total_points => baseline.dup)
        Severity: Minor
        Found in app/models/rb_story.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 find_options has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

          def self.find_options(options)
            options = options.dup
        
            project = options.delete(:project)
            if project.nil?
        Severity: Minor
        Found in app/models/rb_story.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 save_release_burnchart_data has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

          def save_release_burnchart_data(series,release_burndown_id)
            RbReleaseBurnchartDayCache.delete_all(
              ["issue_id = ? AND release_id = ? AND day IN (?)",
               self.id,
               release_burndown_id,
        Severity: Minor
        Found in app/models/rb_story.rb - About 55 mins 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 position! has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def position!(params)
            if params.include?('prev')
              if params['prev'].blank?
                self.move_to_top # move after 'prev'. Meaning no prev, we go at top
              else
        Severity: Minor
        Found in app/models/rb_story.rb - About 45 mins 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

        Consider simplifying this complex logical expression.
        Open

            return p.points if p.rejected == false &&
              (release_id == release_burndown_id || p.in_release) &&
              ( continued_story? == false || continued_story? == true && created_on.to_date <= p.day)
        Severity: Major
        Found in app/models/rb_story.rb - About 40 mins to fix

          Method __find_options_add_permissions has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

            def self.__find_options_add_permissions(options)
              permission = options.delete(:permission)
              permission = false if permission.nil?
          
              options[:conditions] ||= []
          Severity: Minor
          Found in app/models/rb_story.rb - About 35 mins 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 __find_options_normalize_option has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

            def self.__find_options_normalize_option(option)
              option = [option] if option && !option.is_a?(Array)
              option = option.collect{|s| s.is_a?(Integer) ? s : s.id} if option
            end
          Severity: Minor
          Found in app/models/rb_story.rb - About 35 mins 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 set_closed_status_if_following_to_close has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

            def set_closed_status_if_following_to_close
                  status_id = Setting.plugin_redmine_backlogs[:story_close_status_id]
                  unless status_id.nil? || status_id.to_i == 0
                    # bail out if something is other than closed.
                    tasks.each{|task|
          Severity: Minor
          Found in app/models/rb_story.rb - About 35 mins 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 calc_total_manual has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

            def calc_total_manual(p,days,release_burndown_id)
              return p.points if p.rejected == false &&
                (release_id == release_burndown_id || p.in_release) &&
                ( continued_story? == false || continued_story? == true && created_on.to_date <= p.day)
              # See description for calc_total_auto
          Severity: Minor
          Found in app/models/rb_story.rb - About 25 mins 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 trackers has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

            def self.trackers(options = {})
              # legacy
              options = {:type => options} if options.is_a?(Symbol)
          
              # somewhere early in the initialization process during first-time migration this gets called when the table doesn't yet exist
          Severity: Minor
          Found in app/models/rb_story.rb - About 25 mins 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

          There are no issues that match your filters.

          Category
          Status