omniauth/omniauth

View on GitHub

Showing 9 of 9 total issues

File strategy.rb has 337 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'omniauth/key_store'

module OmniAuth
  class NoSessionError < StandardError; end
  # The Strategy is the base unit of OmniAuth's ability to
Severity: Minor
Found in lib/omniauth/strategy.rb - About 4 hrs to fix

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

        def call!(env) # rubocop:disable CyclomaticComplexity, PerceivedComplexity
          unless env['rack.session']
            error = OmniAuth::NoSessionError.new('You must provide a session to use OmniAuth.')
            raise(error)
          end
    Severity: Minor
    Found in lib/omniauth/strategy.rb - About 55 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 request_call has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def request_call # rubocop:disable CyclomaticComplexity, MethodLength, PerceivedComplexity
          setup_phase
          log :info, 'Request phase initiated.'
    
          # store query params from the request url, extracted in the callback_phase
    Severity: Minor
    Found in lib/omniauth/strategy.rb - About 55 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 initialize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def initialize(app, *args, &block) # rubocop:disable UnusedMethodArgument
          @app = app
          @env = nil
          @options = self.class.default_options.dup
    
    
    Severity: Minor
    Found in lib/omniauth/strategy.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 full_host has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def full_host
          case OmniAuth.config.full_host
          when String
            OmniAuth.config.full_host
          when Proc
    Severity: Minor
    Found in lib/omniauth/strategy.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

    Avoid too many return statements within this method.
    Open

          return other_phase if respond_to?(:other_phase)
    Severity: Major
    Found in lib/omniauth/strategy.rb - About 30 mins to fix

      Method provider has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def provider(klass, *args, &block)
            if klass.is_a?(Class)
              middleware = klass
            else
              begin
      Severity: Minor
      Found in lib/omniauth/builder.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 mock_request_call has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def mock_request_call
            setup_phase
      
            session['omniauth.params'] = request.GET
            OmniAuth.config.before_request_phase.call(env) if OmniAuth.config.before_request_phase
      Severity: Minor
      Found in lib/omniauth/strategy.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 mock_callback_call has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def mock_callback_call
            setup_phase
            @env['omniauth.origin'] = session.delete('omniauth.origin')
            @env['omniauth.origin'] = nil if env['omniauth.origin'] == ''
            @env['omniauth.params'] = session.delete('omniauth.params') || {}
      Severity: Minor
      Found in lib/omniauth/strategy.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