thoughtbot/paperclip

View on GitHub

Showing 1,009 of 1,009 total issues

Line is too long. [102/80]
Open

      instance_read(:file_size) || (@queued_for_write[:original] && @queued_for_write[:original].size)
Severity: Minor
Found in lib/paperclip/attachment.rb by rubocop

Line is too long. [118/80]
Open

        unless @instance.respond_to?("#{@name_string}_#{field}") && @instance.respond_to?("#{@name_string}_#{field}=")
Severity: Minor
Found in lib/paperclip/attachment.rb by rubocop

Use the new Ruby 1.9 hash syntax.
Open

        :styles                => {},
Severity: Minor
Found in lib/paperclip/attachment.rb by rubocop

This cop checks hash literal syntax.

It can enforce either the use of the class hash rocket syntax or the use of the newer Ruby 1.9 syntax (when applicable).

A separate offense is registered for each problematic pair.

The supported styles are:

  • ruby19 - forces use of the 1.9 syntax (e.g. {a: 1}) when hashes have all symbols for keys
  • hash_rockets - forces use of hash rockets for all hashes
  • nomixedkeys - simply checks for hashes with mixed syntaxes
  • ruby19nomixed_keys - forces use of ruby 1.9 syntax and forbids mixed syntax hashes

Example: EnforcedStyle: ruby19 (default)

# bad
{:a => 2}
{b: 1, :c => 2}

# good
{a: 2, b: 1}
{:c => 2, 'd' => 2} # acceptable since 'd' isn't a symbol
{d: 1, 'e' => 2} # technically not forbidden

Example: EnforcedStyle: hash_rockets

# bad
{a: 1, b: 2}
{c: 1, 'd' => 5}

# good
{:a => 1, :b => 2}

Example: EnforcedStyle: nomixedkeys

# bad
{:a => 1, b: 2}
{c: 1, 'd' => 2}

# good
{:a => 1, :b => 2}
{c: 1, d: 2}

Example: EnforcedStyle: ruby19nomixed_keys

# bad
{:a => 1, :b => 2}
{c: 2, 'd' => 3} # should just use hash rockets

# good
{a: 1, b: 2}
{:c => 3, 'd' => 4}

Line is too long. [107/80]
Open

    #   +convert_options+ - flags passed to the +convert+ command that influence how the image is processed
Severity: Minor
Found in lib/paperclip/thumbnail.rb by rubocop

Line is too long. [147/80]
Open

        ActiveSupport::Deprecation.warn "Method `t.has_attached_file` in the migration has been deprecated and will be replaced by `t.attachment`."
Severity: Minor
Found in lib/paperclip/schema.rb by rubocop

Unused block argument - args. You can omit the argument if you don't care about it.
Open

        send(:"before_#{attribute}_post_process", :if => if_clause, :unless => unless_clause) do |*args|
Severity: Minor
Found in lib/paperclip/validators.rb by rubocop

This cop checks for unused block arguments.

Example:

# bad

do_something do |used, unused|
  puts used
end

do_something do |bar|
  puts :foo
end

define_method(:foo) do |bar|
  puts :baz
end

Example:

#good

do_something do |used, _unused|
  puts used
end

do_something do
  puts :foo
end

define_method(:foo) do |_bar|
  puts :baz
end

Line is too long. [85/80]
Open

      @frame_index         = multi_frame_format? ? options.fetch(:frame_index, 0) : 0
Severity: Minor
Found in lib/paperclip/thumbnail.rb by rubocop

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

require 'active_support/core_ext/array/wrap'
Severity: Minor
Found in lib/paperclip/validators.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"

Line is too long. [124/80]
Open

      raise Paperclip::Errors::CommandNotFoundError.new("Could not run the `identify` command. Please install ImageMagick.")
Severity: Minor
Found in lib/paperclip/thumbnail.rb by rubocop

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

require 'paperclip/validators/attachment_presence_validator'
Severity: Minor
Found in lib/paperclip/validators.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"

