thoughtbot/paperclip

View on GitHub

Showing 1,009 of 1,009 total issues

Line is too long. [143/80]
Open

      AWS_BUCKET_SUBDOMAIN_RESTRICTON_REGEX = /\A(?:[a-z]|\d(?!\d{0,2}(?:\.\d{1,3}){3}\z))(?:[a-z0-9]|\.(?![\.\-])|\-(?![\.])){1,61}[a-z0-9]\z/
Severity: Minor
Found in lib/paperclip/storage/fog.rb by rubocop

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Open

          require 'fog'
Severity: Minor
Found in lib/paperclip/storage/fog.rb by rubocop

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"

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Open

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

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"

Extra empty line detected at module body beginning.
Open


  # Defines the geometry of an image.
Severity: Minor
Found in lib/paperclip/geometry.rb by rubocop

This cops checks if empty lines around the bodies of modules match the configuration.

Example: EnforcedStyle: empty_lines

# good

module Foo

  def bar
    # ...
  end

end

Example: EnforcedStyle: emptylinesexcept_namespace

# good

module Foo
  module Bar

    # ...

  end
end

Example: EnforcedStyle: emptylinesspecial

# good
module Foo

  def bar; end

end

Example: EnforcedStyle: noemptylines (default)

# good

module Foo
  def bar
    # ...
  end
end

Do not use space inside array brackets.
Open

      [ scale_geometry, crop_geometry ]
Severity: Minor
Found in lib/paperclip/geometry.rb by rubocop

Checks that brackets used for array literals have or don't have surrounding space depending on configuration.

Example: EnforcedStyle: space

# The `space` style enforces that array literals have
# surrounding space.

# bad
array = [a, b, c, d]

# good
array = [ a, b, c, d ]

Example: EnforcedStyle: no_space

# The `no_space` style enforces that array literals have
# no surrounding space.

# bad
array = [ a, b, c, d ]

# good
array = [a, b, c, d]

Example: EnforcedStyle: compact

# The `compact` style normally requires a space inside
# array brackets, with the exception that successive left
# or right brackets are collapsed together in nested arrays.

# bad
array = [ a, [ b, c ] ]

# good
array = [ a, [ b, c ]]

Line is too long. [86/80]
Open

    # Returns the scaling and cropping geometries (in string-based ImageMagick format)
Severity: Minor
Found in lib/paperclip/geometry.rb by rubocop

Line is too long. [87/80]
Open

          raise ArgumentError, "Credentials given are not a path, file, proc, or hash."
Severity: Minor
Found in lib/paperclip/storage/s3.rb by rubocop

Prefer single-quoted strings inside interpolations.
Open

          "#{attachment.s3_protocol(style, true)}//#{attachment.s3_host_name}/#{attachment.bucket_name}/#{attachment.path(style).sub(%r{\A/}, "".freeze)}"
Severity: Minor
Found in lib/paperclip/storage/s3.rb by rubocop

This cop checks that quotes inside the string interpolation match the configured preference.

Example: EnforcedStyle: single_quotes (default)

# bad
result = "Tests #{success ? "PASS" : "FAIL"}"

# good
result = "Tests #{success ? 'PASS' : 'FAIL'}"

Example: EnforcedStyle: double_quotes

# bad
result = "Tests #{success ? 'PASS' : 'FAIL'}"

# good
result = "Tests #{success ? "PASS" : "FAIL"}"

Line is too long. [85/80]
Open

    # The default place to store attachments is in the filesystem. Files on the local
Severity: Minor
Found in lib/paperclip/storage/filesystem.rb by rubocop

Line is too long. [97/80]
Open

    #   that value will be used to set the permissions for an uploaded file. The default is 0666.
Severity: Minor
Found in lib/paperclip/storage/filesystem.rb by rubocop

Line is too long. [86/80]
Open

    #   added benefit of using the storage directories default umask on those that do.
Severity: Minor
Found in lib/paperclip/storage/filesystem.rb by rubocop

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'

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Open

            @options[:url]   = ':fog_public_url'
Severity: Minor
Found in lib/paperclip/storage/fog.rb by rubocop

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"

Redundant use of Object#to_s in interpolation.
Open

        "#{url}#{delimiter_char}#{@attachment.updated_at.to_s}"
Severity: Minor
Found in lib/paperclip/url_generator.rb by rubocop

This cop checks for string conversion in string interpolation, which is redundant.

Example:

# bad

"result is #{something.to_s}"

Example:

# good

"result is #{something}"

Do not use parallel assignment.
Open

          prefix, suffix = prefix_suffix, ''
Severity: Minor
Found in lib/paperclip/tempfile.rb by rubocop

Checks for simple usages of parallel assignment. This will only complain when the number of variables being assigned matched the number of assigning variables.

Example:

# bad
a, b, c = 1, 2, 3
a, b, c = [1, 2, 3]

# good
one, two = *foo
a, b = foo()
a, b = b, a

a = 1
b = 2
c = 3

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Open

      set_encoding('ASCII-8BIT')
Severity: Minor
Found in lib/paperclip/tempfile.rb by rubocop

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"

Space inside parentheses detected.
Open

        ratio = Geometry.new( dst.width / self.width, dst.height / self.height )
Severity: Minor
Found in lib/paperclip/geometry.rb by rubocop

Checks for spaces inside ordinary round parentheses.

Example:

# bad
f( 3)
g = (a + 3 )

# good
f(3)
g = (a + 3)

Line is too long. [100/80]
Open

          unless @options[:url].to_s.match(/\A:s3.*url\z/) || @options[:url] == ":asset_host".freeze
Severity: Minor
Found in lib/paperclip/storage/s3.rb by rubocop

Line is too long. [94/80]
Open

        s3_permissions = s3_permissions.call(self, style) if s3_permissions.respond_to?(:call)
Severity: Minor
Found in lib/paperclip/storage/s3.rb by rubocop

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Open

        ::File.open(local_dest_path, 'wb') do |local_file|
Severity: Minor
Found in lib/paperclip/storage/s3.rb by rubocop

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