thoughtbot/paperclip

View on GitHub

Showing 1,009 of 1,009 total issues

Use the new Ruby 1.9 hash syntax.
Open

          :height => @height,

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. [93/80]
Open

  # Returns hash with styles missing from recent run of rake paperclip:refresh:missing_styles

Use uppercase heredoc delimiters.
Open

          end_callbacks
Severity: Minor
Found in lib/paperclip/callbacks.rb by rubocop

This cop checks that your heredocs are using the configured case. By default it is configured to enforce uppercase heredocs.

Example: EnforcedStyle: uppercase (default)

# bad
<<-sql
  SELECT * FROM foo
sql

# good
<<-SQL
  SELECT * FROM foo
SQL

Example: EnforcedStyle: lowercase

# bad
<<-SQL
  SELECT * FROM foo
SQL

# good
<<-sql
  SELECT * FROM foo
sql

Line is too long. [113/80]
Open

      raise Errors::CommandNotFoundError.new("Could not run the `identify` command. Please install ImageMagick.")

Extra empty line detected at class body beginning.
Open


    attr_accessor :current_geometry, :target_geometry, :format, :whiny, :convert_options,
Severity: Minor
Found in lib/paperclip/thumbnail.rb by rubocop

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

Example: EnforcedStyle: empty_lines

# good

class Foo

  def bar
    # ...
  end

end

Example: EnforcedStyle: emptylinesexcept_namespace

# good

class Foo
  class Bar

    # ...

  end
end

Example: EnforcedStyle: emptylinesspecial

# good
class Foo

  def bar; end

end

Example: EnforcedStyle: noemptylines (default)

# good

class Foo
  def bar
    # ...
  end
end

Line is too long. [92/80]
Open

      @current_geometry    = options.fetch(:file_geometry_parser, Geometry).from_file(@file)
Severity: Minor
Found in lib/paperclip/thumbnail.rb by rubocop

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

Line is too long. [86/80]
Open

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

Line is too long. [138/80]
Open

        raise ArgumentError, "Please specify attachment name in your remove_attachment call in your migration." if attachment_names.empty?
Severity: Minor
Found in lib/paperclip/schema.rb by rubocop

Space missing to the left of {.
Open

      styles.reject{ |name, style| name == :original }.each do |name, style|
Severity: Minor
Found in lib/paperclip/attachment.rb by rubocop

Checks that block braces have or don't have a space before the opening brace depending on configuration.

Example:

# bad
foo.map{ |a|
  a.bar.to_s
}

# good
foo.map { |a|
  a.bar.to_s
}

Do not use space inside array brackets.
Open

      [ style_options, all_options ].compact.join(" ")
Severity: Minor
Found in lib/paperclip/attachment.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. [90/80]
Open

      @options[:filename_cleaner] || FilenameCleaner.new(@options[:restricted_characters])
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}

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

Extra empty line detected at module body end.
Open


    end
Severity: Minor
Found in lib/paperclip/validators.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

Line is too long. [95/80]
Open

                method_name = Paperclip::Validators.const_get(constant.to_s).helper_method_name
Severity: Minor
Found in lib/paperclip/validators.rb by rubocop

Unnecessary spacing detected.
Open

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

This cop checks for extra/unnecessary whitespace.

Example:

# good if AllowForAlignment is true
name      = "RuboCop"
# Some comment and an empty line

website  += "/bbatsov/rubocop" unless cond
puts        "rubocop"          if     debug

# bad for any configuration
set_app("RuboCop")
website  = "https://github.com/bbatsov/rubocop"

Line is too long. [105/80]
Open

    # +styles+ - a hash of options for processing the attachment. See +has_attached_file+ for the details
Severity: Minor
Found in lib/paperclip/attachment.rb by rubocop

Line is too long. [91/80]
Open

    # +default_style+ - the style to use when an argument is not specified e.g. #url, #path
Severity: Minor
Found in lib/paperclip/attachment.rb by rubocop

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