app/services/import_do_it_volunteer_opportunities.rb
Method has too many lines. [13/5] (https://github.com/bbatsov/ruby-style-guide#short-methods) Open
Open
def persist_doit_vol_ops(opportunities)
opportunities.each do |op|
model_klass.find_or_create_by(doit_op_id: op['id']) do |model|
model.source = 'doit'
model.latitude = op['lat']
- 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 persist_doit_vol_ops is too high. [16.64/15] (http://c2.com/cgi/wiki?AbcMetric) Open
Open
def persist_doit_vol_ops(opportunities)
opportunities.each do |op|
model_klass.find_or_create_by(doit_op_id: op['id']) do |model|
model.source = 'doit'
model.latitude = op['lat']
- 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
Prefer single-quoted strings when you don't need string interpolation or special symbols. (https://github.com/bbatsov/ruby-style-guide#consistent-string-literals) Open
Open
HREF = "/v1/opportunities?lat=51.5978&lng=-0.3370&miles="
- Read upRead up
- Exclude checks
Checks if uses of quotes match the configured preference.
Example: EnforcedStyle: single_quotes (default)
# bad
"No special symbols"
"No string interpolation"
"Just text"
# good
'No special symbols'
'No string interpolation'
'Just text'
"Wait! What's #{this}!"
Example: EnforcedStyle: double_quotes
# bad
'Just some text'
'No special chars or interpolation'
# good
"Just some text"
"No special chars or interpolation"
"Every string in #{project} uses double_quotes"
Use ==
if you meant to do a comparison or wrap the expression in parentheses to indicate you meant to assign in a condition. (https://github.com/bbatsov/ruby-style-guide#safe-assignment-in-condition) Open
Open
while href = process_doit_json_page(http.get("#{HOST}#{href}"));
- Read upRead up
- Exclude checks
This cop checks for assignments in the conditions of if/while/until.
Example:
# bad
if some_var = true
do_something
end
Example:
# good
if some_var == true
do_something
end
Rename has_content?
to content?
. (https://github.com/bbatsov/ruby-style-guide#bool-methods-qmark) Open
Open
def has_content?(response)
- Read upRead up
- Exclude checks
This cop makes sure that predicates are named properly.
Example:
# bad
def is_even?(value)
end
# good
def even?(value)
end
# bad
def has_value?
end
# good
def value?
end