thoughtbot/paperclip

View on GitHub

Showing 1,009 of 1,009 total issues

Line is too long. [112/80]
Open

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

Line is too long. [83/80]
Open

    #   +whiny+ - whether to raise an error when processing fails. Defaults to true
Severity: Minor
Found in lib/paperclip/thumbnail.rb by rubocop

Line is too long. [135/80]
Open

        raise LoadError, "Could not find the '#{name}' processor in any of these paths: #{directories.join(', ')}" unless required.any?
Severity: Minor
Found in lib/paperclip/processor_helpers.rb by rubocop

Line is too long. [104/80]
Open

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

Do not leave space between ! and its argument.
Open

      ! @queued_for_write.empty?
Severity: Minor
Found in lib/paperclip/attachment.rb by rubocop

This cop checks for space after !.

Example:

# bad
! something

# good
!something

Method Paperclip::Attachment#default_style is defined at both lib/paperclip/attachment.rb:40 and lib/paperclip/attachment.rb:195.
Open

    def default_style
Severity: Minor
Found in lib/paperclip/attachment.rb by rubocop

This cop checks for duplicated instance (or singleton) method definitions.

Example:

# bad

def duplicated
  1
end

def duplicated
  2
end

Example:

# bad

def duplicated
  1
end

alias duplicated other_duplicated

Example:

# good

def duplicated
  1
end

def other_duplicated
  2
end

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

Use the new Ruby 1.9 hash syntax.
Open

        :convert_options       => {},
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}

Use the new Ruby 1.9 hash syntax.
Open

        :restricted_characters => /[&$+,\/:;=?@<>\[\]\{\}\|\\\^~%# ]/,
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}

Use the new Ruby 1.9 hash syntax.
Open

        :processors            => [:thumbnail],
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. [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. [135/80]
Open

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

Line is too long. [100/80]
Open

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

Freeze mutable objects assigned to constants.
Open

    COLUMNS = {:file_name    => :string,
               :content_type => :string,
               :file_size    => :bigint,
               :updated_at   => :datetime}
Severity: Minor
Found in lib/paperclip/schema.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

Line is too long. [84/80]
Open

    # Check if attachment database table has a created_at field which is not yet set
Severity: Minor
Found in lib/paperclip/attachment.rb by rubocop

Prefer inject over reduce.
Open

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

This cop enforces the use of consistent method names from the Enumerable module.

Unfortunately we cannot actually know if a method is from Enumerable or not (static analysis limitation), so this cop can yield some false positives.

Line is too long. [89/80]
Open

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

Line is too long. [84/80]
Open

    # set, the options will be appended to the convert command upon image conversion
Severity: Minor
Found in lib/paperclip/thumbnail.rb by rubocop

Use the new Ruby 1.9 hash syntax.
Open

        @identified_as_animated = ANIMATED_FORMATS.include? identify("-format %m :file", :file => "#{@file.path}[0]").to_s.downcase.strip
Severity: Minor
Found in lib/paperclip/thumbnail.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. [85/80]
Open

    #   +frame_index+ - the frame index of the source file to render as the thumbnail
Severity: Minor
Found in lib/paperclip/thumbnail.rb by rubocop
Severity
Category
Status
Source
Language