team-umlaut/umlaut

View on GitHub
app/service_adaptors/ezproxy.rb

Summary

Maintainability
B
5 hrs
Test Coverage

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

  def excluded?(url)    
    return false if @exclude.blank?
    
    @exclude.each do |entry|
      if ((entry[0,1] == '/') && (entry[entry.length()-1 ,1 ] == '/'))
Severity: Minor
Found in app/service_adaptors/ezproxy.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 check_proxy_urls has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def check_proxy_urls(urls)
    url_doc = REXML::Document.new
    doc_root = url_doc.add_element "proxy_url_request", {"password"=>@proxy_password}
    urls_elem = doc_root.add_element "urls"
    urls.each { | link |
Severity: Minor
Found in app/service_adaptors/ezproxy.rb - About 1 hr to fix

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

      def check_proxy_urls(urls)
        url_doc = REXML::Document.new
        doc_root = url_doc.add_element "proxy_url_request", {"password"=>@proxy_password}
        urls_elem = doc_root.add_element "urls"
        urls.each { | link |
    Severity: Minor
    Found in app/service_adaptors/ezproxy.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 false
    Severity: Major
    Found in app/service_adaptors/ezproxy.rb - About 30 mins to fix

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

        def link_out_filter(orig_url, service_response, other_args = {})
          # remove trailing or leading whitespace from url, it makes it
          # an illegal URL anyway, but maybe we can rescue it? Marc 856's
          # sometimes have accidental trailing whitespace. 
          orig_url = orig_url.strip
      Severity: Minor
      Found in app/service_adaptors/ezproxy.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

      There are no issues that match your filters.

      Category
      Status