thoughtbot/paperclip

View on GitHub

Showing 1,009 of 1,009 total issues

Space between { and | missing.
Open

        URI.escape(url).gsub(escape_regex){|m| "%#{m.ord.to_s(16).upcase}" }
Severity: Minor
Found in lib/paperclip/url_generator.rb by rubocop

Checks that block braces have or don't have surrounding space inside them on configuration. For blocks taking parameters, it checks that the left brace has or doesn't have trailing space depending on configuration.

Example: EnforcedStyle: space (default)

# The `space` style enforces that block braces have
# surrounding space.

# bad
some_array.each {puts e}

# good
some_array.each { puts e }

Example: EnforcedStyle: no_space

# The `no_space` style enforces that block braces don't
# have surrounding space.

# bad
some_array.each { puts e }

# good
some_array.each {puts e}

Example: EnforcedStyleForEmptyBraces: no_space (default)

# The `no_space` EnforcedStyleForEmptyBraces style enforces that
# block braces don't have a space in between when empty.

# bad
some_array.each {   }
some_array.each {  }
some_array.each { }

# good
some_array.each {}

Example: EnforcedStyleForEmptyBraces: space

# The `space` EnforcedStyleForEmptyBraces style enforces that
# block braces have at least a spece in between when empty.

# bad
some_array.each {}

# good
some_array.each { }
some_array.each {  }
some_array.each {   }

Example: SpaceBeforeBlockParameters: true (default)

# The SpaceBeforeBlockParameters style set to `true` enforces that
# there is a space between `{` and `|`. Overrides `EnforcedStyle`
# if there is a conflict.

# bad
[1, 2, 3].each {|n| n * 2 }

# good
[1, 2, 3].each { |n| n * 2 }

Example: SpaceBeforeBlockParameters: true

# The SpaceBeforeBlockParameters style set to `false` enforces that
# there is no space between `{` and `|`. Overrides `EnforcedStyle`
# if there is a conflict.

# bad
[1, 2, 3].each { |n| n * 2 }

# good
[1, 2, 3].each {|n| n * 2 }

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

Space found before comma.
Open

      scale = [new_geometry.width.to_f / self.width.to_f , new_geometry.height.to_f / self.height.to_f].min
Severity: Minor
Found in lib/paperclip/geometry.rb by rubocop

Checks for comma (,) preceded by space.

Example:

# bad
[1 , 2 , 3]
a(1 , 2)
each { |a , b| }

# good
[1, 2, 3]
a(1, 2)
each { |a, b| }

Line is too long. [82/80]
Open

        warn("#{e} - cannot copy #{path(style)} to local file #{local_dest_path}")
Severity: Minor
Found in lib/paperclip/storage/s3.rb by rubocop

Line is too long. [85/80]
Open

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

Line is too long. [93/80]
Open

    #   saved by paperclip. If you set this to an explicit octal value (0755, 0644, etc) then
Severity: Minor
Found in lib/paperclip/storage/filesystem.rb by rubocop

Line is too long. [101/80]
Open

    #   you to use paperclip on filesystems that don't understand unix file permissions, and has the 
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

Put empty method definitions on a single line.
Open

      def self.extended base
      end
Severity: Minor
Found in lib/paperclip/storage/filesystem.rb by rubocop

This cop checks for the formatting of empty method definitions. By default it enforces empty method definitions to go on a single line (compact style), but it can be configured to enforce the end to go on its own line (expanded style).

Note: A method definition is not considered empty if it contains comments.

Example: EnforcedStyle: compact (default)

# bad
def foo(bar)
end

def self.foo(bar)
end

# good
def foo(bar); end

def foo(bar)
  # baz
end

def self.foo(bar); end

Example: EnforcedStyle: expanded

# bad
def foo(bar); end

def self.foo(bar); end

# good
def foo(bar)
end

def self.foo(bar)
end

Prefer using YAML.safe_load over YAML.load.
Open

          YAML::load(ERB.new(File.read(creds.path)).result)
Severity: Minor
Found in lib/paperclip/storage/fog.rb by rubocop

This cop checks for the use of YAML class methods which have potential security issues leading to remote code execution when loading from an untrusted source.

Example:

# bad
YAML.load("--- foo")

# good
YAML.safe_load("--- foo")
YAML.dump("foo")

Do not use space inside array brackets.
Open

        [ "%dx" % dst.width, ratio.width ]
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. [118/80]
Open

            @options[:path] = path_option.gsub(/:url/, @options[:url]).sub(/\A:rails_root\/public\/system/, "".freeze)
Severity: Minor
Found in lib/paperclip/storage/s3.rb by rubocop

Use the new Ruby 1.9 hash syntax.
Open

        storage_class = {:default => storage_class} unless storage_class.respond_to?(:merge)
Severity: Minor
Found in lib/paperclip/storage/s3.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. [134/80]
Open

              merge_s3_headers( style_specific_options[:s3_headers], @s3_headers, @s3_metadata) if style_specific_options[:s3_headers]
Severity: Minor
Found in lib/paperclip/storage/s3.rb by rubocop

Line is too long. [89/80]
Open

    # filesystem can be very easily served by Apache without requiring a hit to your app.
Severity: Minor
Found in lib/paperclip/storage/filesystem.rb by rubocop

Line is too long. [111/80]
Open

              @s3_metadata.merge!(style_specific_options[:s3_metadata]) if style_specific_options[:s3_metadata]
Severity: Minor
Found in lib/paperclip/storage/s3.rb by rubocop

Use the new Ruby 1.9 hash syntax.
Open

            proxy_opts = { :host => http_proxy_host }
Severity: Minor
Found in lib/paperclip/storage/s3.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. [95/80]
Open

    # * +override_file_permissions+: This allows you to override the file permissions for files
Severity: Minor
Found in lib/paperclip/storage/filesystem.rb by rubocop

Line is too long. [86/80]
Open

    #   almost all cases, should) be coordinated with the value of the +url+ option to
Severity: Minor
Found in lib/paperclip/storage/filesystem.rb by rubocop
Severity
Category
Status
Source
Language