thoughtbot/paperclip

View on GitHub

Showing 14 of 1,010 total issues

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)

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 the use of Regexp#match or String#match, which returns #<MatchData>/nil. The return value of =~ is an integral index/nil and is more performant.

Example:

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

# good
method(str =~ /regex/)
return value unless regex =~ 'str'

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 the use of Regexp#match or String#match, which returns #<MatchData>/nil. The return value of =~ is an integral index/nil and is more performant.

Example:

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

# good
method(str =~ /regex/)
return value unless regex =~ 'str'

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 each_key instead of keys.each.
Open

          COLUMNS.keys.each do |column_name|
Severity: Minor
Found in lib/paperclip/schema.rb by rubocop

This cop checks for uses of each_key and each_value Hash methods.

Note: If you have an array of two-element arrays, you can put parentheses around the block arguments to indicate that you're not working with a hash, and suppress RuboCop offenses.

Example:

# bad
hash.keys.each { |k| p k }
hash.values.each { |v| p v }
hash.each { |k, _v| p k }
hash.each { |_k, v| p v }

# good
hash.each_key { |k| p k }
hash.each_value { |v| p v }

Use each_value instead of each.
Open

      @errors.each do |error, message|
Severity: Minor
Found in lib/paperclip/attachment.rb by rubocop

This cop checks for uses of each_key and each_value Hash methods.

Note: If you have an array of two-element arrays, you can put parentheses around the block arguments to indicate that you're not working with a hash, and suppress RuboCop offenses.

Example:

# bad
hash.keys.each { |k| p k }
hash.values.each { |v| p v }
hash.each { |k, _v| p k }
hash.each { |_k, v| p v }

# good
hash.each_key { |k| p k }
hash.each_value { |v| p v }

HACK 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

HACK found
Open

  - 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

TODO found
Open

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

FIXME found
Open

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

TODO found
Open

  - TODO
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
Severity
Category
Status
Source
Language