Showing 408 of 408 total issues
Class has too many lines. [189/100] Open
class Composer
include Clearly::Query::Compose::Conditions
include Clearly::Query::Validate
# All text fields operator.
- Read upRead up
- Exclude checks
This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Module has too many lines. [135/100] Open
module Validate
# Validate table and column values.
# @param [Arel::Table] table
# @param [Symbol] column_name
- Read upRead up
- Exclude checks
This cop checks if the length a module exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Module has too many lines. [132/100] Open
module Conditions
include Clearly::Query::Compose::Comparison
include Clearly::Query::Compose::Core
include Clearly::Query::Compose::Range
include Clearly::Query::Compose::Subset
- Read upRead up
- Exclude checks
This cop checks if the length a module exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Assignment Branch Condition size for subquery is too high. [52.86/15] Open
def subquery(definition, other_definition, conditions)
validate_definition_instance(definition)
validate_definition_instance(other_definition)
[conditions].flatten.each { |c| validate_node_or_attribute(c) }
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Method has too many lines. [37/10] Open
def subquery(definition, other_definition, conditions)
validate_definition_instance(definition)
validate_definition_instance(other_definition)
[conditions].flatten.each { |c| validate_node_or_attribute(c) }
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Assignment Branch Condition size for validate_definition is too high. [38/15] Open
def validate_definition(value)
validate_not_blank(value)
validate_hash(value)
# fields
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Assignment Branch Condition size for validate_array_items is too high. [37.85/15] Open
def validate_array_items(value)
# must be a collection of items
if !value.respond_to?(:each) || !value.respond_to?(:all?) || !value.respond_to?(:any?) || !value.respond_to?(:count)
fail Clearly::Query::QueryArgumentError, "must be a collection of items, got '#{value.class}'"
end
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Assignment Branch Condition size for parse_range is too high. [36.81/15] Open
def parse_range(hash)
unless hash.is_a?(Hash)
fail Clearly::Query::QueryArgumentError.new(
"range filter must be {'from': 'value', 'to': 'value'} " +
"or {'interval': '(|[.*,.*]|)'} got '#{hash}'", {hash: hash})
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Method has too many lines. [28/10] Open
def condition_node_subset(operator, node, value)
case operator
when :range, :in_range
compose_range_node(node, value)
when :not_range, :not_in_range
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Assignment Branch Condition size for parse_custom is too high. [33/15] Open
def parse_custom(definition, field, value)
validate_definition_instance(definition)
validate_symbol(field)
fail Clearly::Query::QueryArgumentError.new('field name must contain a dot (.)') unless field.to_s.include?('.')
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Method has too many lines. [27/10] Open
def parse_conditions(definition, query_key, query_value)
if query_value.blank? || query_value.size < 1
msg = "filter hash must have at least 1 entry, got '#{query_value.size}'"
fail Clearly::Query::QueryArgumentError.new(msg, {hash: query_value})
end
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Assignment Branch Condition size for parse_conditions is too high. [32.39/15] Open
def parse_conditions(definition, query_key, query_value)
if query_value.blank? || query_value.size < 1
msg = "filter hash must have at least 1 entry, got '#{query_value.size}'"
fail Clearly::Query::QueryArgumentError.new(msg, {hash: query_value})
end
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Method has too many lines. [25/10] Open
def parse_range(hash)
unless hash.is_a?(Hash)
fail Clearly::Query::QueryArgumentError.new(
"range filter must be {'from': 'value', 'to': 'value'} " +
"or {'interval': '(|[.*,.*]|)'} got '#{hash}'", {hash: hash})
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Method has too many lines. [24/10] Open
def condition_node_comparison(operator, node, value)
case operator
when :eq, :equal
compose_eq_node(node, value)
when :not_eq, :not_equal
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Method has too many lines. [22/10] Open
def create_from_table(table)
validate_table(table)
@model = nil
@table = table
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Method has too many lines. [21/10] Open
def validate_array_items(value)
# must be a collection of items
if !value.respond_to?(:each) || !value.respond_to?(:all?) || !value.respond_to?(:any?) || !value.respond_to?(:count)
fail Clearly::Query::QueryArgumentError, "must be a collection of items, got '#{value.class}'"
end
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Method validate_array_items
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def validate_array_items(value)
# must be a collection of items
if !value.respond_to?(:each) || !value.respond_to?(:all?) || !value.respond_to?(:any?) || !value.respond_to?(:count)
fail Clearly::Query::QueryArgumentError, "must be a collection of items, got '#{value.class}'"
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"
Further reading
Method has too many lines. [20/10] Open
def create_from_model(model, hash)
validate_model(model)
validate_definition(hash)
@model = model
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Assignment Branch Condition size for create_from_model is too high. [24.43/15] Open
def create_from_model(model, hash)
validate_model(model)
validate_definition(hash)
@model = model
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Assignment Branch Condition size for build_associations_flat is too high. [23/15] Open
def build_associations_flat(associations)
joins = []
if associations.is_a?(Array)
more_associations = associations.map { |i| build_associations_flat(i) }
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric