app/services/import_do_it_volunteer_opportunities.rb
Method has too many lines. [13/7] (https://github.com/bbatsov/ruby-style-guide#short-methods) Open
Open
def populate_vol_op_attributes model, op
location = Location.new longitude: op['lng'], latitude: op['lat']
model.source = 'doit'
model.latitude = location.latitude
model.longitude = location.longitude
- 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 populate_vol_op_attributes is too high. [19.21/15] (http://c2.com/cgi/wiki?AbcMetric) Open
Open
def populate_vol_op_attributes model, op
location = Location.new longitude: op['lng'], latitude: op['lat']
model.source = 'doit'
model.latitude = location.latitude
model.longitude = location.longitude
- 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
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
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"