scotdalton/authpds

View on GitHub

Showing 7 of 7 total issues

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

        def initialize(pds_url, calling_system, pds_handle, attribute)
          raise ArgumentError.new("Argument Error in #{self.class}. :pds_url not specified in config.") if pds_url.nil?;
          raise ArgumentError.new("Argument Error in #{self.class}. :calling_system not specified in config.") if calling_system.nil?;
          raise ArgumentError.new("Argument Error in #{self.class}. :pds_handle is null.") if pds_handle.nil?;
          raise ArgumentError.new("Argument Error in #{self.class}. :attribute is null.") if pds_handle.nil?;
Severity: Minor
Found in lib/authpds/exlibris/pds.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 validate_url has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def validate_url(params={})
        url = controller.send(validate_url_name, 
          :return_url => user_session_redirect_url(params[:return_url]))
        return url if params.blank?
        url << "?" if url.match('\?').blank?
Severity: Minor
Found in lib/authpds/session/url_handling.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 pds_user has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def pds_user
        @pds_user ||= Authpds::Exlibris::Pds::BorInfo.new(pds_url,
          calling_system, pds_handle) unless pds_handle.nil?
        return @pds_user unless @pds_user.nil? or @pds_user.error
      rescue Exception => e
Severity: Minor
Found in lib/authpds/session/pds_user.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(pds_url, calling_system, pds_handle)
          super(pds_url, calling_system, pds_handle, "bor_info")
          raise RuntimeError.new( 
            "Error in #{self.class}."+
            "Unrecognized response: #{@response}.") unless @response.root.name.eql?("bor-info") or @response.root.name.eql?("pds")
Severity: Minor
Found in lib/authpds/exlibris/pds.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 institutions= has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def institutions=(new_institutions)
        unless new_institutions.is_a?(Array)
          raise ArgumentError.new("Institutions input should be an array.")
        end
        # Collect the codes as symbols
Severity: Minor
Found in lib/authpds/acts_as_authentic/institutions_attributes.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 destroy has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def destroy
        user_session = UserSession.find
        logout_url = user_session.logout_url(params) unless user_session.nil?
        user_session.destroy unless user_session.nil?
        redirect_to user_session_redirect_url(logout_url) unless performed?
Severity: Minor
Found in lib/authpds/controllers/authpds_sessions_controller.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 authenticate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def authenticate
        # Don't authenticate if the system is inaccessible.
        # If the application session id is nil, skip this check.
        return false if controller.cookies["#{calling_system}_inaccessible".to_sym] == true
        # If PDS session already established, authenticate
Severity: Minor
Found in lib/authpds/session/authentication.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