travis-ci/job-board

View on GitHub
lib/job_board/auth.rb

Summary

Maintainability
A
3 hrs
Test Coverage

Method call has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def call(env)
      auth = Request.new(env)

      if site_paths =~ auth.request.path_info &&
         !env.key?('HTTP_TRAVIS_SITE')
Severity: Minor
Found in lib/job_board/auth.rb - About 1 hr to fix

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

        def call(env)
          auth = Request.new(env)
    
          if site_paths =~ auth.request.path_info &&
             !env.key?('HTTP_TRAVIS_SITE')
    Severity: Minor
    Found in lib/job_board/auth.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

    Avoid too many return statements within this method.
    Open

            return unauthorized
    Severity: Major
    Found in lib/job_board/auth.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

              return @app.call(env)
      Severity: Major
      Found in lib/job_board/auth.rb - About 30 mins to fix

        Empty line detected around arguments.
        Open

        
              raw_auth_tokens.split(',').map do |pair|
        Severity: Minor
        Found in lib/job_board/auth.rb by rubocop

        This cops checks if empty lines exist around the arguments of a method invocation.

        Example:

        # bad
        do_something(
          foo
        
        )
        
        process(bar,
        
                baz: qux,
                thud: fred)
        
        some_method(
        
          [1,2,3],
          x: y
        )
        
        # good
        do_something(
          foo
        )
        
        process(bar,
                baz: qux,
                thud: fred)
        
        some_method(
          [1,2,3],
          x: y
        )

        Empty line detected around arguments.
        Open

        
              auth_tokens.include?(auth.basic_credentials.last) ||
        Severity: Minor
        Found in lib/job_board/auth.rb by rubocop

        This cops checks if empty lines exist around the arguments of a method invocation.

        Example:

        # bad
        do_something(
          foo
        
        )
        
        process(bar,
        
                baz: qux,
                thud: fred)
        
        some_method(
        
          [1,2,3],
          x: y
        )
        
        # good
        do_something(
          foo
        )
        
        process(bar,
                baz: qux,
                thud: fred)
        
        some_method(
          [1,2,3],
          x: y
        )

        Empty line detected around arguments.
        Open

        
              true
        Severity: Minor
        Found in lib/job_board/auth.rb by rubocop

        This cops checks if empty lines exist around the arguments of a method invocation.

        Example:

        # bad
        do_something(
          foo
        
        )
        
        process(bar,
        
                baz: qux,
                thud: fred)
        
        some_method(
        
          [1,2,3],
          x: y
        )
        
        # good
        do_something(
          foo
        )
        
        process(bar,
                baz: qux,
                thud: fred)
        
        some_method(
          [1,2,3],
          x: y
        )

        There are no issues that match your filters.

        Category
        Status