thoughtbot/paperclip

View on GitHub
lib/paperclip/attachment.rb

Summary

Maintainability
D
2 days
Test Coverage

Class Attachment has 68 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Attachment
    def self.default_options
      @default_options ||= {
        :convert_options       => {},
        :default_style         => :original,
Severity: Major
Found in lib/paperclip/attachment.rb - About 1 day to fix

    File attachment.rb has 427 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'uri'
    require 'paperclip/url_generator'
    require 'active_support/deprecation'
    require 'active_support/core_ext/string/inflections'
    
    
    Severity: Minor
    Found in lib/paperclip/attachment.rb - About 6 hrs to fix

      Assignment Branch Condition size for post_process_style is too high. [32.57/15]
      Open

          def post_process_style(name, style) #:nodoc:
            begin
              raise RuntimeError.new("Style #{name} has no processors defined.") if style.processors.blank?
              intermediate_files = []
              original = @queued_for_write[:original]
      Severity: Minor
      Found in lib/paperclip/attachment.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

      Assignment Branch Condition size for queue_all_for_delete is too high. [17.58/15]
      Open

          def queue_all_for_delete #:nodoc:
            return if !file?
            unless @options[:preserve_files]
              @queued_for_delete += [:original, *styles.keys].uniq.map do |style|
                path(style) if exists?(style)
      Severity: Minor
      Found in lib/paperclip/attachment.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

      Assignment Branch Condition size for initialize is too high. [17.8/15]
      Open

          def initialize(name, instance, options = {})
            @name              = name.to_sym
            @name_string       = name.to_s
            @instance          = instance
      
      
      Severity: Minor
      Found in lib/paperclip/attachment.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

      Method post_process_style has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def post_process_style(name, style) #:nodoc:
            begin
              raise RuntimeError.new("Style #{name} has no processors defined.") if style.processors.blank?
              intermediate_files = []
              original = @queued_for_write[:original]
      Severity: Minor
      Found in lib/paperclip/attachment.rb - About 1 hr to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method default_options has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def self.default_options
            @default_options ||= {
              :convert_options       => {},
              :default_style         => :original,
              :default_url           => "/:attachment/:style/missing.png",
      Severity: Minor
      Found in lib/paperclip/attachment.rb - About 1 hr to fix

        Method queue_all_for_delete has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def queue_all_for_delete #:nodoc:
              return if !file?
              unless @options[:preserve_files]
                @queued_for_delete += [:original, *styles.keys].uniq.map do |style|
                  path(style) if exists?(style)
        Severity: Minor
        Found in lib/paperclip/attachment.rb - About 35 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Method unlink_files has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def unlink_files(files)
              Array(files).each do |file|
                file.close unless file.closed?
        
                begin
        Severity: Minor
        Found in lib/paperclip/attachment.rb - About 35 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Use each_value instead of each.
        Open

              @errors.each do |error, message|
        Severity: Minor
        Found in lib/paperclip/attachment.rb by rubocop

        This cop checks for uses of each_key and each_value Hash methods.

        Note: If you have an array of two-element arrays, you can put parentheses around the block arguments to indicate that you're not working with a hash, and suppress RuboCop offenses.

        Example:

        # bad
        hash.keys.each { |k| p k }
        hash.values.each { |v| p v }
        hash.each { |k, _v| p k }
        hash.each { |_k, v| p v }
        
        # good
        hash.each_key { |k| p k }
        hash.each_value { |v| p v }

        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"

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

                  if !@options[:check_validity_before_processing] || !instance.errors.any?
        Severity: Minor
        Found in lib/paperclip/attachment.rb by rubocop

        Space between { and | missing.
        Open

                [message].flatten.each {|m| instance.errors.add(name, m) }
        Severity: Minor
        Found in lib/paperclip/attachment.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 }

        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

        Line is too long. [97/80]
        Open

                raise Errors::StorageMethodNotFound, "Cannot load storage module '#{storage_class_name}'"
        Severity: Minor
        Found in lib/paperclip/attachment.rb by rubocop

        Use the new Ruby 1.9 hash syntax.
        Open

                :filename_cleaner      => nil,
        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

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

                :url                   => "/system/:class/:attachment/:id_partition/:style/:filename",
        Severity: Minor
        Found in lib/paperclip/attachment.rb by rubocop

        Line is too long. [94/80]
        Open

            attr_reader :name, :instance, :default_style, :convert_options, :queued_for_write, :whiny,
        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

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

            # and can instead point to an action in your app, for example for fine grained
        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

        Line is too long. [102/80]
        Open

              instance_read(:file_size) || (@queued_for_write[:original] && @queued_for_write[:original].size)
        Severity: Minor
        Found in lib/paperclip/attachment.rb by rubocop

        Line is too long. [114/80]
        Open

              OpenSSL::HMAC.hexdigest(OpenSSL::Digest.const_get(@options[:hash_digest]).new, @options[:hash_secret], data)
        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

                :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}

        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

                :url_generator         => Paperclip::UrlGenerator,
        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. [122/80]
        Open

            # +filename_cleaner+ - An object that responds to #call(filename) that will strip unacceptable charcters from filename
        Severity: Minor
        Found in lib/paperclip/attachment.rb by rubocop

        Line is too long. [81/80]
        Open

            # Determines whether the instance responds to this attribute. Used to prevent
        Severity: Minor
        Found in lib/paperclip/attachment.rb by rubocop

        Use the new Ruby 1.9 hash syntax.
        Open

                :default_url           => "/:attachment/:style/missing.png",
        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

                :hash_data             => ":class/:attachment/:id/:style/:updated_at",
        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

                :use_timestamp         => true,
        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}

        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 block argument - error. If it's necessary, use _ or _error as an argument name to indicate that it won't be used.
        Open

              @errors.each do |error, message|
        Severity: Minor
        Found in lib/paperclip/attachment.rb by rubocop

        This cop checks for unused block arguments.

        Example:

        # bad
        
        do_something do |used, unused|
          puts used
        end
        
        do_something do |bar|
          puts :foo
        end
        
        define_method(:foo) do |bar|
          puts :baz
        end

        Example:

        #good
        
        do_something do |used, _unused|
          puts used
        end
        
        do_something do
          puts :foo
        end
        
        define_method(:foo) do |_bar|
          puts :baz
        end

        Line is too long. [89/80]
        Open

            # +url+ - a relative URL of the attachment. This is interpolated using +interpolator+
        Severity: Minor
        Found in lib/paperclip/attachment.rb by rubocop

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

            # +preserve_files+ - whether to keep files on the filesystem when deleting or clearing the attachment. Defaults to false
        Severity: Minor
        Found in lib/paperclip/attachment.rb by rubocop

        Line is too long. [89/80]
        Open

                  file = Paperclip.processor(processor).make(file, style.processor_options, self)
        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.

        Use the new Ruby 1.9 hash syntax.
        Open

                :only_process          => [],
        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}

        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

        Line is too long. [84/80]
        Open

            #                  a special case that indicates all styles should be processed)
        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. [84/80]
        Open

            # Alias to +url+ that allows using the expiring_url method provided by the cloud
        Severity: Minor
        Found in lib/paperclip/attachment.rb by rubocop

        Line is too long. [81/80]
        Open

            # Reads the attachment-specific attribute on the instance. See instance_write
        Severity: Minor
        Found in lib/paperclip/attachment.rb by rubocop

        Line is too long. [86/80]
        Open

              style_options = style_options.call(instance) if style_options.respond_to?(:call)
        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

                :preserve_files        => false,
        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. [101/80]
        Open

                raise RuntimeError.new("Style #{name} has no processors defined.") if style.processors.blank?
        Severity: Minor
        Found in lib/paperclip/attachment.rb by rubocop

        Use the new Ruby 1.9 hash syntax.
        Open

                :hash_digest           => "SHA1",
        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

                :use_default_time_zone => true,
        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}

        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

        Line is too long. [113/80]
        Open

            # +only_process+ - style args to be run through the post-processor. This defaults to the empty list (which is
        Severity: Minor
        Found in lib/paperclip/attachment.rb by rubocop

        Line is too long. [103/80]
        Open

              raise ArgumentError, "Unable to generate hash without :hash_secret" unless @options[:hash_secret]
        Severity: Minor
        Found in lib/paperclip/attachment.rb by rubocop

        Line is too long. [92/80]
        Open

            # called by storage after the writes are flushed and before @queued_for_write is cleared
        Severity: Minor
        Found in lib/paperclip/attachment.rb by rubocop

        Use the new Ruby 1.9 hash syntax.
        Open

                :escape_url            => true,
        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

                :path                  => ":rails_root/public:url",
        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

                :source_file_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}

        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

            # +processors+ - classes that transform the attachment. Defaults to [:thumbnail]
        Severity: Minor
        Found in lib/paperclip/attachment.rb by rubocop

        Use the new Ruby 1.9 hash syntax.
        Open

                :default_style         => :original,
        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}

        Use the new Ruby 1.9 hash syntax.
        Open

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

                :validate_media_type   => true,
        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. [87/80]
        Open

              @options[:path].respond_to?(:call) ? @options[:path].call(self) : @options[:path]
        Severity: Minor
        Found in lib/paperclip/attachment.rb by rubocop

        Line is too long. [125/80]
        Open

              post_process_style(:original, styles[:original]) if styles.include?(:original) && process_style?(:original, style_args)
        Severity: Minor
        Found in lib/paperclip/attachment.rb by rubocop

        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

        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 ]]

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

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

        This cop checks for unused block arguments.

        Example:

        # bad
        
        do_something do |used, unused|
          puts used
        end
        
        do_something do |bar|
          puts :foo
        end
        
        define_method(:foo) do |bar|
          puts :baz
        end

        Example:

        #good
        
        do_something do |used, _unused|
          puts used
        end
        
        do_something do
          puts :foo
        end
        
        define_method(:foo) do |_bar|
          puts :baz
        end

        Line is too long. [111/80]
        Open

            # +interpolator+ - the object used to interpolate filenames and URLs. Defaults to Paperclip::Interpolations
        Severity: Minor
        Found in lib/paperclip/attachment.rb by rubocop

        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

        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
        }

        Line is too long. [94/80]
        Open

              (active_validator_classes.flat_map(&:ancestors) & Paperclip::REQUIRED_VALIDATORS).empty?
        Severity: Minor
        Found in lib/paperclip/attachment.rb by rubocop

        Line is too long. [118/80]
        Open

                unless @instance.respond_to?("#{@name_string}_#{field}") && @instance.respond_to?("#{@name_string}_#{field}=")
        Severity: Minor
        Found in lib/paperclip/attachment.rb by rubocop

        Line is too long. [126/80]
        Open

                  raise Paperclip::Error.new("#{@instance.class} model missing required attr_accessor for '#{@name_string}_#{field}'")
        Severity: Minor
        Found in lib/paperclip/attachment.rb by rubocop

        Line is too long. [84/80]
        Open

                @url_generator.for(style_name, default_options.merge(:timestamp => options))
        Severity: Minor
        Found in lib/paperclip/attachment.rb by rubocop

        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

        Redundant else-clause.
        Open

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

        Checks for empty else-clauses, possibly including comments and/or an explicit nil depending on the EnforcedStyle.

        Example: EnforcedStyle: empty

        # warn only on empty else
        
        # bad
        if condition
          statement
        else
        end
        
        # good
        if condition
          statement
        else
          nil
        end
        
        # good
        if condition
          statement
        else
          statement
        end
        
        # good
        if condition
          statement
        end

        Example: EnforcedStyle: nil

        # warn on else with nil in it
        
        # bad
        if condition
          statement
        else
          nil
        end
        
        # good
        if condition
          statement
        else
        end
        
        # good
        if condition
          statement
        else
          statement
        end
        
        # good
        if condition
          statement
        end

        Example: EnforcedStyle: both (default)

        # warn on empty else and else with nil in it
        
        # bad
        if condition
          statement
        else
          nil
        end
        
        # bad
        if condition
          statement
        else
        end
        
        # good
        if condition
          statement
        else
          statement
        end
        
        # good
        if condition
          statement
        end

        Line is too long. [105/80]
        Open

            # +path+ - where on the filesystem to store the attachment. This is interpolated using +interpolator+
        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. [97/80]
        Open

            # +hash_data+ - the relative URL for the hash data. This is interpolated using +interpolator+
        Severity: Minor
        Found in lib/paperclip/attachment.rb by rubocop

        Line is too long. [90/80]
        Open

            # +url_generator+ - The object that generates a URL. Default: Paperclip::UrlGenerator.
        Severity: Minor
        Found in lib/paperclip/attachment.rb by rubocop

        Use the new Ruby 1.9 hash syntax.
        Open

                :storage               => :filesystem,
        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

                :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}

        Use the new Ruby 1.9 hash syntax.
        Open

                :adapter_options       => { hash_digest: Digest::MD5 },
        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}

        Redundant RuntimeError.new call can be replaced with just the message.
        Open

                raise RuntimeError.new("Style #{name} has no processors defined.") if style.processors.blank?
        Severity: Minor
        Found in lib/paperclip/attachment.rb by rubocop

        This cop checks for RuntimeError as the argument of raise/fail.

        It checks for code like this:

        Example:

        # Bad
        raise RuntimeError, 'message'
        
        # Bad
        raise RuntimeError.new('message')
        
        # Good
        raise 'message'

        Redundant begin block detected.
        Open

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

        This cop checks for redundant begin blocks.

        Currently it checks for code like this:

        Example:

        def redundant
          begin
            ala
            bala
          rescue StandardError => e
            something
          end
        end
        
        def preferred
          ala
          bala
        rescue StandardError => e
          something
        end

        Use the new Ruby 1.9 hash syntax.
        Open

                @url_generator.for(style_name, default_options.merge(:timestamp => 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}

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

              require 'openssl' unless defined?(OpenSSL)
        Severity: Minor
        Found in lib/paperclip/attachment.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"

        Use def with parentheses when there are parameters.
        Open

            def log message #:nodoc:
        Severity: Minor
        Found in lib/paperclip/attachment.rb by rubocop

        This cops checks for parentheses around the arguments in method definitions. Both instance and class/singleton methods are checked.

        Example: EnforcedStyle: require_parentheses (default)

        # The `require_parentheses` style requires method definitions
        # to always use parentheses
        
        # bad
        def bar num1, num2
          num1 + num2
        end
        
        def foo descriptive_var_name,
                another_descriptive_var_name,
                last_descriptive_var_name
          do_something
        end
        
        # good
        def bar(num1, num2)
          num1 + num2
        end
        
        def foo(descriptive_var_name,
                another_descriptive_var_name,
                last_descriptive_var_name)
          do_something
        end

        Example: EnforcedStyle: requirenoparentheses

        # The `require_no_parentheses` style requires method definitions
        # to never use parentheses
        
        # bad
        def bar(num1, num2)
          num1 + num2
        end
        
        def foo(descriptive_var_name,
                another_descriptive_var_name,
                last_descriptive_var_name)
          do_something
        end
        
        # good
        def bar num1, num2
          num1 + num2
        end
        
        def foo descriptive_var_name,
                another_descriptive_var_name,
                last_descriptive_var_name
          do_something
        end

        Example: EnforcedStyle: requirenoparenthesesexceptmultiline

        # The `require_no_parentheses_except_multiline` style prefers no
        # parantheses when method definition arguments fit on single line,
        # but prefers parantheses when arguments span multiple lines.
        
        # bad
        def bar(num1, num2)
          num1 + num2
        end
        
        def foo descriptive_var_name,
                another_descriptive_var_name,
                last_descriptive_var_name
          do_something
        end
        
        # good
        def bar num1, num2
          num1 + num2
        end
        
        def foo(descriptive_var_name,
                another_descriptive_var_name,
                last_descriptive_var_name)
          do_something
        end

        Use the new Ruby 1.9 hash syntax.
        Open

                :timestamp => @options[:use_timestamp],
        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 def with parentheses when there are parameters.
        Open

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

        This cops checks for parentheses around the arguments in method definitions. Both instance and class/singleton methods are checked.

        Example: EnforcedStyle: require_parentheses (default)

        # The `require_parentheses` style requires method definitions
        # to always use parentheses
        
        # bad
        def bar num1, num2
          num1 + num2
        end
        
        def foo descriptive_var_name,
                another_descriptive_var_name,
                last_descriptive_var_name
          do_something
        end
        
        # good
        def bar(num1, num2)
          num1 + num2
        end
        
        def foo(descriptive_var_name,
                another_descriptive_var_name,
                last_descriptive_var_name)
          do_something
        end

        Example: EnforcedStyle: requirenoparentheses

        # The `require_no_parentheses` style requires method definitions
        # to never use parentheses
        
        # bad
        def bar(num1, num2)
          num1 + num2
        end
        
        def foo(descriptive_var_name,
                another_descriptive_var_name,
                last_descriptive_var_name)
          do_something
        end
        
        # good
        def bar num1, num2
          num1 + num2
        end
        
        def foo descriptive_var_name,
                another_descriptive_var_name,
                last_descriptive_var_name
          do_something
        end

        Example: EnforcedStyle: requirenoparenthesesexceptmultiline

        # The `require_no_parentheses_except_multiline` style prefers no
        # parantheses when method definition arguments fit on single line,
        # but prefers parantheses when arguments span multiple lines.
        
        # bad
        def bar(num1, num2)
          num1 + num2
        end
        
        def foo descriptive_var_name,
                another_descriptive_var_name,
                last_descriptive_var_name
          do_something
        end
        
        # good
        def bar num1, num2
          num1 + num2
        end
        
        def foo(descriptive_var_name,
                another_descriptive_var_name,
                last_descriptive_var_name)
          do_something
        end

        Redundant self detected.
        Open

              self.extend(storage_module)
        Severity: Minor
        Found in lib/paperclip/attachment.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

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

        require 'active_support/deprecation'
        Severity: Minor
        Found in lib/paperclip/attachment.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"

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

        require 'active_support/core_ext/string/inflections'
        Severity: Minor
        Found in lib/paperclip/attachment.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"

        Use the new Ruby 1.9 hash syntax.
        Open

                :check_validity_before_processing => true
        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

                :escape => @options[:escape_url]
        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}

        Avoid comparing a variable with multiple items in a conditional, use Array#include? instead.
        Open

              if options == true || options == false # Backwards compatibility.
                @url_generator.for(style_name, default_options.merge(:timestamp => options))
              else
                @url_generator.for(style_name, default_options.merge(options))
              end
        Severity: Minor
        Found in lib/paperclip/attachment.rb by rubocop

        This cop checks against comparing a variable with multiple items, where Array#include? could be used instead to avoid code repetition.

        Example:

        # bad
        a = 'a'
        foo if a == 'a' || a == 'b' || a == 'c'
        
        # good
        a = 'a'
        foo if ['a', 'b', 'c'].include?(a)

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

        require 'uri'
        Severity: Minor
        Found in lib/paperclip/attachment.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"

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

        require 'paperclip/url_generator'
        Severity: Minor
        Found in lib/paperclip/attachment.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"

        There are no issues that match your filters.

        Category
        Status