lib/datashift/populators/has_many.rb
Method call
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
Open
def self.call(load_object, value, method_binding)
# there are times when we need to save early, for example before assigning to
# has_and_belongs_to associations which require the load_object has an id for the join table
- 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 call
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def self.call(load_object, value, method_binding)
# there are times when we need to save early, for example before assigning to
# has_and_belongs_to associations which require the load_object has an id for the join table
Assignment Branch Condition size for call is too high. [61.85/60] Open
Open
def self.call(load_object, value, method_binding)
# there are times when we need to save early, for example before assigning to
# has_and_belongs_to associations which require the load_object has an id for the join table
- 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
Block has too many lines. [29/25] Open
Open
columns.each do |col_str|
# split into usable parts ; size:large or colour:red,green,blue
field, find_by_values = Querying.where_field_and_values(method_binding, col_str )
raise "Cannot perform DB find by #{field}. Expected format key:value" unless field && find_by_values
- Read upRead up
- Exclude checks
This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.
TODO found Open
Open
# TODO: some way to define if this is a fatal error or not ?
- Exclude checks