lib/datashift/mapping/data_flow_schema.rb
Method prepare_from_yaml
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
Open
def prepare_from_yaml(yaml, locale_key = 'data_flow_schema')
@yaml_data = yaml
raise "Bad YAML syntax - No key #{locale_key} found in #{yaml}" unless yaml[locale_key]
- 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
Assignment Branch Condition size for prepare_from_yaml is too high. [63/60] Open
Open
def prepare_from_yaml(yaml, locale_key = 'data_flow_schema')
@yaml_data = yaml
raise "Bad YAML syntax - No key #{locale_key} found in #{yaml}" unless yaml[locale_key]
- 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 prepare_from_yaml
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def prepare_from_yaml(yaml, locale_key = 'data_flow_schema')
@yaml_data = yaml
raise "Bad YAML syntax - No key #{locale_key} found in #{yaml}" unless yaml[locale_key]
TODO found Open
Open
# TODO: - do we really need to pass in the doc context when parent nodes already has it ?
- Exclude checks
TODO found Open
Open
# TODO: fix doc context so it can be created 'empty' i.e without AR klass, and always has empty headers
- Exclude checks
TODO found Open
Open
# TODO: what is c ? a list or hash ?
- Exclude checks
TODO found Open
Open
# TODO: - This index could be hard coded by the user in YAML or we try to derive it from the headers
- Exclude checks
TODO found Open
Open
# TODO: - layout with heading is verbose for no benefit - defunct, simply node.source, node.presentation
- Exclude checks
TODO found Open
Open
# TODO: validate type ? guess we expect one of ModelMethod.supported_types_enum
- Exclude checks
Unnecessary spacing detected. Open
Open
binding = MethodBinding.new(mm.operator, mm, idx: i) # TOFIX - why need to pass in both mm.operator AND mm ??
- Read upRead up
- Exclude checks
This cop checks for extra/unnecessary whitespace.
Example:
# good if AllowForAlignment is true
name = "RuboCop"
# Some comment and an empty line
website += "/bbatsov/rubocop" unless cond
puts "rubocop" if debug
# bad for any configuration
set_app("RuboCop")
website = "https://github.com/bbatsov/rubocop"