thoughtbot/paperclip

View on GitHub

Showing 13 of 999 total issues

Use tr instead of gsub.
Open

      definition = model.gsub(" ", "_").classify.constantize.
Severity: Minor
Found in shoulda_macros/paperclip.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 =~ in places where the MatchData returned by #match will not be used.
Open

        delimiter_char = url.match(/\?.+=/) ? '&' : '?'
Severity: Minor
Found in lib/paperclip/url_generator.rb by rubocop

This cop identifies use of Regexp#match or String#match in a context where the integral return value of=~` would do just as well.

Example:

# bad
do_something if str.match(/regex/)
while regex.match('str')
  do_something
end

# good
method(str.match(/regex/))
return regex.match('str')

Use =~ in places where the MatchData returned by #match will not be used.
Open

          unless @options[:url].to_s.match(/\A:fog.*url\z/)
Severity: Minor
Found in lib/paperclip/storage/fog.rb by rubocop

This cop identifies use of Regexp#match or String#match in a context where the integral return value of=~` would do just as well.

Example:

# bad
do_something if str.match(/regex/)
while regex.match('str')
  do_something
end

# good
method(str.match(/regex/))
return regex.match('str')

Use write_options[:storage_class] = storage_class instead of write_options.merge!(:storage_class => storage_class).
Open

            write_options.merge!(:storage_class => storage_class) if storage_class
Severity: Minor
Found in lib/paperclip/storage/s3.rb by rubocop

This cop identifies places where Hash#merge! can be replaced by Hash#[]=.

Example:

hash.merge!(a: 1)
hash.merge!({'key' => 'value'})
hash.merge!(a: 1, b: 2)

FIXME found
Open

# FIXME: fails with modern bundler
Severity: Minor
Found in .travis.yml by fixme

HACK found
Open

  Description: Checks formatting of special comments (TODO, FIXME, OPTIMIZE, HACK,
Severity: Minor
Found in .hound.yml by fixme

TODO found
Open

  Description: Checks formatting of special comments (TODO, FIXME, OPTIMIZE, HACK,
Severity: Minor
Found in .hound.yml by fixme

FIXME found
Open

  - FIXME
Severity: Minor
Found in .hound.yml by fixme

TODO found
Open

  s.add_development_dependency('cucumber-expressions', '4.0.3') # TODO: investigate failures on 4.0.4
Severity: Minor
Found in paperclip.gemspec by fixme

TODO found
Open

        # TODO: is it even possible to take into account Procs?

TODO found
Open

  - TODO
Severity: Minor
Found in .hound.yml by fixme

HACK found
Open

  - HACK
Severity: Minor
Found in .hound.yml by fixme

FIXME found
Open

  Description: Checks formatting of special comments (TODO, FIXME, OPTIMIZE, HACK,
Severity: Minor
Found in .hound.yml by fixme
Severity
Category
Status
Source