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 416 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. [29.55/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 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

      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

      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 post_process_style has a Cognitive Complexity of 9 (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 55 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 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 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def unlink_files(files)
              Array(files).each do |file|
                file.close unless file.closed?
                file.unlink if file.respond_to?(:unlink) && file.path.present? && File.exist?(file.path)
              end
        Severity: Minor
        Found in lib/paperclip/attachment.rb - About 25 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

        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:

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

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

              saved_only_process, @options[:only_process] = @options[:only_process], style_args
        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. [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. [89/80]
        Open

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

        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. [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. [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. [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

        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:

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

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

            # +processors+ - classes that transform the attachment. Defaults to [:thumbnail]
        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. [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. [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. [81/80]
        Open

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

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

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

        Line is too long. [105/80]
        Open

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

        Line is too long. [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. [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. [97/80]
        Open

                raise Errors::StorageMethodNotFound, "Cannot load storage module '#{storage_class_name}'"
        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

        Line is too long. [96/80]
        Open

                file.unlink if file.respond_to?(:unlink) && file.path.present? && File.exist?(file.path)
        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. [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

        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

        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:

        def some_method(used, unused, _unused_but_allowed)
          puts used
        end
        

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

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

        Line is too long. [87/80]
        Open

              saved_preserve_files, @options[:preserve_files] = @options[:preserve_files], true
        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. [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

        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

        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

        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. [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. [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. [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. [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. [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

        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.

        SupportedStyles:

        Example:

        # good for all styles
        
        if condition
          statement
        else
          statement
        end
        
        # good for all styles
        if condition
          statement
        end
        

        Example:

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

        Example:

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

        Example:

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

        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'"
        
        # 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
        

        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.

        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.

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

          Example:

          def bar :baz end

          def foo(bar) self.bar # resolves name clash with argument end

          def foo2 bar = 1 self.bar # resolves name clash with local variable end

        • Calling an attribute writer to prevent an local variable assignment

          attr_writer :bar

          def foo self.bar= 1 # Make sure above attr writer is called end

        Special cases:

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

        Space inside square brackets detected.
        Open

              [ style_options, all_options ].compact.join(" ")
        Severity: Minor
        Found in lib/paperclip/attachment.rb by rubocop

        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'"
        
        # 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 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'"
        
        # 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 log message #:nodoc:
        Severity: Minor
        Found in lib/paperclip/attachment.rb by rubocop

        Use the new Ruby 1.9 hash syntax.
        Open

                :interpolator          => Paperclip::Interpolations,
        Severity: Minor
        Found in lib/paperclip/attachment.rb by rubocop

        This cop checks hash literal syntax.

        It can enforce either the use of the class hash rocket syntax or the use of the newer Ruby 1.9 syntax (when applicable).

        A separate offense is registered for each problematic pair.

        The supported styles are:

        • ruby19 - forces use of the 1.9 syntax (e.g. {a: 1}) when hashes have all symbols for keys
        • hash_rockets - forces use of hash rockets for all hashes
        • nomixedkeys - simply checks for hashes with mixed syntaxes
        • ruby19nomixed_keys - forces use of ruby 1.9 syntax and forbids mixed syntax hashes

        Example:

        "EnforcedStyle => 'ruby19'"
        
        # 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 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'"
        
        # 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 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'"
        
        # 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
        

        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

        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'"
        
        # 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 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'"
        
        # 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 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'"
        
        # 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
        

        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
        

        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'"
        
        # 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
        

        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

        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.

        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'"
        
        # 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 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'"
        
        # 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
        

        Align reduce with style.processors. on line 531.
        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:

        # bad
        while a
        .b
          something
        end
        
        # good, EnforcedStyle: aligned
        while a
              .b
          something
        end
        
        # good, EnforcedStyle: aligned
        Thing.a
             .b
             .c
        
        # good, EnforcedStyle: indented
        while a
            .b
          something
        end
        

        Do not use parallel assignment.
        Open

              saved_preserve_files, @options[:preserve_files] = @options[:preserve_files], true
        Severity: Minor
        Found in lib/paperclip/attachment.rb by rubocop

        Checks for simple usages of parallel assignment. This will only complain when the number of variables being assigned matched the number of assigning variables.

        Example:

        # bad
        a, b, c = 1, 2, 3
        a, b, c = [1, 2, 3]
        
        # good
        one, two = *foo
        a, b = foo()
        a, b = b, a
        
        a = 1
        b = 2
        c = 3
        

        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

        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'"
        
        # 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 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'"
        
        # 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
        

        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"
        

        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'"
        
        # 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
        

        Align for with Paperclip.io_adapters. on line 539.
        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:

        # bad
        while a
        .b
          something
        end
        
        # good, EnforcedStyle: aligned
        while a
              .b
          something
        end
        
        # good, EnforcedStyle: aligned
        Thing.a
             .b
             .c
        
        # good, EnforcedStyle: indented
        while a
            .b
          something
        end
        

        Space inside square brackets detected.
        Open

              [ style_options, all_options ].compact.join(" ")
        Severity: Minor
        Found in lib/paperclip/attachment.rb by rubocop

        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

        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'"
        
        # 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 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'"
        
        # 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 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'"
        
        # 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 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'"
        
        # 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 to_s style_name = default_style
        Severity: Minor
        Found in lib/paperclip/attachment.rb by rubocop

        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

        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'"
        
        # 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
        

        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

        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'"
        
        # 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 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'"
        
        # 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 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'"
        
        # 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
        

        Do not use parallel assignment.
        Open

              saved_only_process, @options[:only_process] = @options[:only_process], style_args
        Severity: Minor
        Found in lib/paperclip/attachment.rb by rubocop

        Checks for simple usages of parallel assignment. This will only complain when the number of variables being assigned matched the number of assigning variables.

        Example:

        # bad
        a, b, c = 1, 2, 3
        a, b, c = [1, 2, 3]
        
        # good
        one, two = *foo
        a, b = foo()
        a, b = b, a
        
        a = 1
        b = 2
        c = 3
        

        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'"
        
        # 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
        

        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
        

        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

                :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'"
        
        # 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 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'"
        
        # 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 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'"
        
        # 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
        

        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'
        

        There are no issues that match your filters.

        Category
        Status