tansaku/LocalSupport

View on GitHub
app/services/import_do_it_volunteer_opportunities.rb

Summary

Maintainability
A
0 mins
Test Coverage

Method has too many lines. [13/5] (https://github.com/bbatsov/ruby-style-guide#short-methods)
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']

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

  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']

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

  HREF = "/v1/opportunities?lat=51.5978&lng=-0.3370&miles="

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

    while href = process_doit_json_page(http.get("#{HOST}#{href}"));

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

  def has_content?(response)

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

There are no issues that match your filters.

Category
Status