team-umlaut/umlaut

View on GitHub
app/controllers/search_methods/sfx4.rb

Summary

Maintainability
B
6 hrs
Test Coverage

Method find_by_title has 67 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def find_by_title
      connection = sfx4_db_connection
      query_match_clause = case search_type_param
        when "contains"
          terms = title_query_param.split(" ")
Severity: Major
Found in app/controllers/search_methods/sfx4.rb - About 2 hrs to fix

    Method find_by_title has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        def find_by_title
          connection = sfx4_db_connection
          query_match_clause = case search_type_param
            when "contains"
              terms = title_query_param.split(" ")
    Severity: Minor
    Found in app/controllers/search_methods/sfx4.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 sfx4_db_to_ctxobj has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def sfx4_db_to_ctxobj(title_rows)
          title_rows.collect do |sfx_obj|
            ctx = OpenURL::ContextObject.new
            # Start out wtih everything in search, to preserve date/vol/etc
            ctx.import_context_object( context_object_from_params )        
    Severity: Minor
    Found in app/controllers/search_methods/sfx4.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 find_by_group has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def find_by_group
          connection = sfx4_db_connection
          from_where_clause = %{
               FROM 
                  AZ_TITLE T 
    Severity: Minor
    Found in app/controllers/search_methods/sfx4.rb - About 1 hr to fix

      There are no issues that match your filters.

      Category
      Status