Method export_with_associations
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def export_with_associations(file_name, klass, export_records, options = {})
records = [*export_records]
state = DataShift::Configuration.call.with
Method export_with_associations
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def export_with_associations(file_name, klass, export_records, options = {})
records = [*export_records]
state = DataShift::Configuration.call.with
- 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 export
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def export(file, export_records, options = {})
records = [*export_records]
if records.blank?
logger.warn('Excel Export - No objects supplied for export - no file written')
- 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
TODO found Open
# TODO: Can we switch between .xls and XSSF (POI implementation of Excel 2007 OOXML (.xlsx) file format.)
- Exclude checks
TODO found Open
# TODO: - prepare_data_flow_schema here in middle of export, plus reaching through nodes to klass, does not smell right
- Exclude checks
Do not place comments on the same line as the end
keyword. Open
end # DataShift
- Read upRead up
- Exclude checks
This cop checks for comments put on the same line as some keywords.
These keywords are: begin
, class
, def
, end
, module
.
Note that some comments (such as :nodoc:
and rubocop:disable
) are
allowed.
Example:
# bad
if condition
statement
end # end if
# bad
class X # comment
statement
end
# bad
def x; end # comment
# good
if condition
statement
end
# good
class X # :nodoc:
y
end
Do not place comments on the same line as the end
keyword. Open
end # ExcelGenerator
- Read upRead up
- Exclude checks
This cop checks for comments put on the same line as some keywords.
These keywords are: begin
, class
, def
, end
, module
.
Note that some comments (such as :nodoc:
and rubocop:disable
) are
allowed.
Example:
# bad
if condition
statement
end # end if
# bad
class X # comment
statement
end
# bad
def x; end # comment
# good
if condition
statement
end
# good
class X # :nodoc:
y
end