publiclab/plots2

View on GitHub

Showing 686 of 688 total issues

Use tr instead of gsub.
Open

    tags_order = 'CASE WHEN name LIKE ? OR name LIKE ? THEN 1 WHEN name LIKE ? OR name LIKE ? THEN 2 WHEN name LIKE ? OR name LIKE ? THEN 4 ELSE 3 END', "#{query}", "#{query.to_s.gsub(' ', '-')}", "#{query}%", "#{query.to_s.gsub(' ', '-')}%", "%#{query}", "%#{query.to_s.gsub(' ', '-')}"
Severity: Minor
Found in app/services/search_service.rb by rubocop

This cop identifies places where gsub can be replaced by tr or delete.

Example:

# bad
'abc'.gsub('b', 'd')
'abc'.gsub('a', '')
'abc'.gsub(/a/, 'd')
'abc'.gsub!('a', 'd')

# good
'abc'.gsub(/.*/, 'a')
'abc'.gsub(/a+/, 'd')
'abc'.tr('b', 'd')
'a b c'.delete(' ')

Use a guard clause instead of wrapping the code inside a conditional expression.
Open

    if node.status == 4 # only if it remains unmoderated
Severity: Minor
Found in app/mailers/admin_mailer.rb by rubocop

Use a guard clause instead of wrapping the code inside a conditional expression

Example:

# bad
def test
  if something
    work
  end
end

# good
def test
  return unless something
  work
end

# also good
def test
  work if something
end

# bad
if something
  raise 'exception'
else
  ok
end

# good
raise 'exception' if something
ok

TODO found
Open

  # TODO: make less redundant with https://github.com/publiclab/plots2/blob/main/app/helpers/application_helper.rb#L3

TODO found
Open

        // TODO: create multicase for "CREATE NEW COMMENT FORM" in reducers.js

TODO found
Open

        # TODO: evaluate if disabling this caching action actually speeds things up?
Severity: Minor
Found in app/api/srch/search.rb by fixme

TODO found
Open

    <!-- TODO: could be resolved with `node.node.main_image` but applying quick fix here -->
Severity
Category
Status
Source
Language