glittergallery/GlitterGallery

View on GitHub
lib/rack/grack_auth.rb

Summary

Maintainability
A
1 hr
Test Coverage

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

    def authorized_request?
      case git_cmd
      when *%w( git-upload-pack git-upload-archive )
        if user
          ProjectMember.member?(project, user)
Severity: Minor
Found in lib/rack/grack_auth.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 project_by_path has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def project_by_path(path)
      if m = /^([\w\.\/-]+)\.git/.match(path).to_a
        path_with_namespace = m.last
        path_with_namespace[0] = '' if path_with_namespace.start_with?('/')
        return nil unless path_with_namespace.include?('/')
Severity: Minor
Found in lib/rack/grack_auth.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 a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def call(env)
      @env = env
      @request = Rack::Request.new(env)
      @auth = Request.new(env)

Severity: Minor
Found in lib/rack/grack_auth.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

There are no issues that match your filters.

Category
Status