FetLife/rollout

View on GitHub

Showing 4 of 4 total issues

Class Rollout has 33 methods (exceeds 20 allowed). Consider refactoring.
Open

class Rollout
  include Observable

  RAND_BASE = (2**32 - 1) / 100.0

Severity: Minor
Found in lib/rollout.rb - About 4 hrs to fix

    Method update has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def update(before, after)
            before_hash = before.to_hash
            before_hash.delete(:data).each do |k, v|
              before_hash["data.#{k}"] = v
            end
    Severity: Minor
    Found in lib/rollout/logging.rb - About 1 hr to fix

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

          def initialize(name, rollout:, state: nil, options: {})
            @name = name
            @rollout = rollout
            @options = options
      
      
      Severity: Minor
      Found in lib/rollout/feature.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 log has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def log(event, *args)
              return unless logging_enabled?
      
              unless respond_to?(event)
                raise ArgumentError, "Invalid log event: #{event}"
      Severity: Minor
      Found in lib/rollout/logging.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

      Severity
      Category
      Status
      Source
      Language