backlogs/redmine_backlogs

View on GitHub
app/models/rb_task.rb

Summary

Maintainability
C
1 day
Test Coverage

Method update_with_relationships has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

  def update_with_relationships(params, is_impediment = false)
    time_entry_add(params)

    attribs = RbTask.rb_safe_attributes(params)

Severity: Minor
Found in app/models/rb_task.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 time_entry_add has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def time_entry_add(params)
    # Will also save time entry if only comment is filled, hours will default to 0. We don't want the user
    # to loose a precious comment if hours is accidently left blank.
    if !params[:time_entry_hours].blank? || !params[:time_entry_comments].blank?
      @time_entry = TimeEntry.new(:issue => self, :project => self.project)
Severity: Minor
Found in app/models/rb_task.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 create_with_relationships has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def self.create_with_relationships(params, user_id, project_id, is_impediment = false)
    attribs = rb_safe_attributes(params)

    attribs['author_id'] = user_id
    attribs['tracker_id'] = RbTask.tracker
Severity: Minor
Found in app/models/rb_task.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_with_relationships has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def update_with_relationships(params, is_impediment = false)
    time_entry_add(params)

    attribs = RbTask.rb_safe_attributes(params)

Severity: Minor
Found in app/models/rb_task.rb - About 1 hr to fix

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

      def burndown(sprint = nil, status=nil)
        sprint ||= self.fixed_version.becomes(RbSprint) if self.fixed_version
        return nil if sprint.nil? || !sprint.has_burndown?
    
        self.history.filter(sprint, status).collect{|d|
    Severity: Minor
    Found in app/models/rb_task.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

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

      def self.find_all_updated_since(since, project_id, find_impediments = false, sprint_id = nil)
        #find all updated visible on taskboard - which may span projects.
        if sprint_id.nil?
          find(:all,
               :conditions => ["project_id = ? AND updated_on > ? AND tracker_id in (?) and parent_id IS #{ find_impediments ? '' : 'NOT' } NULL", project_id, Time.parse(since), tracker],
    Severity: Minor
    Found in app/models/rb_task.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

    Method move_before has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def move_before(id)
        id = nil if id.respond_to?('blank?') && id.blank?
        if id.nil?
          sib = self.siblings
          move_to_right_of sib[-1].id if sib.any?
    Severity: Minor
    Found in app/models/rb_task.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