cloudfoundry/cloud_controller_ng

View on GitHub
lib/vcap/rest_api/query.rb

Summary

Maintainability
A
1 hr
Test Coverage

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

    def query_datetime_values(key, values, comparison)
      # This filter assumes that datetimes might be stored with sub-second precision,
      # but the user will only see the times truncated at the second. Chances are that
      # queries are based on an object's timestamp rather than an arbitrary time value,
      # so we accept any value in that second range. These queries will pick up other
Severity: Minor
Found in lib/vcap/rest_api/query.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 parse has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def parse
      Query.uuid ||= SecureRandom.uuid
      segments = []

      query.each do |q|
Severity: Minor
Found in lib/vcap/rest_api/query.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 query_filter has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def query_filter(key, comparison, val)
      foreign_key_association = foreign_key_association(key)
      values = comparison == ' IN ' ? val.split(',') : [val]

      return clean_up_foreign_key(key, values, foreign_key_association) if foreign_key_association
Severity: Minor
Found in lib/vcap/rest_api/query.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