thoughtbot/paperclip

View on GitHub

Showing 1,009 of 1,009 total issues

Line is too long. [84/80]
Open

      all_options   = all_options.call(instance)   if all_options.respond_to?(:call)
Severity: Minor
Found in lib/paperclip/attachment.rb by rubocop

Use the new Ruby 1.9 hash syntax.
Open

        :whiny                 => Paperclip.options[:whiny] || Paperclip.options[:whiny_thumbnails],
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. [83/80]
Open

    #   +animated+ - whether to merge all the layers in the image. Defaults to true
Severity: Minor
Found in lib/paperclip/thumbnail.rb by rubocop

Line is too long. [82/80]
Open

    # Performs the conversion of the +file+ into a thumbnail. Returns the Tempfile
Severity: Minor
Found in lib/paperclip/thumbnail.rb by rubocop

Line is too long. [86/80]
Open

      ActiveRecord::ConnectionAdapters::TableDefinition.send :include, TableDefinition
Severity: Minor
Found in lib/paperclip/schema.rb by rubocop

Rename has_attached_file to has_attached_file?.
Open

      def has_attached_file(*attachment_names)
Severity: Minor
Found in lib/paperclip/schema.rb by rubocop

This cop makes sure that predicates are named properly.

Example:

# bad
def is_even?(value)
end

# good
def even?(value)
end

# bad
def has_value?
end

# good
def value?
end

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

require 'active_model'
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. [98/80]
Open

    # +hash_digest+ - a string representing a class that will be used to hash URLs for obfuscation
Severity: Minor
Found in lib/paperclip/attachment.rb by rubocop

Line is too long. [102/80]
Open

    # +source_file_options+ - flags passed to the +convert+ command that controls how the file is read
Severity: Minor
Found in lib/paperclip/attachment.rb by rubocop

Line is too long. [117/80]
Open

    # +url_generator+ - the object used to generate URLs, using the interpolator. Defaults to Paperclip::UrlGenerator
Severity: Minor
Found in lib/paperclip/attachment.rb by rubocop

Line is too long. [96/80]
Open

          @normalized_styles[name.to_sym] = Paperclip::Style.new(name.to_sym, options.dup, self)
Severity: Minor
Found in lib/paperclip/attachment.rb by rubocop

Use the new Ruby 1.9 hash syntax.
Open

        :url                   => "/system/:class/:attachment/:id_partition/:style/:filename",
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. [151/80]
Open

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

Line is too long. [138/80]
Open

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

Use the new Ruby 1.9 hash syntax.
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 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}

Align reduce with style.processors. on line 536.
Open

          reduce(original) do |file, processor|
Severity: Minor
Found in lib/paperclip/attachment.rb by rubocop

This cop checks the indentation of the method name part in method calls that span more than one line.

Example: EnforcedStyle: aligned

# bad
while myvariable
.b
  # do something
end

# good
while myvariable
      .b
  # do something
end

# good
Thing.a
     .b
     .c

Example: EnforcedStyle: indented

# good
while myvariable
  .b

  # do something
end

Example: EnforcedStyle: indentedrelativeto_receiver

# good
while myvariable
        .a
        .b

  # do something
end

# good
myvariable = Thing
               .a
               .b
               .c

Align for with Paperclip.io_adapters. on line 548.
Open

          for(@queued_for_write[name], @options[:adapter_options])
Severity: Minor
Found in lib/paperclip/attachment.rb by rubocop

This cop checks the indentation of the method name part in method calls that span more than one line.

Example: EnforcedStyle: aligned

# bad
while myvariable
.b
  # do something
end

# good
while myvariable
      .b
  # do something
end

# good
Thing.a
     .b
     .c

Example: EnforcedStyle: indented

# good
while myvariable
  .b

  # do something
end

Example: EnforcedStyle: indentedrelativeto_receiver

# good
while myvariable
        .a
        .b

  # do something
end

# good
myvariable = Thing
               .a
               .b
               .c

Unused method argument - time. If it's necessary, use _ or _time as an argument name to indicate that it won't be used.
Open

    def expiring_url(time = 3600, style_name = default_style)
Severity: Minor
Found in lib/paperclip/attachment.rb by rubocop

This cop checks for unused method arguments.

Example:

# bad

def some_method(used, unused, _unused_but_allowed)
  puts used
end

Example:

# good

def some_method(used, _unused, _unused_but_allowed)
  puts used
end

Line is too long. [100/80]
Open

        :whiny                 => Paperclip.options[:whiny] || Paperclip.options[:whiny_thumbnails],
Severity: Minor
Found in lib/paperclip/attachment.rb by rubocop

Line is too long. [84/80]
Open

    # storage implementations, but keep using filesystem storage for development and
Severity: Minor
Found in lib/paperclip/attachment.rb by rubocop
Severity
Category
Status
Source
Language