gitlabhq/gitlabhq

View on GitHub
app/models/event.rb

Summary

Maintainability
D
1 day
Test Coverage

Class Event has 51 methods (exceeds 20 allowed). Consider refactoring.
Open

class Event < ApplicationRecord
  include Sortable
  include FromUnion
  include Presentable

Severity: Major
Found in app/models/event.rb - About 7 hrs to fix

    File event.rb has 303 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    class Event < ApplicationRecord
      include Sortable
      include FromUnion
      include Presentable
    
    
    Severity: Minor
    Found in app/models/event.rb - About 3 hrs to fix

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

        def visible_to_user?(user = nil)
          if push_action? || commit_note?
            Ability.allowed?(user, :download_code, project)
          elsif membership_changed?
            Ability.allowed?(user, :read_project, project)
      Severity: Minor
      Found in app/models/event.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 action_name has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

        def action_name
          if push_action?
            push_action_name
          elsif closed_action?
            "closed"
      Severity: Minor
      Found in app/models/event.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

      There are no issues that match your filters.

      Category
      Status