thoughtbot/paperclip

View on GitHub
lib/paperclip/helpers.rb

Summary

Maintainability
A
0 mins
Test Coverage

Assignment Branch Condition size for run is too high. [16.76/15]
Open

    def run(cmd, arguments = "", interpolation_values = {}, local_options = {})
      command_path = options[:command_path]
      cocaine_path_array = Cocaine::CommandLine.path.try(:split, Cocaine::OS.path_separator)
      Cocaine::CommandLine.path = [cocaine_path_array, command_path].flatten.compact.uniq
      if logging? && (options[:log_command] || local_options[:log_command])
Severity: Minor
Found in lib/paperclip/helpers.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Line is too long. [92/80]
Open

      cocaine_path_array = Cocaine::CommandLine.path.try(:split, Cocaine::OS.path_separator)
Severity: Minor
Found in lib/paperclip/helpers.rb by rubocop

Line is too long. [89/80]
Open

      Cocaine::CommandLine.path = [cocaine_path_array, command_path].flatten.compact.uniq
Severity: Minor
Found in lib/paperclip/helpers.rb by rubocop

Line is too long. [87/80]
Open

      Cocaine::CommandLine.new(cmd, arguments, local_options).run(interpolation_values)
Severity: Minor
Found in lib/paperclip/helpers.rb by rubocop

Line is too long. [89/80]
Open

    # Find all instances of the given Active Record model +klass+ with attachment +name+.
Severity: Minor
Found in lib/paperclip/helpers.rb by rubocop

Line is too long. [94/80]
Open

      class_for(klass).unscoped.where("#{name}_file_name IS NOT NULL").find_each do |instance|
Severity: Minor
Found in lib/paperclip/helpers.rb by rubocop

Use the new Ruby 1.9 hash syntax.
Open

        local_options = local_options.merge(:logger => logger)
Severity: Minor
Found in lib/paperclip/helpers.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'"

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

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

Example:

"EnforcedStyle => 'hash_rockets'"

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

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

Example:

"EnforcedStyle => 'no_mixed_keys'"

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

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

Example:

"EnforcedStyle => 'ruby19_no_mixed_keys'"

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

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

Use def with parentheses when there are parameters.
Open

    def interpolates key, &block
Severity: Minor
Found in lib/paperclip/helpers.rb by rubocop

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

      class_name.split('::').inject(Object) do |klass, partial_class_name|
Severity: Minor
Found in lib/paperclip/helpers.rb by rubocop

There are no issues that match your filters.

Category
Status