airbrake/airbrake

View on GitHub

Showing 6 of 6 total issues

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

      def self.recognize_route(request)
        # Duplicate `request` because `recognize` *can* strip the request's
        # `path_info`, which results in broken engine links (when the engine has
        # an isolated namespace).
        request_copy = request.dup
Severity: Minor
Found in lib/airbrake/rails/app.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 call has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

      def call(worker, queue, _sqs_msg, body, &block)
Severity: Minor
Found in lib/airbrake/shoryuken.rb - About 35 mins to fix

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

          def call(*args)
            return unless Airbrake::Config.instance.performance_stats
    
            routes = Airbrake::Rack::RequestStore[:routes]
            return if !routes || routes.none?
    Severity: Minor
    Found in lib/airbrake/rails/action_controller_performance_breakdown_subscriber.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 action has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

          def action(context)
            klass = context['class'] || (context[:job] && context[:job]['class'])
            return klass unless context[:job] && context[:job]['args'].first.is_a?(Hash)
            return klass unless (job_class = context[:job]['args'].first['job_class'])
    
    
    Severity: Minor
    Found in lib/airbrake/sidekiq.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 task_info has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def task_info
            info = {}
    
            info[:name] = name
            info[:timestamp] = timestamp.to_s
    Severity: Minor
    Found in lib/airbrake/rake.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 call has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def call(*args)
            return unless Airbrake::Config.instance.performance_stats
    
            # We don't track routeless events.
            return unless (routes = Airbrake::Rack::RequestStore[:routes])
    Severity: Minor
    Found in lib/airbrake/rails/action_controller_route_subscriber.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