omniauth/omniauth

View on GitHub

Showing 11 of 11 total issues

File strategy.rb has 379 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 5 hrs to fix

    Method request_call has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def request_call # rubocop:disable CyclomaticComplexity, MethodLength, PerceivedComplexity
          setup_phase
          log :debug, 'Request phase initiated.'
    
          # store query params from the request url, extracted in the callback_phase
    Severity: Minor
    Found in lib/omniauth/strategy.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 12 (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 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 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

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

        def auth_hash
          credentials_data = credentials
          extra_data = extra
          AuthHash.new(:provider => name, :uid => uid).tap do |auth|
            auth.info = info unless skip_info?
    Severity: Minor
    Found in lib/omniauth/strategy.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 mock_request_call has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def mock_request_call
          setup_phase
    
          session['omniauth.params'] = request.GET
    
    
    Severity: Minor
    Found in lib/omniauth/strategy.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

    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

      Avoid too many return statements within this method.
      Open

              return fail!(e.message, e)
      Severity: Major
      Found in lib/omniauth/strategy.rb - About 30 mins to fix

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

            def mock_call!(*)
              begin
                return mock_request_call if on_request_path? && OmniAuth.config.allowed_request_methods.include?(request.request_method.downcase.to_sym)
                return mock_callback_call if on_callback_path?
              rescue StandardError => e
        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