backlogs/redmine_backlogs

View on GitHub
lib/backlogs_issue_patch.rb

Summary

Maintainability
C
1 day
Test Coverage

Method backlogs_before_save has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
Open

      def backlogs_before_save
        if Backlogs.configured?(project)
          if (self.is_task? || self.story)
            self.remaining_hours = self.estimated_hours if self.remaining_hours.blank?
            self.estimated_hours = self.remaining_hours if self.estimated_hours.blank?
Severity: Minor
Found in lib/backlogs_issue_patch.rb - About 6 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 has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

      def story
        if @rb_story.nil?
          if self.new_record?
            parent_id = self.parent_id
            parent_id = self.parent_issue_id if parent_id.blank?
Severity: Minor
Found in lib/backlogs_issue_patch.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 backlogs_after_save has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def backlogs_after_save
        self.history.save!
        self.invalidate_release_burnchart_data

        [self.parent_id, self.parent_id_was].compact.uniq.each{|pid|
Severity: Minor
Found in lib/backlogs_issue_patch.rb - About 1 hr to fix

    Method blocks has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def blocks(include_closed = false)
            # return issues that I block that aren't closed
            return [] if closed? and !include_closed
            begin
              return relations_from.collect {|ir| ir.relation_type == 'blocks' && (!ir.issue_to.closed? || include_closed) ? ir.issue_to : nil }.compact
    Severity: Minor
    Found in lib/backlogs_issue_patch.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

    Avoid deeply nested control flow statements.
    Open

                  self.due_date = self.start_date if self.due_date && self.due_date < self.start_date
    Severity: Major
    Found in lib/backlogs_issue_patch.rb - About 45 mins to fix

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

            def backlogs_after_save
              self.history.save!
              self.invalidate_release_burnchart_data
      
              [self.parent_id, self.parent_id_was].compact.uniq.each{|pid|
      Severity: Minor
      Found in lib/backlogs_issue_patch.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

      There are no issues that match your filters.

      Category
      Status