moomerman/opi

View on GitHub

Showing 7 of 7 total issues

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

      def run_before_filters
        skip = route.options[:skip] || []
        skip = [skip] unless skip.is_a? Array

        route_before = route.options[:before] || []
Severity: Minor
Found in lib/opi/context.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 route has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def route(method, path)
      method_routes = self.routes.find_all{|x| x.method == method}
      method_routes.each do |route|
        if route.path =~ WILDCARD_PATTERN
          src = "\\A#{route.path.gsub('*','(.*)')}\\Z"
Severity: Minor
Found in lib/opi/router.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 initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def initialize(method, path, options, before, after, block)
Severity: Minor
Found in lib/opi/route.rb - About 45 mins to fix

    Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def initialize(root='', options={}, before=[], after=[], block=nil)
    Severity: Minor
    Found in lib/opi/resource.rb - About 35 mins to fix

      Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def initialize(env, logger, route, request, response)
      Severity: Minor
      Found in lib/opi/context.rb - About 35 mins to fix

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

              def funkyload(file)
                begin
                  if cache = loadcache[file]
                    return if ENV['RACK_ENV'] == 'production'
        
        
        Severity: Minor
        Found in lib/opi/loader.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 call has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def call(env)
              logger.debug env.inspect.cyan
        
              request = Request.new(env)
              response = Response.new
        Severity: Minor
        Found in lib/opi/api.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