zendesk/arturo

View on GitHub

Showing 4 of 4 total issues

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

        def cache_is_current?(cache, features)
          return unless features
          return true if cache.read("arturo.current")

          begin
Severity: Minor
Found in lib/arturo/feature_caching.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 arturos_from_origin has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        def arturos_from_origin(fallback:)
          Arturo::Feature.all.to_h { |f| [f.symbol.to_sym, f] }
        rescue ActiveRecord::ActiveRecordError
          raise unless Arturo::Feature.extend_cache_on_failure?

Severity: Minor
Found in lib/arturo/feature_caching.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 update_all has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def update_all
      updated_count = 0
      errors = []
      features_params.each do |id, attributes|
        feature = Arturo::Feature.find_by_id(id)
Severity: Minor
Found in app/controllers/arturo/features_controller.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 enable_feature! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def enable_feature!(name)
    if feature = Arturo::Feature.find_feature(name)
      feature = feature.class.find(feature.id) if feature.frozen?
      feature.update(:deployment_percentage => 100)
    else
Severity: Minor
Found in lib/arturo/test_support.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