Line is too long. [99/80]
Open

    # +use_timestamp+ - whether to append an anti-caching timestamp to image URLs. Defaults to true
Severity: Minor
Found in lib/paperclip/attachment.rb by rubocop

Space inside } missing.
Open

               :updated_at   => :datetime}
Severity: Minor
Found in lib/paperclip/schema.rb by rubocop

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

Example: EnforcedStyle: space

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

# bad
h = {a: 1, b: 2}

# good
h = { a: 1, b: 2 }

Example: EnforcedStyle: no_space

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

# bad
h = { a: 1, b: 2 }

# good
h = {a: 1, b: 2}

Example: EnforcedStyle: compact

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

# bad
h = { a: { b: 2 } }

# good
h = { a: { b: 2 }}

Line is too long. [122/80]
Open

    # +filename_cleaner+ - An object that responds to #call(filename) that will strip unacceptable charcters from filename
Severity: Minor
Found in lib/paperclip/attachment.rb by rubocop

Line is too long. [84/80]
Open

            column("#{attachment_name}_#{column_name}", column_type, column_options)
Severity: Minor
Found in lib/paperclip/schema.rb by rubocop

Line is too long. [84/80]
Open

    # Alias to +url+ that allows using the expiring_url method provided by the cloud
Severity: Minor
Found in lib/paperclip/attachment.rb by rubocop

Freeze mutable objects assigned to constants.
Open

    ::Paperclip::REQUIRED_VALIDATORS = [AttachmentFileNameValidator, AttachmentContentTypeValidator, AttachmentFileTypeIgnoranceValidator]
Severity: Minor
Found in lib/paperclip/validators.rb by rubocop

This cop checks whether some constant value isn't a mutable literal (e.g. array or hash).

Example:

# bad
CONST = [1, 2, 3]

# good
CONST = [1, 2, 3].freeze

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

require 'paperclip/validators/attachment_file_type_ignorance_validator'
Severity: Minor
Found in lib/paperclip/validators.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"

Line is too long. [82/80]
Open

    # and can instead point to an action in your app, for example for fine grained
Severity: Minor
Found in lib/paperclip/attachment.rb by rubocop

Line is too long. [84/80]
Open

        @url_generator.for(style_name, default_options.merge(:timestamp => options))
Severity: Minor
Found in lib/paperclip/attachment.rb by rubocop

Use the new Ruby 1.9 hash syntax.
Open

        :interpolator          => Paperclip::Interpolations,
Severity: Minor
Found in lib/paperclip/attachment.rb by rubocop

This cop checks hash literal syntax.

It can enforce either the use of the class hash rocket syntax or the use of the newer Ruby 1.9 syntax (when applicable).

A separate offense is registered for each problematic pair.

The supported styles are:

  • ruby19 - forces use of the 1.9 syntax (e.g. {a: 1}) when hashes have all symbols for keys
  • hash_rockets - forces use of hash rockets for all hashes
  • nomixedkeys - simply checks for hashes with mixed syntaxes
  • ruby19nomixed_keys - forces use of ruby 1.9 syntax and forbids mixed syntax hashes

Example: EnforcedStyle: ruby19 (default)

# bad
{:a => 2}
{b: 1, :c => 2}

# good
{a: 2, b: 1}
{:c => 2, 'd' => 2} # acceptable since 'd' isn't a symbol
{d: 1, 'e' => 2} # technically not forbidden

Example: EnforcedStyle: hash_rockets

# bad
{a: 1, b: 2}
{c: 1, 'd' => 5}

# good
{:a => 1, :b => 2}

Example: EnforcedStyle: nomixedkeys

# bad
{:a => 1, b: 2}
{c: 1, 'd' => 2}

# good
{:a => 1, :b => 2}
{c: 1, d: 2}

Example: EnforcedStyle: ruby19nomixed_keys

# bad
{:a => 1, :b => 2}
{c: 2, 'd' => 3} # should just use hash rockets

# good
{a: 1, b: 2}
{:c => 3, 'd' => 4}
Severity
Category
Status
Source
Language