moebooru/moebooru

View on GitHub
lib/similar_images.rb

Summary

Maintainability
D
2 days
Test Coverage

Assignment Branch Condition size for similar_images is too high. [169.3/15]
Open

  def similar_images(options = {})
    errors = {}

    local_service = CONFIG["local_image_service"]

Severity: Minor
Found in lib/similar_images.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 has too many lines. [162/10]
Open

  def similar_images(options = {})
    errors = {}

    local_service = CONFIG["local_image_service"]

Severity: Minor
Found in lib/similar_images.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Module has too many lines. [233/100]
Open

module SimilarImages
  def get_services(services)
    services = services
    services ||= "local"
    if services == "all"
Severity: Minor
Found in lib/similar_images.rb by rubocop

This cop checks if the length a module exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method similar_images has a Cognitive Complexity of 74 (exceeds 5 allowed). Consider refactoring.
Open

  def similar_images(options = {})
    errors = {}

    local_service = CONFIG["local_image_service"]

Severity: Minor
Found in lib/similar_images.rb - About 1 day 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 similar_images has 162 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def similar_images(options = {})
    errors = {}

    local_service = CONFIG["local_image_service"]

Severity: Major
Found in lib/similar_images.rb - About 6 hrs to fix

    Perceived complexity for similar_images is too high. [40/7]
    Open

      def similar_images(options = {})
        errors = {}
    
        local_service = CONFIG["local_image_service"]
    
    
    Severity: Minor
    Found in lib/similar_images.rb by rubocop

    This cop tries to produce a complexity score that's a measure of the complexity the reader experiences when looking at a method. For that reason it considers when nodes as something that doesn't add as much complexity as an if or a &&. Except if it's one of those special case/when constructs where there's no expression after case. Then the cop treats it as an if/elsif/elsif... and lets all the when nodes count. In contrast to the CyclomaticComplexity cop, this cop considers else nodes as adding complexity.

    Example:

    def my_method                   # 1
      if cond                       # 1
        case var                    # 2 (0.8 + 4 * 0.2, rounded)
        when 1 then func_one
        when 2 then func_two
        when 3 then func_three
        when 4..10 then func_other
        end
      else                          # 1
        do_something until a && b   # 2
      end                           # ===
    end                             # 7 complexity points

    Cyclomatic complexity for similar_images is too high. [35/6]
    Open

      def similar_images(options = {})
        errors = {}
    
        local_service = CONFIG["local_image_service"]
    
    
    Severity: Minor
    Found in lib/similar_images.rb by rubocop

    This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

    An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

    Method has too many lines. [31/10]
    Open

      def save_search
        begin
          FileUtils.mkdir_p(SEARCH_CACHE_DIR, :mode => 0775)
    
          tempfile_path = "#{SEARCH_CACHE_DIR}/#{SecureRandom.random_number(2**32)}.upload"
    Severity: Minor
    Found in lib/similar_images.rb by rubocop

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Assignment Branch Condition size for save_search is too high. [28.62/15]
    Open

      def save_search
        begin
          FileUtils.mkdir_p(SEARCH_CACHE_DIR, :mode => 0775)
    
          tempfile_path = "#{SEARCH_CACHE_DIR}/#{SecureRandom.random_number(2**32)}.upload"
    Severity: Minor
    Found in lib/similar_images.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

    Block has too many lines. [51/25]
    Open

        server_responses.map do |server, xml|
          doc = begin
            Nokogiri::XML xml.to_valid_utf8
          rescue
            errors[server] = { :message => "parse error" }
    Severity: Minor
    Found in lib/similar_images.rb by rubocop

    This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

    Block has too many lines. [47/25]
    Open

        services_by_server.map do |server, services_list|
          server_threads.push Thread.new {
            if options[:type] == :url
              search_url = options[:source]
            end
    Severity: Minor
    Found in lib/similar_images.rb by rubocop

    This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

    Block has too many lines. [45/25]
    Open

          server_threads.push Thread.new {
            if options[:type] == :url
              search_url = options[:source]
            end
            if options[:type] == :post && CONFIG["image_service_local_searches_use_urls"]
    Severity: Minor
    Found in lib/similar_images.rb by rubocop

    This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

    Method save_search has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def save_search
        begin
          FileUtils.mkdir_p(SEARCH_CACHE_DIR, :mode => 0775)
    
          tempfile_path = "#{SEARCH_CACHE_DIR}/#{SecureRandom.random_number(2**32)}.upload"
    Severity: Minor
    Found in lib/similar_images.rb - About 1 hr to fix

      Block has too many lines. [34/25]
      Open

            doc.search("matches/match").each do |element|
              if element[:sim].to_f >= threshold && element[:sim].to_f > 0
                service = element[:service]
                image = element.search("[id]").first
      
      
      Severity: Minor
      Found in lib/similar_images.rb by rubocop

      This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

      Method save_search has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def save_search
          begin
            FileUtils.mkdir_p(SEARCH_CACHE_DIR, :mode => 0775)
      
            tempfile_path = "#{SEARCH_CACHE_DIR}/#{SecureRandom.random_number(2**32)}.upload"
      Severity: Minor
      Found in lib/similar_images.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

      Method cull_old_searches has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def cull_old_searches
          Dir.foreach(SEARCH_CACHE_DIR) do |path|
            next unless valid_saved_search(path)
      
            file = "#{SEARCH_CACHE_DIR}/#{path}"
      Severity: Minor
      Found in lib/similar_images.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

      Use the new Ruby 1.9 hash syntax.
      Open

              errors[server] = { :message => doc.root[:message] }
      Severity: Minor
      Found in lib/similar_images.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

            size = Moebooru::Resizer.reduce_to({ :width => ret[:original_width], :height => ret[:original_height] }, :width => 150, :height => 150)
      Severity: Minor
      Found in lib/similar_images.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 single-quoted strings when you don't need string interpolation or special symbols.
      Open

            if doc.root.name == "error"
      Severity: Minor
      Found in lib/similar_images.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

              errors[""] = { :services => [service], :message => "%s is an unknown service" % service }
      Severity: Minor
      Found in lib/similar_images.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

                params += [{ :name => "service[]", :data => s }]
      Severity: Minor
      Found in lib/similar_images.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

          ret = { :posts => posts, :posts_external => posts_external, :similarity => similarity, :services => services, :errors => errors }
      Severity: Minor
      Found in lib/similar_images.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

          ret = { :posts => posts, :posts_external => posts_external, :similarity => similarity, :services => services, :errors => errors }
      Severity: Minor
      Found in lib/similar_images.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

            size = Moebooru::Resizer.reduce_to({ :width => ret[:original_width], :height => ret[:original_height] }, :width => 150, :height => 150)
      Severity: Minor
      Found in lib/similar_images.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}

      Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
      Open

            if age > 60 * 60 * 24
      Severity: Minor
      Found in lib/similar_images.rb by rubocop

      Checks for if and unless statements that would fit on one line if written as a modifier if/unless. The maximum line length is configured in the Metrics/LineLength cop.

      Example:

      # bad
      if condition
        do_stuff(bar)
      end
      
      unless qux.empty?
        Foo.do_something
      end
      
      # good
      do_stuff(bar) if condition
      Foo.do_something unless qux.empty?

      Use the return of the conditional for variable assignment and comparison.
      Open

              if search_url
                params += [{
                  :name => "url",
                  :data => search_url
                }]
      Severity: Minor
      Found in lib/similar_images.rb by rubocop

      Use the new Ruby 1.9 hash syntax.
      Open

                  :filename => File.basename(source_filename)
      Severity: Minor
      Found in lib/similar_images.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

              params += [{ :name => "forcegray", :data => "on" }] if options[:forcegray] == "1"
      Severity: Minor
      Found in lib/similar_images.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

            size = Moebooru::Resizer.reduce_to({ :width => ret[:original_width], :height => ret[:original_height] }, :width => 150, :height => 150)
      Severity: Minor
      Found in lib/similar_images.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}

      Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
      Open

            if imgsize[:type].blank?
      Severity: Minor
      Found in lib/similar_images.rb by rubocop

      Checks for if and unless statements that would fit on one line if written as a modifier if/unless. The maximum line length is configured in the Metrics/LineLength cop.

      Example:

      # bad
      if condition
        do_stuff(bar)
      end
      
      unless qux.empty?
        Foo.do_something
      end
      
      # good
      do_stuff(bar) if condition
      Foo.do_something unless qux.empty?

      Use 0o for octal literals.
      Open

            FileUtils.mkdir_p(SEARCH_CACHE_DIR, :mode => 0775)
      Severity: Minor
      Found in lib/similar_images.rb by rubocop

      This cop checks for octal, hex, binary and decimal literals using uppercase prefixes and corrects them to lowercase prefix or no prefix (in case of decimals). eg. for octal use 0o instead of 0 or 0O.

      Can be configured to use 0 only for octal literals using EnforcedOctalStyle => zero_only

      Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
      Open

          services.each_index { |i| if services[i] == "local" then services[i] = CONFIG["local_image_service"] end }
      Severity: Minor
      Found in lib/similar_images.rb by rubocop

      Checks for if and unless statements that would fit on one line if written as a modifier if/unless. The maximum line length is configured in the Metrics/LineLength cop.

      Example:

      # bad
      if condition
        do_stuff(bar)
      end
      
      unless qux.empty?
        Foo.do_something
      end
      
      # good
      do_stuff(bar) if condition
      Foo.do_something unless qux.empty?

      Prefer single-quoted strings when you don't need string interpolation or special symbols.
      Open

          if services == "all"
      Severity: Minor
      Found in lib/similar_images.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"

      Avoid rescuing without specifying an error class.
      Open

            rescue
      Severity: Minor
      Found in lib/similar_images.rb by rubocop

      This cop checks for rescuing StandardError. There are two supported styles implicit and explicit. This cop will not register an offense if any error other than StandardError is specified.

      Example: EnforcedStyle: implicit

      # `implicit` will enforce using `rescue` instead of
      # `rescue StandardError`.
      
      # bad
      begin
        foo
      rescue StandardError
        bar
      end
      
      # good
      begin
        foo
      rescue
        bar
      end
      
      # good
      begin
        foo
      rescue OtherError
        bar
      end
      
      # good
      begin
        foo
      rescue StandardError, SecurityError
        bar
      end

      Example: EnforcedStyle: explicit (default)

      # `explicit` will enforce using `rescue StandardError`
      # instead of `rescue`.
      
      # bad
      begin
        foo
      rescue
        bar
      end
      
      # good
      begin
        foo
      rescue StandardError
        bar
      end
      
      # good
      begin
        foo
      rescue OtherError
        bar
      end
      
      # good
      begin
        foo
      rescue StandardError, SecurityError
        bar
      end

      Prefer annotated tokens (like %<foo>s</foo>) over unannotated tokens (like %s).
      Open

              errors[""] = { :services => [service], :message => "%s is an unknown service" % service }
      Severity: Minor
      Found in lib/similar_images.rb by rubocop

      Use a consistent style for named format string tokens.

      Note: unannotated style cop only works for strings which are passed as arguments to those methods: sprintf, format, %. The reason is that unannotated format is very similar to encoded URLs or Date/Time formatting strings.

      Example: EnforcedStyle: annotated (default)

      # bad
      format('%{greeting}', greeting: 'Hello')
      format('%s', 'Hello')
      
      # good
      format('%<greeting>s', greeting: 'Hello')</greeting>

      Example: EnforcedStyle: template

      # bad
      format('%<greeting>s', greeting: 'Hello')
      format('%s', 'Hello')
      
      # good
      format('%{greeting}', greeting: 'Hello')</greeting>

      Example: EnforcedStyle: unannotated

      # bad
      format('%<greeting>s', greeting: 'Hello')
      format('%{greeting}', 'Hello')
      
      # good
      format('%s', 'Hello')</greeting>

      Prefer single-quoted strings when you don't need string interpolation or special symbols.
      Open

          services.each_index { |i| if services[i] == "local" then services[i] = CONFIG["local_image_service"] end }
      Severity: Minor
      Found in lib/similar_images.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 single-quoted strings when you don't need string interpolation or special symbols.
      Open

              errors[""] = { :services => [service], :message => "%s is an unknown service" % service }
      Severity: Minor
      Found in lib/similar_images.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"

      Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
      Open

            if post.url.slice(0, 5) == "data:"
      Severity: Minor
      Found in lib/similar_images.rb by rubocop

      Checks for if and unless statements that would fit on one line if written as a modifier if/unless. The maximum line length is configured in the Metrics/LineLength cop.

      Example:

      # bad
      if condition
        do_stuff(bar)
      end
      
      unless qux.empty?
        Foo.do_something
      end
      
      # good
      do_stuff(bar) if condition
      Foo.do_something unless qux.empty?

      Prefer single-quoted strings when you don't need string interpolation or special symbols.
      Open

              params += [{ :name => "forcegray", :data => "on" }] if options[:forcegray] == "1"
      Severity: Minor
      Found in lib/similar_images.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 single-quoted strings when you don't need string interpolation or special symbols.
      Open

              errors[""] = { :services => [service], :message => "%s is an unknown service" % service }
      Severity: Minor
      Found in lib/similar_images.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 single-quoted strings when you don't need string interpolation or special symbols.
      Open

                    post.url = "http://" + service + "/index.php?page=post&s=view&id=" + id
      Severity: Minor
      Found in lib/similar_images.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 single-quoted strings when you don't need string interpolation or special symbols.
      Open

                  elsif service == "e-shuushuu.net" # hack
      Severity: Minor
      Found in lib/similar_images.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 single-quoted strings when you don't need string interpolation or special symbols.
      Open

                    post.url = "http://" + service + "/post/show/" + id
      Severity: Minor
      Found in lib/similar_images.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 single-quoted strings when you don't need string interpolation or special symbols.
      Open

            ret[:similarity][post] = "Original"
      Severity: Minor
      Found in lib/similar_images.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 single-quoted strings when you don't need string interpolation or special symbols.
      Open

                    post.url = "http://" + service + "/post/show/" + id
      Severity: Minor
      Found in lib/similar_images.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 single-quoted strings when you don't need string interpolation or special symbols.
      Open

            ret[:similarity][options[:source]] = "Original"
      Severity: Minor
      Found in lib/similar_images.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 to_s over string interpolation.
      Open

                  post.id = "#{next_id}"
      Severity: Minor
      Found in lib/similar_images.rb by rubocop

      This cop checks for strings that are just an interpolated expression.

      Example:

      # bad
      "#{@var}"
      
      # good
      @var.to_s
      
      # good if @var is already a String
      @var

      Use the new Ruby 1.9 hash syntax.
      Open

                  :data => search_url
      Severity: Minor
      Found in lib/similar_images.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}

      Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
      Open

              if options[:type] == :post && CONFIG["image_service_local_searches_use_urls"]
      Severity: Minor
      Found in lib/similar_images.rb by rubocop

      Checks for if and unless statements that would fit on one line if written as a modifier if/unless. The maximum line length is configured in the Metrics/LineLength cop.

      Example:

      # bad
      if condition
        do_stuff(bar)
      end
      
      unless qux.empty?
        Foo.do_something
      end
      
      # good
      do_stuff(bar) if condition
      Foo.do_something unless qux.empty?

      Prefer single-quoted strings when you don't need string interpolation or special symbols.
      Open

                  :name => "file",
      Severity: Minor
      Found in lib/similar_images.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 single-quoted strings when you don't need string interpolation or special symbols.
      Open

                errors[server] = { :message => "Timed out" }
      Severity: Minor
      Found in lib/similar_images.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 single-quoted strings when you don't need string interpolation or special symbols.
      Open

            post.rating = "q"
      Severity: Minor
      Found in lib/similar_images.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 single-quoted strings when you don't need string interpolation or special symbols.
      Open

            File.open(tempfile_path, "wb") { |f| yield f }
      Severity: Minor
      Found in lib/similar_images.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

                params += [{ :name => "service[]", :data => s }]
      Severity: Minor
      Found in lib/similar_images.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

          ret = { :posts => posts, :posts_external => posts_external, :similarity => similarity, :services => services, :errors => errors }
      Severity: Minor
      Found in lib/similar_images.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}

      Favor modifier unless usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
      Open

          unless File.exist?(file_path)
      Severity: Minor
      Found in lib/similar_images.rb by rubocop

      Checks for if and unless statements that would fit on one line if written as a modifier if/unless. The maximum line length is configured in the Metrics/LineLength cop.

      Example:

      # bad
      if condition
        do_stuff(bar)
      end
      
      unless qux.empty?
        Foo.do_something
      end
      
      # good
      do_stuff(bar) if condition
      Foo.do_something unless qux.empty?

      Prefer single-quoted strings when you don't need string interpolation or special symbols.
      Open

          services.each_index { |i| if services[i] == "local" then services[i] = CONFIG["local_image_service"] end }
      Severity: Minor
      Found in lib/similar_images.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 single-quoted strings when you don't need string interpolation or special symbols.
      Open

                  :name => "url",
      Severity: Minor
      Found in lib/similar_images.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 single-quoted strings when you don't need string interpolation or special symbols.
      Open

              errors[server] = { :message => "parse error" }
      Severity: Minor
      Found in lib/similar_images.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 single-quoted strings when you don't need string interpolation or special symbols.
      Open

                    post.url = "http://" + service + "/image/" + id + "/"
      Severity: Minor
      Found in lib/similar_images.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 single-quoted strings when you don't need string interpolation or special symbols.
      Open

              raise Moebooru::Resizer::ResizeError, "Unrecognized image format"
      Severity: Minor
      Found in lib/similar_images.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"

      Favor format over String#%.
      Open

              errors[""] = { :services => [service], :message => "%s is an unknown service" % service }
      Severity: Minor
      Found in lib/similar_images.rb by rubocop

      This cop enforces the use of a single string formatting utility. Valid options include Kernel#format, Kernel#sprintf and String#%.

      The detection of String#% cannot be implemented in a reliable manner for all cases, so only two scenarios are considered - if the first argument is a string literal and if the second argument is an array literal.

      Example: EnforcedStyle: format(default)

      # bad
      puts sprintf('%10s', 'hoge')
      puts '%10s' % 'hoge'
      
      # good
      puts format('%10s', 'hoge')

      Example: EnforcedStyle: sprintf

      # bad
      puts format('%10s', 'hoge')
      puts '%10s' % 'hoge'
      
      # good
      puts sprintf('%10s', 'hoge')

      Example: EnforcedStyle: percent

      # bad
      puts format('%10s', 'hoge')
      puts sprintf('%10s', 'hoge')
      
      # good
      puts '%10s' % 'hoge'

      Use the new Ruby 1.9 hash syntax.
      Open

                  :data => source_file,
      Severity: Minor
      Found in lib/similar_images.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

          ret = { :posts => posts, :posts_external => posts_external, :similarity => similarity, :services => services, :errors => errors }
      Severity: Minor
      Found in lib/similar_images.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

            FileUtils.mkdir_p(SEARCH_CACHE_DIR, :mode => 0775)
      Severity: Minor
      Found in lib/similar_images.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 next to skip iteration.
      Open

              if element[:sim].to_f >= threshold && element[:sim].to_f > 0
      Severity: Minor
      Found in lib/similar_images.rb by rubocop

      Use next to skip iteration instead of a condition at the end.

      Example: EnforcedStyle: skipmodifierifs (default)

      # bad
      [1, 2].each do |a|
        if a == 1
          puts a
        end
      end
      
      # good
      [1, 2].each do |a|
        next unless a == 1
        puts a
      end
      
      # good
      [1, 2].each do |o|
        puts o unless o == 1
      end

      Example: EnforcedStyle: always

      # With `always` all conditions at the end of an iteration needs to be
      # replaced by next - with `skip_modifier_ifs` the modifier if like
      # this one are ignored: `[1, 2].each { |a| return 'yes' if a == 1 }`
      
      # bad
      [1, 2].each do |o|
        puts o unless o == 1
      end
      
      # bad
      [1, 2].each do |a|
        if a == 1
          puts a
        end
      end
      
      # good
      [1, 2].each do |a|
        next unless a == 1
        puts a
      end

      Avoid using rescue in its modifier form.
      Open

              error[:services] = services_by_server[server] rescue server
      Severity: Minor
      Found in lib/similar_images.rb by rubocop

      This cop checks for uses of rescue in its modifier form.

      Example:

      # bad
      some_method rescue handle_error
      
      # good
      begin
        some_method
      rescue
        handle_error
      end

      Avoid rescuing without specifying an error class.
      Open

          rescue
      Severity: Minor
      Found in lib/similar_images.rb by rubocop

      This cop checks for rescuing StandardError. There are two supported styles implicit and explicit. This cop will not register an offense if any error other than StandardError is specified.

      Example: EnforcedStyle: implicit

      # `implicit` will enforce using `rescue` instead of
      # `rescue StandardError`.
      
      # bad
      begin
        foo
      rescue StandardError
        bar
      end
      
      # good
      begin
        foo
      rescue
        bar
      end
      
      # good
      begin
        foo
      rescue OtherError
        bar
      end
      
      # good
      begin
        foo
      rescue StandardError, SecurityError
        bar
      end

      Example: EnforcedStyle: explicit (default)

      # `explicit` will enforce using `rescue StandardError`
      # instead of `rescue`.
      
      # bad
      begin
        foo
      rescue
        bar
      end
      
      # good
      begin
        foo
      rescue StandardError
        bar
      end
      
      # good
      begin
        foo
      rescue OtherError
        bar
      end
      
      # good
      begin
        foo
      rescue StandardError, SecurityError
        bar
      end

      Prefer single-quoted strings when you don't need string interpolation or special symbols.
      Open

            doc.search("matches/match").each do |element|
      Severity: Minor
      Found in lib/similar_images.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 single-quoted strings when you don't need string interpolation or special symbols.
      Open

                image = element.search("[id]").first
      Severity: Minor
      Found in lib/similar_images.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 single-quoted strings when you don't need string interpolation or special symbols.
      Open

                  post.tags = image[:tags] || ""
      Severity: Minor
      Found in lib/similar_images.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

                errors[server] = { :message => "Timed out" }
      Severity: Minor
      Found in lib/similar_images.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

            size = Moebooru::Resizer.reduce_to({ :width => ret[:original_width], :height => ret[:original_height] }, :width => 150, :height => 150)
      Severity: Minor
      Found in lib/similar_images.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 single-quoted strings when you don't need string interpolation or special symbols.
      Open

                  if url.scheme == "https"
      Severity: Minor
      Found in lib/similar_images.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 single-quoted strings when you don't need string interpolation or special symbols.
      Open

                    post.url = "http://" + service + "/image/" + id + "/"
      Severity: Minor
      Found in lib/similar_images.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 single-quoted strings when you don't need string interpolation or special symbols.
      Open

                  post.rating = image[:rating] || "s"
      Severity: Minor
      Found in lib/similar_images.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"

      Parenthesize the param `Thread.new { if options[:type] == :url search_url = options[:source] end if options[:type] == :post && CONFIG["image_service_local_searches_use_urls"] search_url = options[:source].preview_url end
      Open

            server_threads.push Thread.new {
              if options[:type] == :url
                search_url = options[:source]
              end
              if options[:type] == :post && CONFIG["image_service_local_searches_use_urls"]
      Severity: Minor
      Found in lib/similar_images.rb by rubocop

      This cop checks for ambiguous block association with method when param passed without parentheses.

      Example:

      # bad
      some_method a { |val| puts val }

      Example:

      # good
      # With parentheses, there's no ambiguity.
      some_method(a) { |val| puts val }
      
      # good
      # Operator methods require no disambiguation
      foo == bar { |b| b.baz }
      
      # good
      # Lambda arguments require no disambiguation
      foo = ->(bar) { bar.baz }

      Use the new Ruby 1.9 hash syntax.
      Open

                  post = Post.find_by(:id => id)
      Severity: Minor
      Found in lib/similar_images.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}

      Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
      Open

              if options[:type] == :url
      Severity: Minor
      Found in lib/similar_images.rb by rubocop

      Checks for if and unless statements that would fit on one line if written as a modifier if/unless. The maximum line length is configured in the Metrics/LineLength cop.

      Example:

      # bad
      if condition
        do_stuff(bar)
      end
      
      unless qux.empty?
        Foo.do_something
      end
      
      # good
      do_stuff(bar) if condition
      Foo.do_something unless qux.empty?

      Favor modifier unless usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
      Open

            unless error[:services]
      Severity: Minor
      Found in lib/similar_images.rb by rubocop

      Checks for if and unless statements that would fit on one line if written as a modifier if/unless. The maximum line length is configured in the Metrics/LineLength cop.

      Example:

      # bad
      if condition
        do_stuff(bar)
      end
      
      unless qux.empty?
        Foo.do_something
      end
      
      # good
      do_stuff(bar) if condition
      Foo.do_something unless qux.empty?

      Prefer single-quoted strings when you don't need string interpolation or special symbols.
      Open

            ret[:search_id] = "source"
      Severity: Minor
      Found in lib/similar_images.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

              errors[""] = { :services => [service], :message => "%s is an unknown service" % service }
      Severity: Minor
      Found in lib/similar_images.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

              params += [{ :name => "forcegray", :data => "on" }] if options[:forcegray] == "1"
      Severity: Minor
      Found in lib/similar_images.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

                errors[server] = { :message => e }
      Severity: Minor
      Found in lib/similar_images.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

              errors[server] = { :message => "parse error" }
      Severity: Minor
      Found in lib/similar_images.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

              errors[server] = { :message => "invalid response" }
      Severity: Minor
      Found in lib/similar_images.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 single-quoted strings when you don't need string interpolation or special symbols.
      Open

          services ||= "local"
      Severity: Minor
      Found in lib/similar_images.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 single-quoted strings when you don't need string interpolation or special symbols.
      Open

            server = CONFIG["image_service_list"][service]
      Severity: Minor
      Found in lib/similar_images.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 return of the conditional for variable assignment and comparison.
      Open

                  if service == "gelbooru.com" # hack
                    post.url = "http://" + service + "/index.php?page=post&s=view&id=" + id
                  elsif service == "e-shuushuu.net" # hack
                    post.url = "http://" + service + "/image/" + id + "/"
                  else
      Severity: Minor
      Found in lib/similar_images.rb by rubocop

      Use the new Ruby 1.9 hash syntax.
      Open

                  :name => "url",
      Severity: Minor
      Found in lib/similar_images.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

                  :name => "file",
      Severity: Minor
      Found in lib/similar_images.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 single-quoted strings when you don't need string interpolation or special symbols.
      Open

            source_file = File.open(options[:source].preview_path, "rb") { |file| file.read }
      Severity: Minor
      Found in lib/similar_images.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

                  :binary => true,
      Severity: Minor
      Found in lib/similar_images.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 single-quoted strings when you don't need string interpolation or special symbols.
      Open

                    post.url = "http://" + service + "/index.php?page=post&s=view&id=" + id
      Severity: Minor
      Found in lib/similar_images.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"

      Freeze mutable objects assigned to constants.
      Open

        SEARCH_CACHE_DIR = "#{Rails.root}/public/data/search"
      Severity: Minor
      Found in lib/similar_images.rb by rubocop

      This cop checks whether some constant value isn't a mutable literal (e.g. array or hash).

      Example:

      # bad
      CONST = [1, 2, 3]
      
      # good
      CONST = [1, 2, 3].freeze

      Prefer single-quoted strings when you don't need string interpolation or special symbols.
      Open

            post.service = ""
      Severity: Minor
      Found in lib/similar_images.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 single-quoted strings when you don't need string interpolation or special symbols.
      Open

                  if service == "gelbooru.com" # hack
      Severity: Minor
      Found in lib/similar_images.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

          ret = { :posts => posts, :posts_external => posts_external, :similarity => similarity, :services => services, :errors => errors }
      Severity: Minor
      Found in lib/similar_images.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 single-quoted strings when you don't need string interpolation or special symbols.
      Open

            ext = imgsize[:type].gsub(/jpeg/i, "jpg").downcase
      Severity: Minor
      Found in lib/similar_images.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 single-quoted strings when you don't need string interpolation or special symbols.
      Open

            post.tags = ""
      Severity: Minor
      Found in lib/similar_images.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 single-quoted strings when you don't need string interpolation or special symbols.
      Open

            services = CONFIG["image_service_list"].map { |a, _b| a }
      Severity: Minor
      Found in lib/similar_images.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 single-quoted strings when you don't need string interpolation or special symbols.
      Open

            if post.url.slice(0, 5) == "data:"
      Severity: Minor
      Found in lib/similar_images.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 single-quoted strings when you don't need string interpolation or special symbols.
      Open

              if options[:type] == :post && CONFIG["image_service_local_searches_use_urls"]
      Severity: Minor
      Found in lib/similar_images.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 single-quoted strings when you don't need string interpolation or special symbols.
      Open

              post.url = ""
      Severity: Minor
      Found in lib/similar_images.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 return of the conditional for variable assignment and comparison.
      Open

          if services == "all"
            services = CONFIG["image_service_list"].map { |a, _b| a }
          else
            services = services.split(/,/)
          end
      Severity: Minor
      Found in lib/similar_images.rb by rubocop

      Favor modifier unless usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
      Open

          unless valid_saved_search(id) then return nil end
      Severity: Minor
      Found in lib/similar_images.rb by rubocop

      Checks for if and unless statements that would fit on one line if written as a modifier if/unless. The maximum line length is configured in the Metrics/LineLength cop.

      Example:

      # bad
      if condition
        do_stuff(bar)
      end
      
      unless qux.empty?
        Foo.do_something
      end
      
      # good
      do_stuff(bar) if condition
      Foo.do_something unless qux.empty?

      Prefer single-quoted strings when you don't need string interpolation or special symbols.
      Open

              params += [{ :name => "forcegray", :data => "on" }] if options[:forcegray] == "1"
      Severity: Minor
      Found in lib/similar_images.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 single-quoted strings when you don't need string interpolation or special symbols.
      Open

          local_service = CONFIG["local_image_service"]
      Severity: Minor
      Found in lib/similar_images.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 single-quoted strings when you don't need string interpolation or special symbols.
      Open

              errors[server] = { :message => "invalid response" }
      Severity: Minor
      Found in lib/similar_images.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 single-quoted strings when you don't need string interpolation or special symbols.
      Open

              params += [{ :name => "forcegray", :data => "on" }] if options[:forcegray] == "1"
      Severity: Minor
      Found in lib/similar_images.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 single-quoted strings when you don't need string interpolation or special symbols.
      Open

                    post.url = "http://" + service + "/image/" + id + "/"
      Severity: Minor
      Found in lib/similar_images.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"

      Pass &:read as an argument to open instead of a block.
      Open

            source_file = File.open(options[:source].preview_path, "rb") { |file| file.read }
      Severity: Minor
      Found in lib/similar_images.rb by rubocop

      Use symbols as procs when possible.

      Example:

      # bad
      something.map { |s| s.upcase }
      
      # good
      something.map(&:upcase)

      Prefer single-quoted strings when you don't need string interpolation or special symbols.
      Open

            post.id = "source"
      Severity: Minor
      Found in lib/similar_images.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 single-quoted strings when you don't need string interpolation or special symbols.
      Open

          File.open(file_path, "a")
      Severity: Minor
      Found in lib/similar_images.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 0o for octal literals.
      Open

            FileUtils.chmod(0664, file_path)
      Severity: Minor
      Found in lib/similar_images.rb by rubocop

      This cop checks for octal, hex, binary and decimal literals using uppercase prefixes and corrects them to lowercase prefix or no prefix (in case of decimals). eg. for octal use 0o instead of 0 or 0O.

      Can be configured to use 0 only for octal literals using EnforcedOctalStyle => zero_only

      Prefer single-quoted strings when you don't need string interpolation or special symbols.
      Open

                params += [{ :name => "service[]", :data => s }]
      Severity: Minor
      Found in lib/similar_images.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