tstmedia/active_zuora

View on GitHub
lib/active_zuora/relation.rb

Summary

Maintainability
B
5 hrs
Test Coverage

Class Relation has 25 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Relation

    attr_accessor :selected_field_names, :filters, :order_attribute, :order_direction

    attr_reader :zobject_class
Severity: Minor
Found in lib/active_zuora/relation.rb - About 2 hrs to fix

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

        def where_statement
          return '' if @filters.empty?
          tokens = []
          @filters.each do |logical_operator, conditions|
            if conditions.is_a?(Hash)
    Severity: Minor
    Found in lib/active_zuora/relation.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 escape_filter_value has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def escape_filter_value(value)
          if value.nil?
            "null"
          elsif value.is_a?(String)
            "'#{value.gsub("'","\\\\'")}'"
    Severity: Minor
    Found in lib/active_zuora/relation.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 query has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def query(&block)
          # Keep querying until all pages are retrieved.
          # Throws an exception for an invalid query.
          response = zobject_class.connection.request(:query){ |soap| soap.body = { :query_string => to_zql } }
          query_response = response[:query_response]
    Severity: Minor
    Found in lib/active_zuora/relation.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 sort_records! has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def sort_records!(records)
          return records unless order_attribute.present?
          records.sort! do |a, b|
            if a.nil?
              -1
    Severity: Minor
    Found in lib/active_zuora/relation.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

    There are no issues that match your filters.

    Category
    Status