rubycas/rubycas-client

View on GitHub

Showing 25 of 25 total issues

Method filter has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring.
Open

          def filter(controller)
            raise "Cannot use the CASClient filter because it has not yet been configured." if config.nil?
            
            if @@fake_user
              controller.session[client.username_session_key] = @@fake_user
Severity: Minor
Found in lib/casclient/frameworks/rails/filter.rb - About 1 day 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 filter has 81 lines of code (exceeds 25 allowed). Consider refactoring.
Open

          def filter(controller)
            raise "Cannot use the CASClient filter because it has not yet been configured." if config.nil?
            
            if @@fake_user
              controller.session[client.username_session_key] = @@fake_user
Severity: Major
Found in lib/casclient/frameworks/rails/filter.rb - About 3 hrs to fix

    Method parse has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

        def parse(raw_text, options)
          raise BadResponseException, 
            "CAS response is empty/blank." if raw_text.to_s.empty?
          @parse_datetime = Time.now
          if raw_text =~ /^(yes|no)\n(.*?)\n$/m
    Severity: Minor
    Found in lib/casclient/responses.rb - About 2 hrs 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 logout_url has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        def logout_url(destination_url = nil, follow_url = nil, service_url = nil)
          url = @logout_url || (cas_base_url + "/logout")
          uri = URI.parse(url)
          service_url = (service_url if service_url) || @service_url
          h = uri.query ? query_to_hash(uri.query) : {}
    Severity: Minor
    Found in lib/casclient/client.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 parse has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def parse(raw_text, options)
          raise BadResponseException, 
            "CAS response is empty/blank." if raw_text.to_s.empty?
          @parse_datetime = Time.now
          if raw_text =~ /^(yes|no)\n(.*?)\n$/m
    Severity: Minor
    Found in lib/casclient/responses.rb - About 1 hr to fix

      Method configure has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def configure(conf)
            #TODO: raise error if conf contains unrecognized cas options (this would help detect user typos in the config)
      
            raise ArgumentError, "Missing :cas_base_url parameter!" unless conf[:cas_base_url]
      
      
      Severity: Minor
      Found in lib/casclient/client.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 parse_extra_attribute_value has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def parse_extra_attribute_value(value, encode_extra_attributes_as)
            attr_value = if value.to_s.empty?
               nil
             elsif !encode_extra_attributes_as
               begin
      Severity: Minor
      Found in lib/casclient/responses.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 configure has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def configure(conf)
            #TODO: raise error if conf contains unrecognized cas options (this would help detect user typos in the config)
      
            raise ArgumentError, "Missing :cas_base_url parameter!" unless conf[:cas_base_url]
      
      
      Severity: Minor
      Found in lib/casclient/client.rb - About 1 hr to fix

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

                  def unauthorized!(controller, vr = nil)
                    format = nil
                    unless controller.request.format.nil?
                      format = controller.request.format.to_sym
                    end
        Severity: Minor
        Found in lib/casclient/frameworks/rails/filter.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 parse_http_response has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            def parse_http_response(http_response)
              header = http_response.to_hash
        
              # FIXME: this regexp might be incorrect...
              if header['set-cookie'] && 
        Severity: Minor
        Found in lib/casclient/responses.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 parse_extra_attribute_value has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def parse_extra_attribute_value(value, encode_extra_attributes_as)
              attr_value = if value.to_s.empty?
                 nil
               elsif !encode_extra_attributes_as
                 begin
        Severity: Minor
        Found in lib/casclient/responses.rb - About 1 hr to fix

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

                    def redirect_to_cas_for_authentication(controller)
                      redirect_url = login_url(controller)
                      
                      if use_gatewaying?
                        controller.session[:cas_sent_to_gateway] = true
          Severity: Minor
          Found in lib/casclient/frameworks/rails/filter.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 deeply nested control flow statements.
          Open

                              if pgt
                                log.debug("Got PGT #{pgt.ticket.inspect} for PGT IOU #{pgt.iou.inspect}. This will be stored in the session.")
                                controller.session[:cas_pgt] = pgt
                                # For backwards compatibility with RubyCAS-Client 1.x configurations...
                                controller.session[:casfilterpgt] = pgt
          Severity: Major
          Found in lib/casclient/frameworks/rails/filter.rb - About 45 mins to fix

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

                def hash_to_query(hash)
                  pairs = []
                  hash.each do |k, vals|
                    vals = [vals] unless vals.kind_of? Array
                    vals.each {|v| pairs << (v.nil? ? CGI.escape(k) : "#{CGI.escape(k)}=#{CGI.escape(v)}")}
            Severity: Minor
            Found in lib/casclient/client.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 false
            Severity: Major
            Found in lib/casclient/frameworks/rails/filter.rb - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                              return true
              Severity: Major
              Found in lib/casclient/frameworks/rails/filter.rb - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                            return false
                Severity: Major
                Found in lib/casclient/frameworks/rails/filter.rb - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                                    return true
                  Severity: Major
                  Found in lib/casclient/frameworks/rails/filter.rb - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                    return false
                    Severity: Major
                    Found in lib/casclient/frameworks/rails/filter.rb - About 30 mins to fix

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

                          def parse(raw_text)
                            raise BadResponseException, 
                              "CAS response is empty/blank." if raw_text.to_s.empty?
                            @parse_datetime = Time.now
                      
                      
                      Severity: Minor
                      Found in lib/casclient/responses.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