Showing 7 of 7 total issues
Method base_init_schema
has a Cognitive Complexity of 31 (exceeds 11 allowed). Consider refactoring. Open
def self.base_init_schema(request, graphql_options, schema_overlay = {})
api_version = ::Insights::API::Common::GraphQL.version(request)
version_namespace = "V#{api_version.tr('.', 'x')}"
openapi_doc = ::Insights::API::Common::OpenApi::Docs.instance[api_version]
openapi_content = openapi_doc.content
- Read upRead up
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 openapi_schema_properties_value
has a Cognitive Complexity of 20 (exceeds 11 allowed). Consider refactoring. Open
def openapi_schema_properties_value(klass_name, model, key, value)
if key == model.primary_key
{
"$ref" => "##{SCHEMAS_PATH}/ID"
}
- Read upRead up
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 build_paths
has a Cognitive Complexity of 15 (exceeds 11 allowed). Consider refactoring. Open
def build_paths
applicable_rails_routes.each_with_object({}) do |route, expected_paths|
without_format = route.path.split("(.:format)").first
sub_path = without_format.split(server_base_path).last.sub(/:[_a-z]*id/, "{id}")
route_destination = route.controller.split("/").last.camelize
- Read upRead up
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 paginate
has a Cognitive Complexity of 14 (exceeds 11 allowed). Consider refactoring. Open
def self.paginate(obj, method, pagination_options, *method_args)
Enumerator.new do |enum|
opts = { :limit => 10, :offset => 0 }.merge(pagination_options)
count = nil
fetched = 0
- Read upRead up
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_by_associations_query_parameters
has a Cognitive Complexity of 13 (exceeds 11 allowed). Consider refactoring. Open
def sort_by_associations_query_parameters
select_for_associations = []
group_by_associations = []
count_selects = []
- Read upRead up
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 compact_filter
has a Cognitive Complexity of 13 (exceeds 11 allowed). Consider refactoring. Open
def self.compact_filter(filter)
result = {}
return result if filter.blank?
return filter unless filter.kind_of?(Hash) || filter.kind_of?(ActionController::Parameters)
- Read upRead up
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 resource_associations
has a Cognitive Complexity of 12 (exceeds 11 allowed). Consider refactoring. Open
def self.resource_associations(openapi_content, collection)
collection_is_associated = openapi_content["paths"].keys.any? do |path|
path.match?("^/[^/]*/{[[a-z]*_]*id}/#{collection}$") &&
openapi_content.dig("paths", path, "get").present?
end
- Read upRead up
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"