team-umlaut/umlaut

View on GitHub
app/models/request.rb

Summary

Maintainability
B
6 hrs
Test Coverage

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

  def self.find_or_create(params, session, a_rails_request, options = {} )



    # Pull out the http params that are for the context object,
Severity: Minor
Found in app/models/request.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 create_new_request! has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def self.create_new_request!( args )

    # all of these are required
    params = args[:params]
    session = args[:session]
Severity: Minor
Found in app/models/request.rb - About 1 hr to fix

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

      def self.create_new_request!( args )
    
        # all of these are required
        params = args[:params]
        session = args[:session]
    Severity: Minor
    Found in app/models/request.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 context_object_params has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.context_object_params(a_rails_request)   
        
        # GET params
        co_params = CGI::parse( a_rails_request.query_string )    
        # add in the POST params please
    Severity: Minor
    Found in app/models/request.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 co_params_fingerprint has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.co_params_fingerprint(params)
    
        # Don't use ctx_time, consider two co's equal if they are equal but for ctx_tim. 
        # exclude cache-busting "_" key that JQuery adds. Fine to bust HTTP cache, but
        # don't want to it to force new Umlaut processing. 
    Severity: Minor
    Found in app/models/request.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 add_service_response has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def add_service_response(response_data)
    
        raise ArgumentError.new("missing required `:service` key") unless response_data[:service].kind_of?(Service)
        raise ArgumentError.new("missing required `:service_type_value` key") unless response_data[:service_type_value]
        
    Severity: Minor
    Found in app/models/request.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 service_types_in_progress? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def service_types_in_progress?(type_array)
        # convert strings to ServiceTypeValues
        type_array = type_array.collect {|s|  s.kind_of?(ServiceTypeValue)? s : ServiceTypeValue[s] }
        
        self.services_in_progress.each do |s|
    Severity: Minor
    Found in app/models/request.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