aserafin/grape_logging

View on GitHub

Showing 4 of 4 total issues

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

      def call(original_params, parents = [])
        filtered_params = {}

        original_params.each do |key, value|
          parents.push(key) if deep_regexps
Severity: Minor
Found in lib/grape_logging/util/parameter_filter.rb - About 4 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 compile has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def self.compile(replacement, filters)
        return lambda { |params| params.dup } if filters.empty?

        strings, regexps, blocks = [], [], []

Severity: Minor
Found in lib/grape_logging/util/parameter_filter.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 call! has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def call!(env)
        @env = env

        # Before hook
        before
Severity: Minor
Found in lib/grape_logging/middleware/request_logger.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 format_hash has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def format_hash(hash)
        # Create Rails' single summary line at the end of every request, formatted like:
        # Completed 200 OK in 958ms (Views: 951.1ms | ActiveRecord: 3.8ms)
        # See: actionpack/lib/action_controller/log_subscriber.rb

Severity: Minor
Found in lib/grape_logging/formatters/rails.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