angelakuo/citydogshare

View on GitHub
app/models/dog.rb

Summary

Maintainability
B
4 hrs
Test Coverage

Class has too many lines. [229/100]
Open

class Dog < ActiveRecord::Base
  include ActiveModel::ForbiddenAttributesProtection
  # attr_accessible :name, :image, :dob, :gender, :description, :motto, :fixed, :health, :comments, :contact, :availability, :mixes, :likes, :energy_level, :size, :personalities, :photo, :latitude, :longitude, :video

  scope :has_gender, lambda {|genders| filter_gender(genders)}
Severity: Minor
Found in app/models/dog.rb by rubocop

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

Class Dog has 36 methods (exceeds 20 allowed). Consider refactoring.
Open

class Dog < ActiveRecord::Base
  include ActiveModel::ForbiddenAttributesProtection
  # attr_accessible :name, :image, :dob, :gender, :description, :motto, :fixed, :health, :comments, :contact, :availability, :mixes, :likes, :energy_level, :size, :personalities, :photo, :latitude, :longitude, :video

  scope :has_gender, lambda {|genders| filter_gender(genders)}
Severity: Minor
Found in app/models/dog.rb - About 4 hrs to fix

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

      def to_json
        return {
          :id => self.id,
          :name => self.name,
          :dob => self.dob.year,
    Severity: Minor
    Found in app/models/dog.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 to_form_hash is too high. [24.02/15]
    Open

      def to_form_hash
        return {
          :name => self.name,
          :dob => self.dob.year,
          :size => self.size.id,
    Severity: Minor
    Found in app/models/dog.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. [18/10]
    Open

      def to_form_hash
        return {
          :name => self.name,
          :dob => self.dob.year,
          :size => self.size.id,
    Severity: Minor
    Found in app/models/dog.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 filter_by is too high. [20.02/15]
    Open

      def self.filter_by(criteria)
        dogs = Dog.near(criteria[:zipcode], criteria[:radius])
                  .has_mix(criteria[:mix])
                  .has_size(criteria[:size])
                  .has_likes(criteria[:like])
    Severity: Minor
    Found in app/models/dog.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. [15/10]
    Open

      def self.convert_age_ranges_to_dob_query(age_ranges_indices)
        age_ranges = [[0, 2], [2, 4], [5, 8], [9, 30]]
        age_query = ""
        selected_counter = 0
        num_selected = age_ranges_indices.length
    Severity: Minor
    Found in app/models/dog.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 age is too high. [20.25/15]
    Open

      def age
        now = Time.now.utc.to_date
        now.year - dob.year - ((now.month > dob.month || (now.month == dob.month && now.day >= dob.day)) ? 0 : 1)
      end
    Severity: Minor
    Found in app/models/dog.rb by rubocop

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

    Assignment Branch Condition size for to_json is too high. [19/15]
    Open

      def to_json
        return {
          :id => self.id,
          :name => self.name,
          :dob => self.dob.year,
    Severity: Minor
    Found in app/models/dog.rb by rubocop

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

    Assignment Branch Condition size for validate_photo_size is too high. [18.44/15]
    Open

      def validate_photo_size
        errors[:photo] << "should be less than 3MB" if photo and photo.size and photo.size > 3.megabytes
        pictures.each do |picture|
          if picture.image_file_size > 3.megabytes
            errors[:pictures] << "should be less than 3MB"
    Severity: Minor
    Found in app/models/dog.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

    Space missing inside }.
    Open

      scope :has_personalities, lambda {|personalities| filter_personality(personalities)}
    Severity: Minor
    Found in app/models/dog.rb by rubocop

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

    Example: EnforcedStyle: space (default)

    # The `space` style enforces that block braces have
    # surrounding space.
    
    # bad
    some_array.each {puts e}
    
    # good
    some_array.each { puts e }

    Example: EnforcedStyle: no_space

    # The `no_space` style enforces that block braces don't
    # have surrounding space.
    
    # bad
    some_array.each { puts e }
    
    # good
    some_array.each {puts e}

    Example: EnforcedStyleForEmptyBraces: no_space (default)

    # The `no_space` EnforcedStyleForEmptyBraces style enforces that
    # block braces don't have a space in between when empty.
    
    # bad
    some_array.each {   }
    some_array.each {  }
    some_array.each { }
    
    # good
    some_array.each {}

    Example: EnforcedStyleForEmptyBraces: space

    # The `space` EnforcedStyleForEmptyBraces style enforces that
    # block braces have at least a spece in between when empty.
    
    # bad
    some_array.each {}
    
    # good
    some_array.each { }
    some_array.each {  }
    some_array.each {   }

    Example: SpaceBeforeBlockParameters: true (default)

    # The SpaceBeforeBlockParameters style set to `true` enforces that
    # there is a space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each {|n| n * 2 }
    
    # good
    [1, 2, 3].each { |n| n * 2 }

    Example: SpaceBeforeBlockParameters: true

    # The SpaceBeforeBlockParameters style set to `false` enforces that
    # there is no space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each { |n| n * 2 }
    
    # good
    [1, 2, 3].each {|n| n * 2 }

    Trailing whitespace detected.
    Open

      
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    Trailing whitespace detected.
    Open

      
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    Use && instead of and.
    Open

        errors.add(:dob, "Dog's birthday can't be in the future.") if (!dob.nil? and dob > Date.today)
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for uses of and and or, and suggests using && and || instead. It can be configured to check only in conditions, or in all contexts.

    Example: EnforcedStyle: always (default)

    # bad
    foo.save and return
    
    # bad
    if foo and bar
    end
    
    # good
    foo.save && return
    
    # good
    if foo && bar
    end

    Example: EnforcedStyle: conditionals

    # bad
    if foo and bar
    end
    
    # good
    foo.save && return
    
    # good
    foo.save and return
    
    # good
    if foo && bar
    end

    Use && instead of and.
    Open

        errors[:photo] << "should be less than 3MB" if photo and photo.size and photo.size > 3.megabytes
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for uses of and and or, and suggests using && and || instead. It can be configured to check only in conditions, or in all contexts.

    Example: EnforcedStyle: always (default)

    # bad
    foo.save and return
    
    # bad
    if foo and bar
    end
    
    # good
    foo.save && return
    
    # good
    if foo && bar
    end

    Example: EnforcedStyle: conditionals

    # bad
    if foo and bar
    end
    
    # good
    foo.save && return
    
    # good
    foo.save and return
    
    # good
    if foo && bar
    end

    Missing top-level class documentation comment.
    Open

    class Dog < ActiveRecord::Base
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for missing top-level documentation of classes and modules. Classes with no body are exempt from the check and so are namespace modules - modules that have nothing in their bodies except classes, other modules, or constant definitions.

    The documentation requirement is annulled if the class or module has a "#:nodoc:" comment next to it. Likewise, "#:nodoc: all" does the same for all its children.

    Example:

    # bad
    class Person
      # ...
    end
    
    # good
    # Description/Explanation of Person class
    class Person
      # ...
    end

    Use the new Ruby 1.9 hash syntax.
    Open

      has_many :mixes, :through => :dog_mix_linkers
    Severity: Minor
    Found in app/models/dog.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

      validates :size, :presence => {:message => "Please select a size"}
    Severity: Minor
    Found in app/models/dog.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

          :dob => self.dob.year,
    Severity: Minor
    Found in app/models/dog.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

          :energy_level => self.readable_energy_level,
    Severity: Minor
    Found in app/models/dog.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

          :chipped => self.chipped,
    Severity: Minor
    Found in app/models/dog.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 -> { ... } lambda literal syntax for single line lambdas.
    Open

      scope :has_gender, lambda {|genders| filter_gender(genders)}
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop (by default) checks for uses of the lambda literal syntax for single line lambdas, and the method call syntax for multiline lambdas. It is configurable to enforce one of the styles for both single line and multiline lambdas as well.

    Example: EnforcedStyle: linecountdependent (default)

    # bad
    f = lambda { |x| x }
    f = ->(x) do
          x
        end
    
    # good
    f = ->(x) { x }
    f = lambda do |x|
          x
        end

    Example: EnforcedStyle: lambda

    # bad
    f = ->(x) { x }
    f = ->(x) do
          x
        end
    
    # good
    f = lambda { |x| x }
    f = lambda do |x|
          x
        end

    Example: EnforcedStyle: literal

    # bad
    f = lambda { |x| x }
    f = lambda do |x|
          x
        end
    
    # good
    f = ->(x) { x }
    f = ->(x) do
          x
        end

    Use the -> { ... } lambda literal syntax for single line lambdas.
    Open

      scope :in_age_range, lambda {|age_query| filter_age(age_query)}
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop (by default) checks for uses of the lambda literal syntax for single line lambdas, and the method call syntax for multiline lambdas. It is configurable to enforce one of the styles for both single line and multiline lambdas as well.

    Example: EnforcedStyle: linecountdependent (default)

    # bad
    f = lambda { |x| x }
    f = ->(x) do
          x
        end
    
    # good
    f = ->(x) { x }
    f = lambda do |x|
          x
        end

    Example: EnforcedStyle: lambda

    # bad
    f = ->(x) { x }
    f = ->(x) do
          x
        end
    
    # good
    f = lambda { |x| x }
    f = lambda do |x|
          x
        end

    Example: EnforcedStyle: literal

    # bad
    f = lambda { |x| x }
    f = lambda do |x|
          x
        end
    
    # good
    f = ->(x) { x }
    f = ->(x) do
          x
        end

    Redundant self detected.
    Open

        self.personalities.map {|p| p.value.capitalize}
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for redundant uses of self.

    The usage of self is only needed when:

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

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

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

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

    Example:

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

    Redundant self detected.
    Open

          self.shots_to_date ? "Yes" : "No"
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for redundant uses of self.

    The usage of self is only needed when:

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

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

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

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

    Example:

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

    Redundant self detected.
    Open

          :mixes => self.readable_mixes,
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for redundant uses of self.

    The usage of self is only needed when:

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

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

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

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

    Example:

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

    Redundant self detected.
    Open

          :likes => self.readable_likes.map {|val| val.downcase},
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for redundant uses of self.

    The usage of self is only needed when:

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

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

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

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

    Example:

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

    Redundant self detected.
    Open

          :dob => self.dob.year,
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for redundant uses of self.

    The usage of self is only needed when:

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

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

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

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

    Example:

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

    Redundant self detected.
    Open

          :chipped => self.chipped,
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for redundant uses of self.

    The usage of self is only needed when:

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

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

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

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

    Example:

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

    Redundant self detected.
    Open

          :health => self.health,
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for redundant uses of self.

    The usage of self is only needed when:

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

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

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

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

    Example:

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

    Use // around regular expression.
    Open

        video.split(%r{v=|&})[1]
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop enforces using // or %r around regular expressions.

    Example: EnforcedStyle: slashes (default)

    # bad
    snake_case = %r{^[\dA-Z_]+$}
    
    # bad
    regex = %r{
      foo
      (bar)
      (baz)
    }x
    
    # good
    snake_case = /^[\dA-Z_]+$/
    
    # good
    regex = /
      foo
      (bar)
      (baz)
    /x

    Example: EnforcedStyle: percent_r

    # bad
    snake_case = /^[\dA-Z_]+$/
    
    # bad
    regex = /
      foo
      (bar)
      (baz)
    /x
    
    # good
    snake_case = %r{^[\dA-Z_]+$}
    
    # good
    regex = %r{
      foo
      (bar)
      (baz)
    }x

    Example: EnforcedStyle: mixed

    # bad
    snake_case = %r{^[\dA-Z_]+$}
    
    # bad
    regex = /
      foo
      (bar)
      (baz)
    /x
    
    # good
    snake_case = /^[\dA-Z_]+$/
    
    # good
    regex = %r{
      foo
      (bar)
      (baz)
    }x

    Example: AllowInnerSlashes: false (default)

    # If `false`, the cop will always recommend using `%r` if one or more
    # slashes are found in the regexp string.
    
    # bad
    x =~ /home\//
    
    # good
    x =~ %r{home/}

    Example: AllowInnerSlashes: true

    # good
    x =~ /home\//

    Space inside } missing.
    Open

      validates :gender, :presence => {:message => "Please select a gender"}
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    Checks that braces used for hash literals have or don't have surrounding space depending on configuration.

    Example: EnforcedStyle: space

    # The `space` style enforces that hash literals have
    # surrounding space.
    
    # bad
    h = {a: 1, b: 2}
    
    # good
    h = { a: 1, b: 2 }

    Example: EnforcedStyle: no_space

    # The `no_space` style enforces that hash literals have
    # no surrounding space.
    
    # bad
    h = { a: 1, b: 2 }
    
    # good
    h = {a: 1, b: 2}

    Example: EnforcedStyle: compact

    # The `compact` style normally requires a space inside
    # hash braces, with the exception that successive left
    # braces or right braces are collapsed together in nested hashes.
    
    # bad
    h = { a: { b: 2 } }
    
    # good
    h = { a: { b: 2 }}

    Use the new Ruby 1.9 hash syntax.
    Open

      validates :personalities, :presence => {:message => "Please select at least one personality"}
    Severity: Minor
    Found in app/models/dog.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

                                     :large    => '600x'},
    Severity: Minor
    Found in app/models/dog.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

          :status => self.motto,
    Severity: Minor
    Found in app/models/dog.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 -> { ... } lambda literal syntax for single line lambdas.
    Open

      scope :has_bark, lambda {|bark| filter_bark(bark)}
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop (by default) checks for uses of the lambda literal syntax for single line lambdas, and the method call syntax for multiline lambdas. It is configurable to enforce one of the styles for both single line and multiline lambdas as well.

    Example: EnforcedStyle: linecountdependent (default)

    # bad
    f = lambda { |x| x }
    f = ->(x) do
          x
        end
    
    # good
    f = ->(x) { x }
    f = lambda do |x|
          x
        end

    Example: EnforcedStyle: lambda

    # bad
    f = ->(x) { x }
    f = ->(x) do
          x
        end
    
    # good
    f = lambda { |x| x }
    f = lambda do |x|
          x
        end

    Example: EnforcedStyle: literal

    # bad
    f = lambda { |x| x }
    f = lambda do |x|
          x
        end
    
    # good
    f = ->(x) { x }
    f = ->(x) do
          x
        end

    Redundant self detected.
    Open

        self.mixes.map {|m| m.value}
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for redundant uses of self.

    The usage of self is only needed when:

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

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

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

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

    Example:

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

    Redundant self detected.
    Open

        self.chipped ? "Yes" : "No"
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for redundant uses of self.

    The usage of self is only needed when:

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

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

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

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

    Example:

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

    Redundant self detected.
    Open

        self.availability && self.availability != "Unavailable" ? true : false
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for redundant uses of self.

    The usage of self is only needed when:

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

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

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

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

    Example:

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

    Redundant self detected.
    Open

          :availability => self.availability,
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for redundant uses of self.

    The usage of self is only needed when:

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

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

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

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

    Example:

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

    Redundant self detected.
    Open

          :energy_level => self.readable_energy_level,
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for redundant uses of self.

    The usage of self is only needed when:

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

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

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

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

    Example:

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

    Use 2 (not 4) spaces for indentation.
    Open

            index = Dog.age_ranges.index(i)
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cops checks for indentation that doesn't use the specified number of spaces.

    See also the IndentationConsistency cop which is the companion to this one.

    Example:

    # bad
    class A
     def test
      puts 'hello'
     end
    end
    
    # good
    class A
      def test
        puts 'hello'
      end
    end

    Example: IgnoredPatterns: ['^\s*module']

    # bad
    module A
    class B
      def test
      puts 'hello'
      end
    end
    end
    
    # good
    module A
    class B
      def test
        puts 'hello'
      end
    end
    end

    Space between { and | missing.
    Open

      scope :has_gender, lambda {|genders| filter_gender(genders)}
    Severity: Minor
    Found in app/models/dog.rb by rubocop

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

    Example: EnforcedStyle: space (default)

    # The `space` style enforces that block braces have
    # surrounding space.
    
    # bad
    some_array.each {puts e}
    
    # good
    some_array.each { puts e }

    Example: EnforcedStyle: no_space

    # The `no_space` style enforces that block braces don't
    # have surrounding space.
    
    # bad
    some_array.each { puts e }
    
    # good
    some_array.each {puts e}

    Example: EnforcedStyleForEmptyBraces: no_space (default)

    # The `no_space` EnforcedStyleForEmptyBraces style enforces that
    # block braces don't have a space in between when empty.
    
    # bad
    some_array.each {   }
    some_array.each {  }
    some_array.each { }
    
    # good
    some_array.each {}

    Example: EnforcedStyleForEmptyBraces: space

    # The `space` EnforcedStyleForEmptyBraces style enforces that
    # block braces have at least a spece in between when empty.
    
    # bad
    some_array.each {}
    
    # good
    some_array.each { }
    some_array.each {  }
    some_array.each {   }

    Example: SpaceBeforeBlockParameters: true (default)

    # The SpaceBeforeBlockParameters style set to `true` enforces that
    # there is a space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each {|n| n * 2 }
    
    # good
    [1, 2, 3].each { |n| n * 2 }

    Example: SpaceBeforeBlockParameters: true

    # The SpaceBeforeBlockParameters style set to `false` enforces that
    # there is no space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each { |n| n * 2 }
    
    # good
    [1, 2, 3].each {|n| n * 2 }

    Space inside } missing.
    Open

      validates :mixes, :presence => {:message => "Please select the mix"}
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    Checks that braces used for hash literals have or don't have surrounding space depending on configuration.

    Example: EnforcedStyle: space

    # The `space` style enforces that hash literals have
    # surrounding space.
    
    # bad
    h = {a: 1, b: 2}
    
    # good
    h = { a: 1, b: 2 }

    Example: EnforcedStyle: no_space

    # The `no_space` style enforces that hash literals have
    # no surrounding space.
    
    # bad
    h = { a: 1, b: 2 }
    
    # good
    h = {a: 1, b: 2}

    Example: EnforcedStyle: compact

    # The `compact` style normally requires a space inside
    # hash braces, with the exception that successive left
    # braces or right braces are collapsed together in nested hashes.
    
    # bad
    h = { a: { b: 2 } }
    
    # good
    h = { a: { b: 2 }}

    Line is too long. [81/80]
    Open

        self.events.where("end_date > ?", 1.day.ago.midnight).order("start_date ASC")
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    Use the new Ruby 1.9 hash syntax.
    Open

      has_many :barks, :through => :dog_bark_linkers
    Severity: Minor
    Found in app/models/dog.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

          :chipped => self.chipped,
    Severity: Minor
    Found in app/models/dog.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

          :shots_to_date => self.shots_to_date,
    Severity: Minor
    Found in app/models/dog.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

          :description => self.description,
    Severity: Minor
    Found in app/models/dog.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 => self.name,
    Severity: Minor
    Found in app/models/dog.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 => self.readable_size,
    Severity: Minor
    Found in app/models/dog.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

          :shots_to_date => self.shots_to_date,
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks hash literal syntax.

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

    A separate offense is registered for each problematic pair.

    The supported styles are:

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

    Example: EnforcedStyle: ruby19 (default)

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

    Example: EnforcedStyle: hash_rockets

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

    Example: EnforcedStyle: nomixedkeys

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

    Example: EnforcedStyle: ruby19nomixed_keys

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

    Redundant self detected.
    Open

        self.events.where("end_date > ?", 1.day.ago.midnight).pluck('end_date') != []
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for redundant uses of self.

    The usage of self is only needed when:

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

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

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

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

    Example:

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

    Space missing inside }.
    Open

      scope :has_gender, lambda {|genders| filter_gender(genders)}
    Severity: Minor
    Found in app/models/dog.rb by rubocop

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

    Example: EnforcedStyle: space (default)

    # The `space` style enforces that block braces have
    # surrounding space.
    
    # bad
    some_array.each {puts e}
    
    # good
    some_array.each { puts e }

    Example: EnforcedStyle: no_space

    # The `no_space` style enforces that block braces don't
    # have surrounding space.
    
    # bad
    some_array.each { puts e }
    
    # good
    some_array.each {puts e}

    Example: EnforcedStyleForEmptyBraces: no_space (default)

    # The `no_space` EnforcedStyleForEmptyBraces style enforces that
    # block braces don't have a space in between when empty.
    
    # bad
    some_array.each {   }
    some_array.each {  }
    some_array.each { }
    
    # good
    some_array.each {}

    Example: EnforcedStyleForEmptyBraces: space

    # The `space` EnforcedStyleForEmptyBraces style enforces that
    # block braces have at least a spece in between when empty.
    
    # bad
    some_array.each {}
    
    # good
    some_array.each { }
    some_array.each {  }
    some_array.each {   }

    Example: SpaceBeforeBlockParameters: true (default)

    # The SpaceBeforeBlockParameters style set to `true` enforces that
    # there is a space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each {|n| n * 2 }
    
    # good
    [1, 2, 3].each { |n| n * 2 }

    Example: SpaceBeforeBlockParameters: true

    # The SpaceBeforeBlockParameters style set to `false` enforces that
    # there is no space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each { |n| n * 2 }
    
    # good
    [1, 2, 3].each {|n| n * 2 }

    Space between { and | missing.
    Open

      scope :has_personalities, lambda {|personalities| filter_personality(personalities)}
    Severity: Minor
    Found in app/models/dog.rb by rubocop

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

    Example: EnforcedStyle: space (default)

    # The `space` style enforces that block braces have
    # surrounding space.
    
    # bad
    some_array.each {puts e}
    
    # good
    some_array.each { puts e }

    Example: EnforcedStyle: no_space

    # The `no_space` style enforces that block braces don't
    # have surrounding space.
    
    # bad
    some_array.each { puts e }
    
    # good
    some_array.each {puts e}

    Example: EnforcedStyleForEmptyBraces: no_space (default)

    # The `no_space` EnforcedStyleForEmptyBraces style enforces that
    # block braces don't have a space in between when empty.
    
    # bad
    some_array.each {   }
    some_array.each {  }
    some_array.each { }
    
    # good
    some_array.each {}

    Example: EnforcedStyleForEmptyBraces: space

    # The `space` EnforcedStyleForEmptyBraces style enforces that
    # block braces have at least a spece in between when empty.
    
    # bad
    some_array.each {}
    
    # good
    some_array.each { }
    some_array.each {  }
    some_array.each {   }

    Example: SpaceBeforeBlockParameters: true (default)

    # The SpaceBeforeBlockParameters style set to `true` enforces that
    # there is a space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each {|n| n * 2 }
    
    # good
    [1, 2, 3].each { |n| n * 2 }

    Example: SpaceBeforeBlockParameters: true

    # The SpaceBeforeBlockParameters style set to `false` enforces that
    # there is no space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each { |n| n * 2 }
    
    # good
    [1, 2, 3].each {|n| n * 2 }

    Space between { and | missing.
    Open

        self.personalities.map {|p| p.value.capitalize}
    Severity: Minor
    Found in app/models/dog.rb by rubocop

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

    Example: EnforcedStyle: space (default)

    # The `space` style enforces that block braces have
    # surrounding space.
    
    # bad
    some_array.each {puts e}
    
    # good
    some_array.each { puts e }

    Example: EnforcedStyle: no_space

    # The `no_space` style enforces that block braces don't
    # have surrounding space.
    
    # bad
    some_array.each { puts e }
    
    # good
    some_array.each {puts e}

    Example: EnforcedStyleForEmptyBraces: no_space (default)

    # The `no_space` EnforcedStyleForEmptyBraces style enforces that
    # block braces don't have a space in between when empty.
    
    # bad
    some_array.each {   }
    some_array.each {  }
    some_array.each { }
    
    # good
    some_array.each {}

    Example: EnforcedStyleForEmptyBraces: space

    # The `space` EnforcedStyleForEmptyBraces style enforces that
    # block braces have at least a spece in between when empty.
    
    # bad
    some_array.each {}
    
    # good
    some_array.each { }
    some_array.each {  }
    some_array.each {   }

    Example: SpaceBeforeBlockParameters: true (default)

    # The SpaceBeforeBlockParameters style set to `true` enforces that
    # there is a space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each {|n| n * 2 }
    
    # good
    [1, 2, 3].each { |n| n * 2 }

    Example: SpaceBeforeBlockParameters: true

    # The SpaceBeforeBlockParameters style set to `false` enforces that
    # there is no space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each { |n| n * 2 }
    
    # good
    [1, 2, 3].each {|n| n * 2 }

    Space missing inside }.
    Open

        self.personalities.map {|p| p.value.capitalize}
    Severity: Minor
    Found in app/models/dog.rb by rubocop

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

    Example: EnforcedStyle: space (default)

    # The `space` style enforces that block braces have
    # surrounding space.
    
    # bad
    some_array.each {puts e}
    
    # good
    some_array.each { puts e }

    Example: EnforcedStyle: no_space

    # The `no_space` style enforces that block braces don't
    # have surrounding space.
    
    # bad
    some_array.each { puts e }
    
    # good
    some_array.each {puts e}

    Example: EnforcedStyleForEmptyBraces: no_space (default)

    # The `no_space` EnforcedStyleForEmptyBraces style enforces that
    # block braces don't have a space in between when empty.
    
    # bad
    some_array.each {   }
    some_array.each {  }
    some_array.each { }
    
    # good
    some_array.each {}

    Example: EnforcedStyleForEmptyBraces: space

    # The `space` EnforcedStyleForEmptyBraces style enforces that
    # block braces have at least a spece in between when empty.
    
    # bad
    some_array.each {}
    
    # good
    some_array.each { }
    some_array.each {  }
    some_array.each {   }

    Example: SpaceBeforeBlockParameters: true (default)

    # The SpaceBeforeBlockParameters style set to `true` enforces that
    # there is a space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each {|n| n * 2 }
    
    # good
    [1, 2, 3].each { |n| n * 2 }

    Example: SpaceBeforeBlockParameters: true

    # The SpaceBeforeBlockParameters style set to `false` enforces that
    # there is no space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each { |n| n * 2 }
    
    # good
    [1, 2, 3].each {|n| n * 2 }

    Space inside { missing.
    Open

      validates :gender, :presence => {:message => "Please select a gender"}
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    Checks that braces used for hash literals have or don't have surrounding space depending on configuration.

    Example: EnforcedStyle: space

    # The `space` style enforces that hash literals have
    # surrounding space.
    
    # bad
    h = {a: 1, b: 2}
    
    # good
    h = { a: 1, b: 2 }

    Example: EnforcedStyle: no_space

    # The `no_space` style enforces that hash literals have
    # no surrounding space.
    
    # bad
    h = { a: 1, b: 2 }
    
    # good
    h = {a: 1, b: 2}

    Example: EnforcedStyle: compact

    # The `compact` style normally requires a space inside
    # hash braces, with the exception that successive left
    # braces or right braces are collapsed together in nested hashes.
    
    # bad
    h = { a: { b: 2 } }
    
    # good
    h = { a: { b: 2 }}

    Trailing whitespace detected.
    Open

      
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    Line is too long. [110/80]
    Open

      validates_inclusion_of :fixed, in: [true, false], :message => "Please select a response for spayed/neutered"
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    Line is too long. [104/80]
    Open

      validates_inclusion_of :chipped, in: [true, false], :message => "Please select a response for chipped"
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    Line is too long. [81/80]
    Open

        self.events.where("end_date > ?", 1.day.ago.midnight).pluck('end_date') != []
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    Use the new Ruby 1.9 hash syntax.
    Open

      validates :size, :presence => {:message => "Please select a size"}
    Severity: Minor
    Found in app/models/dog.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}

    Space missing inside }.
    Open

        self.barks.map {|b| b.value.capitalize}
    Severity: Minor
    Found in app/models/dog.rb by rubocop

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

    Example: EnforcedStyle: space (default)

    # The `space` style enforces that block braces have
    # surrounding space.
    
    # bad
    some_array.each {puts e}
    
    # good
    some_array.each { puts e }

    Example: EnforcedStyle: no_space

    # The `no_space` style enforces that block braces don't
    # have surrounding space.
    
    # bad
    some_array.each { puts e }
    
    # good
    some_array.each {puts e}

    Example: EnforcedStyleForEmptyBraces: no_space (default)

    # The `no_space` EnforcedStyleForEmptyBraces style enforces that
    # block braces don't have a space in between when empty.
    
    # bad
    some_array.each {   }
    some_array.each {  }
    some_array.each { }
    
    # good
    some_array.each {}

    Example: EnforcedStyleForEmptyBraces: space

    # The `space` EnforcedStyleForEmptyBraces style enforces that
    # block braces have at least a spece in between when empty.
    
    # bad
    some_array.each {}
    
    # good
    some_array.each { }
    some_array.each {  }
    some_array.each {   }

    Example: SpaceBeforeBlockParameters: true (default)

    # The SpaceBeforeBlockParameters style set to `true` enforces that
    # there is a space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each {|n| n * 2 }
    
    # good
    [1, 2, 3].each { |n| n * 2 }

    Example: SpaceBeforeBlockParameters: true

    # The SpaceBeforeBlockParameters style set to `false` enforces that
    # there is no space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each { |n| n * 2 }
    
    # good
    [1, 2, 3].each {|n| n * 2 }

    Don't use parentheses around the condition of an if.
    Open

        errors.add(:availability, "- Please select a proper availability.") if (!availability.nil? and availability != "Available" and availability != "Unavailable")
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for the presence of superfluous parentheses around the condition of if/unless/while/until.

    Example:

    # bad
    x += 1 while (x < 10)
    foo unless (bar || baz)
    
    if (x > 10)
    elsif (x < 3)
    end
    
    # good
    x += 1 while x < 10
    foo unless bar || baz
    
    if x > 10
    elsif x < 3
    end

    Trailing whitespace detected.
    Open

      
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    Redundant self detected.
    Open

        self.energy_level ? self.energy_level.value.capitalize : ""
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for redundant uses of self.

    The usage of self is only needed when:

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

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

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

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

    Example:

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

    Line is too long. [86/80]
    Open

      scope :has_energy_level, lambda {|energy_levels| filter_energy_level(energy_levels)}
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    Redundant self detected.
    Open

          :id => self.id,
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for redundant uses of self.

    The usage of self is only needed when:

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

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

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

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

    Example:

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

    Line is too long. [161/80]
    Open

        errors.add(:availability, "- Please select a proper availability.") if (!availability.nil? and availability != "Available" and availability != "Unavailable")
    Severity: Minor
    Found in app/models/dog.rb by rubocop

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

        self.energy_level ? self.energy_level.value.capitalize : ""
    Severity: Minor
    Found in app/models/dog.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

        self.fixed ? "Yes" : "No"
    Severity: Minor
    Found in app/models/dog.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

      validates :name, :presence => {:message => "Please enter a name"}
    Severity: Minor
    Found in app/models/dog.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}

    Omit parentheses for ternary conditions.
    Open

        now.year - dob.year - ((now.month > dob.month || (now.month == dob.month && now.day >= dob.day)) ? 0 : 1)
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for the presence of parentheses around ternary conditions. It is configurable to enforce inclusion or omission of parentheses using EnforcedStyle. Omission is only enforced when removing the parentheses won't cause a different behavior.

    Example: EnforcedStyle: requirenoparentheses (default)

    # bad
    foo = (bar?) ? a : b
    foo = (bar.baz?) ? a : b
    foo = (bar && baz) ? a : b
    
    # good
    foo = bar? ? a : b
    foo = bar.baz? ? a : b
    foo = bar && baz ? a : b

    Example: EnforcedStyle: require_parentheses

    # bad
    foo = bar? ? a : b
    foo = bar.baz? ? a : b
    foo = bar && baz ? a : b
    
    # good
    foo = (bar?) ? a : b
    foo = (bar.baz?) ? a : b
    foo = (bar && baz) ? a : b

    Example: EnforcedStyle: requireparentheseswhen_complex

    # bad
    foo = (bar?) ? a : b
    foo = (bar.baz?) ? a : b
    foo = bar && baz ? a : b
    
    # good
    foo = bar? ? a : b
    foo = bar.baz? ? a : b
    foo = (bar && baz) ? a : b

    Use %w or %W for an array of words.
    Open

        ["Male", "Female"]
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop can check for array literals made up of word-like strings, that are not using the %w() syntax.

    Alternatively, it can check for uses of the %w() syntax, in projects which do not want to include that syntax.

    Configuration option: MinSize If set, arrays with fewer elements than this value will not trigger the cop. For example, a MinSize of 3 will not enforce a style on an array of 2 or fewer elements.

    Example: EnforcedStyle: percent (default)

    # good
    %w[foo bar baz]
    
    # bad
    ['foo', 'bar', 'baz']

    Example: EnforcedStyle: brackets

    # good
    ['foo', 'bar', 'baz']
    
    # bad
    %w[foo bar baz]

    Use the new Ruby 1.9 hash syntax.
    Open

          :size => self.size.id,
    Severity: Minor
    Found in app/models/dog.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

          :dob => self.dob.year,
    Severity: Minor
    Found in app/models/dog.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

          :personalities => self.readable_personalities,
    Severity: Minor
    Found in app/models/dog.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 -> { ... } lambda literal syntax for single line lambdas.
    Open

      scope :has_personalities, lambda {|personalities| filter_personality(personalities)}
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop (by default) checks for uses of the lambda literal syntax for single line lambdas, and the method call syntax for multiline lambdas. It is configurable to enforce one of the styles for both single line and multiline lambdas as well.

    Example: EnforcedStyle: linecountdependent (default)

    # bad
    f = lambda { |x| x }
    f = ->(x) do
          x
        end
    
    # good
    f = ->(x) { x }
    f = lambda do |x|
          x
        end

    Example: EnforcedStyle: lambda

    # bad
    f = ->(x) { x }
    f = ->(x) do
          x
        end
    
    # good
    f = lambda { |x| x }
    f = lambda do |x|
          x
        end

    Example: EnforcedStyle: literal

    # bad
    f = lambda { |x| x }
    f = lambda do |x|
          x
        end
    
    # good
    f = ->(x) { x }
    f = ->(x) do
          x
        end

    Redundant self detected.
    Open

        self.size.value.capitalize
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for redundant uses of self.

    The usage of self is only needed when:

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

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

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

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

    Example:

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

    Redundant self detected.
    Open

          :chipped => self.chipped,
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for redundant uses of self.

    The usage of self is only needed when:

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

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

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

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

    Example:

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

    Redundant self detected.
    Open

          :description => self.description,
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for redundant uses of self.

    The usage of self is only needed when:

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

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

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

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

    Example:

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

    Redundant self detected.
    Open

          :size => self.readable_size,
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for redundant uses of self.

    The usage of self is only needed when:

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

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

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

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

    Example:

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

    Redundant self detected.
    Open

          :mixes => self.readable_mixes,
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for redundant uses of self.

    The usage of self is only needed when:

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

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

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

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

    Example:

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

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

      validates :gender, :presence => {:message => "Please select a gender"}
    Severity: Minor
    Found in app/models/dog.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

                        :path => "/:class/:images/:id/:style/:basename.:extension"
    Severity: Minor
    Found in app/models/dog.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

        self.chipped ? "Yes" : "No"
    Severity: Minor
    Found in app/models/dog.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

        ["Male", "Female"]
    Severity: Minor
    Found in app/models/dog.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

        joins(:likes).where("likes.value" => likes) unless likes.empty?
    Severity: Minor
    Found in app/models/dog.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

        joins(:energy_level).where("energy_levels.value" => energy_levels) unless energy_levels.empty?
    Severity: Minor
    Found in app/models/dog.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 &:downcase as an argument to map instead of a block.
    Open

          :personalities => self.readable_personalities.map {|val| val.downcase},
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    Use symbols as procs when possible.

    Example:

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

    Space between { and | missing.
    Open

      scope :has_bark, lambda {|bark| filter_bark(bark)}
    Severity: Minor
    Found in app/models/dog.rb by rubocop

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

    Example: EnforcedStyle: space (default)

    # The `space` style enforces that block braces have
    # surrounding space.
    
    # bad
    some_array.each {puts e}
    
    # good
    some_array.each { puts e }

    Example: EnforcedStyle: no_space

    # The `no_space` style enforces that block braces don't
    # have surrounding space.
    
    # bad
    some_array.each { puts e }
    
    # good
    some_array.each {puts e}

    Example: EnforcedStyleForEmptyBraces: no_space (default)

    # The `no_space` EnforcedStyleForEmptyBraces style enforces that
    # block braces don't have a space in between when empty.
    
    # bad
    some_array.each {   }
    some_array.each {  }
    some_array.each { }
    
    # good
    some_array.each {}

    Example: EnforcedStyleForEmptyBraces: space

    # The `space` EnforcedStyleForEmptyBraces style enforces that
    # block braces have at least a spece in between when empty.
    
    # bad
    some_array.each {}
    
    # good
    some_array.each { }
    some_array.each {  }
    some_array.each {   }

    Example: SpaceBeforeBlockParameters: true (default)

    # The SpaceBeforeBlockParameters style set to `true` enforces that
    # there is a space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each {|n| n * 2 }
    
    # good
    [1, 2, 3].each { |n| n * 2 }

    Example: SpaceBeforeBlockParameters: true

    # The SpaceBeforeBlockParameters style set to `false` enforces that
    # there is no space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each { |n| n * 2 }
    
    # good
    [1, 2, 3].each {|n| n * 2 }

    Space between { and | missing.
    Open

        self.mixes.map {|m| m.value}
    Severity: Minor
    Found in app/models/dog.rb by rubocop

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

    Example: EnforcedStyle: space (default)

    # The `space` style enforces that block braces have
    # surrounding space.
    
    # bad
    some_array.each {puts e}
    
    # good
    some_array.each { puts e }

    Example: EnforcedStyle: no_space

    # The `no_space` style enforces that block braces don't
    # have surrounding space.
    
    # bad
    some_array.each { puts e }
    
    # good
    some_array.each {puts e}

    Example: EnforcedStyleForEmptyBraces: no_space (default)

    # The `no_space` EnforcedStyleForEmptyBraces style enforces that
    # block braces don't have a space in between when empty.
    
    # bad
    some_array.each {   }
    some_array.each {  }
    some_array.each { }
    
    # good
    some_array.each {}

    Example: EnforcedStyleForEmptyBraces: space

    # The `space` EnforcedStyleForEmptyBraces style enforces that
    # block braces have at least a spece in between when empty.
    
    # bad
    some_array.each {}
    
    # good
    some_array.each { }
    some_array.each {  }
    some_array.each {   }

    Example: SpaceBeforeBlockParameters: true (default)

    # The SpaceBeforeBlockParameters style set to `true` enforces that
    # there is a space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each {|n| n * 2 }
    
    # good
    [1, 2, 3].each { |n| n * 2 }

    Example: SpaceBeforeBlockParameters: true

    # The SpaceBeforeBlockParameters style set to `false` enforces that
    # there is no space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each { |n| n * 2 }
    
    # good
    [1, 2, 3].each {|n| n * 2 }

    Space missing inside }.
    Open

          :personalities => self.readable_personalities.map {|val| val.downcase},
    Severity: Minor
    Found in app/models/dog.rb by rubocop

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

    Example: EnforcedStyle: space (default)

    # The `space` style enforces that block braces have
    # surrounding space.
    
    # bad
    some_array.each {puts e}
    
    # good
    some_array.each { puts e }

    Example: EnforcedStyle: no_space

    # The `no_space` style enforces that block braces don't
    # have surrounding space.
    
    # bad
    some_array.each { puts e }
    
    # good
    some_array.each {puts e}

    Example: EnforcedStyleForEmptyBraces: no_space (default)

    # The `no_space` EnforcedStyleForEmptyBraces style enforces that
    # block braces don't have a space in between when empty.
    
    # bad
    some_array.each {   }
    some_array.each {  }
    some_array.each { }
    
    # good
    some_array.each {}

    Example: EnforcedStyleForEmptyBraces: space

    # The `space` EnforcedStyleForEmptyBraces style enforces that
    # block braces have at least a spece in between when empty.
    
    # bad
    some_array.each {}
    
    # good
    some_array.each { }
    some_array.each {  }
    some_array.each {   }

    Example: SpaceBeforeBlockParameters: true (default)

    # The SpaceBeforeBlockParameters style set to `true` enforces that
    # there is a space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each {|n| n * 2 }
    
    # good
    [1, 2, 3].each { |n| n * 2 }

    Example: SpaceBeforeBlockParameters: true

    # The SpaceBeforeBlockParameters style set to `false` enforces that
    # there is no space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each { |n| n * 2 }
    
    # good
    [1, 2, 3].each {|n| n * 2 }

    Trailing whitespace detected.
    Open

      
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    Use the new Ruby 1.9 hash syntax.
    Open

      validates :gender, :presence => {:message => "Please select a gender"}
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks hash literal syntax.

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

    A separate offense is registered for each problematic pair.

    The supported styles are:

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

    Example: EnforcedStyle: ruby19 (default)

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

    Example: EnforcedStyle: hash_rockets

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

    Example: EnforcedStyle: nomixedkeys

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

    Example: EnforcedStyle: ruby19nomixed_keys

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

    Use the new Ruby 1.9 hash syntax.
    Open

                        :styles => { :small    => '150x',
    Severity: Minor
    Found in app/models/dog.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

          :fixed => self.fixed,
    Severity: Minor
    Found in app/models/dog.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

          :status => self.motto,
    Severity: Minor
    Found in app/models/dog.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 dob.year.zero? instead of dob.year == 0.
    Open

        out = "" if dob.year == 0
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for usage of comparison operators (==, >, <) to test numbers as zero, positive, or negative. These can be replaced by their respective predicate methods. The cop can also be configured to do the reverse.

    The cop disregards #nonzero? as it its value is truthy or falsey, but not true and false, and thus not always interchangeable with != 0.

    The cop ignores comparisons to global variables, since they are often populated with objects which can be compared with integers, but are not themselves Interger polymorphic.

    Example: EnforcedStyle: predicate (default)

    # bad
    
    foo == 0
    0 > foo
    bar.baz > 0
    
    # good
    
    foo.zero?
    foo.negative?
    bar.baz.positive?

    Example: EnforcedStyle: comparison

    # bad
    
    foo.zero?
    foo.negative?
    bar.baz.positive?
    
    # good
    
    foo == 0
    0 > foo
    bar.baz > 0

    Redundant self detected.
    Open

        User.find(self.user_id)
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for redundant uses of self.

    The usage of self is only needed when:

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

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

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

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

    Example:

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

    Redundant self detected.
    Open

          :barks => self.readable_barks,
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for redundant uses of self.

    The usage of self is only needed when:

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

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

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

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

    Example:

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

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

      validates_inclusion_of :chipped, in: [true, false], :message => "Please select a response for chipped"
    Severity: Minor
    Found in app/models/dog.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

                        :bucket => ENV["AWS_BUCKET_NAME"],
    Severity: Minor
    Found in app/models/dog.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

        joins(:barks).where("barks.value" => bark) unless barks.empty?
    Severity: Minor
    Found in app/models/dog.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

        self.events.where("end_date > ?", 1.day.ago.midnight).order("start_date ASC")
    Severity: Minor
    Found in app/models/dog.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"

    Space missing inside }.
    Open

      scope :has_energy_level, lambda {|energy_levels| filter_energy_level(energy_levels)}
    Severity: Minor
    Found in app/models/dog.rb by rubocop

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

    Example: EnforcedStyle: space (default)

    # The `space` style enforces that block braces have
    # surrounding space.
    
    # bad
    some_array.each {puts e}
    
    # good
    some_array.each { puts e }

    Example: EnforcedStyle: no_space

    # The `no_space` style enforces that block braces don't
    # have surrounding space.
    
    # bad
    some_array.each { puts e }
    
    # good
    some_array.each {puts e}

    Example: EnforcedStyleForEmptyBraces: no_space (default)

    # The `no_space` EnforcedStyleForEmptyBraces style enforces that
    # block braces don't have a space in between when empty.
    
    # bad
    some_array.each {   }
    some_array.each {  }
    some_array.each { }
    
    # good
    some_array.each {}

    Example: EnforcedStyleForEmptyBraces: space

    # The `space` EnforcedStyleForEmptyBraces style enforces that
    # block braces have at least a spece in between when empty.
    
    # bad
    some_array.each {}
    
    # good
    some_array.each { }
    some_array.each {  }
    some_array.each {   }

    Example: SpaceBeforeBlockParameters: true (default)

    # The SpaceBeforeBlockParameters style set to `true` enforces that
    # there is a space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each {|n| n * 2 }
    
    # good
    [1, 2, 3].each { |n| n * 2 }

    Example: SpaceBeforeBlockParameters: true

    # The SpaceBeforeBlockParameters style set to `false` enforces that
    # there is no space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each { |n| n * 2 }
    
    # good
    [1, 2, 3].each {|n| n * 2 }

    Space between { and | missing.
    Open

      scope :has_size, lambda {|sizes| filter_size(sizes)}
    Severity: Minor
    Found in app/models/dog.rb by rubocop

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

    Example: EnforcedStyle: space (default)

    # The `space` style enforces that block braces have
    # surrounding space.
    
    # bad
    some_array.each {puts e}
    
    # good
    some_array.each { puts e }

    Example: EnforcedStyle: no_space

    # The `no_space` style enforces that block braces don't
    # have surrounding space.
    
    # bad
    some_array.each { puts e }
    
    # good
    some_array.each {puts e}

    Example: EnforcedStyleForEmptyBraces: no_space (default)

    # The `no_space` EnforcedStyleForEmptyBraces style enforces that
    # block braces don't have a space in between when empty.
    
    # bad
    some_array.each {   }
    some_array.each {  }
    some_array.each { }
    
    # good
    some_array.each {}

    Example: EnforcedStyleForEmptyBraces: space

    # The `space` EnforcedStyleForEmptyBraces style enforces that
    # block braces have at least a spece in between when empty.
    
    # bad
    some_array.each {}
    
    # good
    some_array.each { }
    some_array.each {  }
    some_array.each {   }

    Example: SpaceBeforeBlockParameters: true (default)

    # The SpaceBeforeBlockParameters style set to `true` enforces that
    # there is a space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each {|n| n * 2 }
    
    # good
    [1, 2, 3].each { |n| n * 2 }

    Example: SpaceBeforeBlockParameters: true

    # The SpaceBeforeBlockParameters style set to `false` enforces that
    # there is no space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each { |n| n * 2 }
    
    # good
    [1, 2, 3].each {|n| n * 2 }

    Space between { and | missing.
    Open

          :likes => self.readable_likes.map {|val| val.downcase},
    Severity: Minor
    Found in app/models/dog.rb by rubocop

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

    Example: EnforcedStyle: space (default)

    # The `space` style enforces that block braces have
    # surrounding space.
    
    # bad
    some_array.each {puts e}
    
    # good
    some_array.each { puts e }

    Example: EnforcedStyle: no_space

    # The `no_space` style enforces that block braces don't
    # have surrounding space.
    
    # bad
    some_array.each { puts e }
    
    # good
    some_array.each {puts e}

    Example: EnforcedStyleForEmptyBraces: no_space (default)

    # The `no_space` EnforcedStyleForEmptyBraces style enforces that
    # block braces don't have a space in between when empty.
    
    # bad
    some_array.each {   }
    some_array.each {  }
    some_array.each { }
    
    # good
    some_array.each {}

    Example: EnforcedStyleForEmptyBraces: space

    # The `space` EnforcedStyleForEmptyBraces style enforces that
    # block braces have at least a spece in between when empty.
    
    # bad
    some_array.each {}
    
    # good
    some_array.each { }
    some_array.each {  }
    some_array.each {   }

    Example: SpaceBeforeBlockParameters: true (default)

    # The SpaceBeforeBlockParameters style set to `true` enforces that
    # there is a space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each {|n| n * 2 }
    
    # good
    [1, 2, 3].each { |n| n * 2 }

    Example: SpaceBeforeBlockParameters: true

    # The SpaceBeforeBlockParameters style set to `false` enforces that
    # there is no space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each { |n| n * 2 }
    
    # good
    [1, 2, 3].each {|n| n * 2 }

    Trailing whitespace detected.
    Open

      
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    Use the new Ruby 1.9 hash syntax.
    Open

      validates :mixes, :presence => {:message => "Please select the mix"}
    Severity: Minor
    Found in app/models/dog.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

          :mixes => self.readable_mixes,
    Severity: Minor
    Found in app/models/dog.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

          :id => self.id,
    Severity: Minor
    Found in app/models/dog.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

      validates :mixes, :presence => {:message => "Please select the mix"}
    Severity: Minor
    Found in app/models/dog.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.add(:availability, "- Please select a proper availability.") if (!availability.nil? and availability != "Available" and availability != "Unavailable")
    Severity: Minor
    Found in app/models/dog.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

        out = "" if dob.year == 0
    Severity: Minor
    Found in app/models/dog.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

        joins(:personalities).where("personalities.value" => personalities) unless personalities.empty?
    Severity: Minor
    Found in app/models/dog.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"

    Missing space after #.
    Open

      #paperclip dog multiple pictures
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks whether comments have a leading space after the # denoting the start of the comment. The leading space is not required for some RDoc special syntax, like #++, #--, #:nodoc, =begin- and =end comments, "shebang" directives, or rackup options.

    Example:

    # bad
    #Some comment
    
    # good
    # Some comment

    Space missing inside }.
    Open

        self.likes.map {|l| l.value.capitalize}
    Severity: Minor
    Found in app/models/dog.rb by rubocop

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

    Example: EnforcedStyle: space (default)

    # The `space` style enforces that block braces have
    # surrounding space.
    
    # bad
    some_array.each {puts e}
    
    # good
    some_array.each { puts e }

    Example: EnforcedStyle: no_space

    # The `no_space` style enforces that block braces don't
    # have surrounding space.
    
    # bad
    some_array.each { puts e }
    
    # good
    some_array.each {puts e}

    Example: EnforcedStyleForEmptyBraces: no_space (default)

    # The `no_space` EnforcedStyleForEmptyBraces style enforces that
    # block braces don't have a space in between when empty.
    
    # bad
    some_array.each {   }
    some_array.each {  }
    some_array.each { }
    
    # good
    some_array.each {}

    Example: EnforcedStyleForEmptyBraces: space

    # The `space` EnforcedStyleForEmptyBraces style enforces that
    # block braces have at least a spece in between when empty.
    
    # bad
    some_array.each {}
    
    # good
    some_array.each { }
    some_array.each {  }
    some_array.each {   }

    Example: SpaceBeforeBlockParameters: true (default)

    # The SpaceBeforeBlockParameters style set to `true` enforces that
    # there is a space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each {|n| n * 2 }
    
    # good
    [1, 2, 3].each { |n| n * 2 }

    Example: SpaceBeforeBlockParameters: true

    # The SpaceBeforeBlockParameters style set to `false` enforces that
    # there is no space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each { |n| n * 2 }
    
    # good
    [1, 2, 3].each {|n| n * 2 }

    Trailing whitespace detected.
    Open

      has_attached_file :photo, 
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    Trailing whitespace detected.
    Open

      
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    Line is too long. [98/80]
    Open

        errors.add(:dob, "Dog's birthday can't be in the future.") if (!dob.nil? and dob > Date.today)
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    Use the new Ruby 1.9 hash syntax.
    Open

      validates_inclusion_of :fixed, in: [true, false], :message => "Please select a response for spayed/neutered"
    Severity: Minor
    Found in app/models/dog.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

          :barks => self.readable_barks,
    Severity: Minor
    Found in app/models/dog.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}

    Don't use parentheses around the condition of an if.
    Open

        errors.add(:dob, "Dog's birthday can't be in the future.") if (!dob.nil? and dob > Date.today)
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for the presence of superfluous parentheses around the condition of if/unless/while/until.

    Example:

    # bad
    x += 1 while (x < 10)
    foo unless (bar || baz)
    
    if (x > 10)
    elsif (x < 3)
    end
    
    # good
    x += 1 while x < 10
    foo unless bar || baz
    
    if x > 10
    elsif x < 3
    end

    Redundant self detected.
    Open

          :energy_level => self.energy_level ? self.energy_level.id : 0,
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for redundant uses of self.

    The usage of self is only needed when:

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

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

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

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

    Example:

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

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

      validates_inclusion_of :fixed, in: [true, false], :message => "Please select a response for spayed/neutered"
    Severity: Minor
    Found in app/models/dog.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[:pictures] << "should be less than 3MB"
    Severity: Minor
    Found in app/models/dog.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

        out = "1 year old" if y == 1
    Severity: Minor
    Found in app/models/dog.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

          self.shots_to_date ? "Yes" : "No"
    Severity: Minor
    Found in app/models/dog.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"

    Space missing inside }.
    Open

      scope :has_bark, lambda {|bark| filter_bark(bark)}
    Severity: Minor
    Found in app/models/dog.rb by rubocop

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

    Example: EnforcedStyle: space (default)

    # The `space` style enforces that block braces have
    # surrounding space.
    
    # bad
    some_array.each {puts e}
    
    # good
    some_array.each { puts e }

    Example: EnforcedStyle: no_space

    # The `no_space` style enforces that block braces don't
    # have surrounding space.
    
    # bad
    some_array.each { puts e }
    
    # good
    some_array.each {puts e}

    Example: EnforcedStyleForEmptyBraces: no_space (default)

    # The `no_space` EnforcedStyleForEmptyBraces style enforces that
    # block braces don't have a space in between when empty.
    
    # bad
    some_array.each {   }
    some_array.each {  }
    some_array.each { }
    
    # good
    some_array.each {}

    Example: EnforcedStyleForEmptyBraces: space

    # The `space` EnforcedStyleForEmptyBraces style enforces that
    # block braces have at least a spece in between when empty.
    
    # bad
    some_array.each {}
    
    # good
    some_array.each { }
    some_array.each {  }
    some_array.each {   }

    Example: SpaceBeforeBlockParameters: true (default)

    # The SpaceBeforeBlockParameters style set to `true` enforces that
    # there is a space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each {|n| n * 2 }
    
    # good
    [1, 2, 3].each { |n| n * 2 }

    Example: SpaceBeforeBlockParameters: true

    # The SpaceBeforeBlockParameters style set to `false` enforces that
    # there is no space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each { |n| n * 2 }
    
    # good
    [1, 2, 3].each {|n| n * 2 }

    Space between { and | missing.
    Open

          :personalities => self.readable_personalities.map {|val| val.downcase},
    Severity: Minor
    Found in app/models/dog.rb by rubocop

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

    Example: EnforcedStyle: space (default)

    # The `space` style enforces that block braces have
    # surrounding space.
    
    # bad
    some_array.each {puts e}
    
    # good
    some_array.each { puts e }

    Example: EnforcedStyle: no_space

    # The `no_space` style enforces that block braces don't
    # have surrounding space.
    
    # bad
    some_array.each { puts e }
    
    # good
    some_array.each {puts e}

    Example: EnforcedStyleForEmptyBraces: no_space (default)

    # The `no_space` EnforcedStyleForEmptyBraces style enforces that
    # block braces don't have a space in between when empty.
    
    # bad
    some_array.each {   }
    some_array.each {  }
    some_array.each { }
    
    # good
    some_array.each {}

    Example: EnforcedStyleForEmptyBraces: space

    # The `space` EnforcedStyleForEmptyBraces style enforces that
    # block braces have at least a spece in between when empty.
    
    # bad
    some_array.each {}
    
    # good
    some_array.each { }
    some_array.each {  }
    some_array.each {   }

    Example: SpaceBeforeBlockParameters: true (default)

    # The SpaceBeforeBlockParameters style set to `true` enforces that
    # there is a space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each {|n| n * 2 }
    
    # good
    [1, 2, 3].each { |n| n * 2 }

    Example: SpaceBeforeBlockParameters: true

    # The SpaceBeforeBlockParameters style set to `false` enforces that
    # there is no space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each { |n| n * 2 }
    
    # good
    [1, 2, 3].each {|n| n * 2 }

    Space inside } missing.
    Open

      validates :name, :presence => {:message => "Please enter a name"}
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    Checks that braces used for hash literals have or don't have surrounding space depending on configuration.

    Example: EnforcedStyle: space

    # The `space` style enforces that hash literals have
    # surrounding space.
    
    # bad
    h = {a: 1, b: 2}
    
    # good
    h = { a: 1, b: 2 }

    Example: EnforcedStyle: no_space

    # The `no_space` style enforces that hash literals have
    # no surrounding space.
    
    # bad
    h = { a: 1, b: 2 }
    
    # good
    h = {a: 1, b: 2}

    Example: EnforcedStyle: compact

    # The `compact` style normally requires a space inside
    # hash braces, with the exception that successive left
    # braces or right braces are collapsed together in nested hashes.
    
    # bad
    h = { a: { b: 2 } }
    
    # good
    h = { a: { b: 2 }}

    Trailing whitespace detected.
    Open

      
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    Line is too long. [216/80]
    Open

      # attr_accessible :name, :image, :dob, :gender, :description, :motto, :fixed, :health, :comments, :contact, :availability, :mixes, :likes, :energy_level, :size, :personalities, :photo, :latitude, :longitude, :video
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    Use && instead of and.
    Open

        errors.add(:availability, "- Please select a proper availability.") if (!availability.nil? and availability != "Available" and availability != "Unavailable")
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for uses of and and or, and suggests using && and || instead. It can be configured to check only in conditions, or in all contexts.

    Example: EnforcedStyle: always (default)

    # bad
    foo.save and return
    
    # bad
    if foo and bar
    end
    
    # good
    foo.save && return
    
    # good
    if foo && bar
    end

    Example: EnforcedStyle: conditionals

    # bad
    if foo and bar
    end
    
    # good
    foo.save && return
    
    # good
    foo.save and return
    
    # good
    if foo && bar
    end

    Use the new Ruby 1.9 hash syntax.
    Open

          :name => self.name,
    Severity: Minor
    Found in app/models/dog.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

          :gender => self.gender,
    Severity: Minor
    Found in app/models/dog.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

          :mixes => self.readable_mixes,
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks hash literal syntax.

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

    A separate offense is registered for each problematic pair.

    The supported styles are:

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

    Example: EnforcedStyle: ruby19 (default)

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

    Example: EnforcedStyle: hash_rockets

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

    Example: EnforcedStyle: nomixedkeys

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

    Example: EnforcedStyle: ruby19nomixed_keys

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

    Redundant self detected.
    Open

          :health => self.health,
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for redundant uses of self.

    The usage of self is only needed when:

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

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

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

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

    Example:

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

    Redundant self detected.
    Open

          :likes => self.readable_likes,
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for redundant uses of self.

    The usage of self is only needed when:

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

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

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

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

    Example:

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

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

      validates :size, :presence => {:message => "Please select a size"}
    Severity: Minor
    Found in app/models/dog.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

        out = "< 1 year old" if y == 0
    Severity: Minor
    Found in app/models/dog.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

        self.fixed ? "Yes" : "No"
    Severity: Minor
    Found in app/models/dog.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"

    Space between { and | missing.
    Open

      scope :has_mix, lambda {|mix| filter_mix(mix)}
    Severity: Minor
    Found in app/models/dog.rb by rubocop

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

    Example: EnforcedStyle: space (default)

    # The `space` style enforces that block braces have
    # surrounding space.
    
    # bad
    some_array.each {puts e}
    
    # good
    some_array.each { puts e }

    Example: EnforcedStyle: no_space

    # The `no_space` style enforces that block braces don't
    # have surrounding space.
    
    # bad
    some_array.each { puts e }
    
    # good
    some_array.each {puts e}

    Example: EnforcedStyleForEmptyBraces: no_space (default)

    # The `no_space` EnforcedStyleForEmptyBraces style enforces that
    # block braces don't have a space in between when empty.
    
    # bad
    some_array.each {   }
    some_array.each {  }
    some_array.each { }
    
    # good
    some_array.each {}

    Example: EnforcedStyleForEmptyBraces: space

    # The `space` EnforcedStyleForEmptyBraces style enforces that
    # block braces have at least a spece in between when empty.
    
    # bad
    some_array.each {}
    
    # good
    some_array.each { }
    some_array.each {  }
    some_array.each {   }

    Example: SpaceBeforeBlockParameters: true (default)

    # The SpaceBeforeBlockParameters style set to `true` enforces that
    # there is a space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each {|n| n * 2 }
    
    # good
    [1, 2, 3].each { |n| n * 2 }

    Example: SpaceBeforeBlockParameters: true

    # The SpaceBeforeBlockParameters style set to `false` enforces that
    # there is no space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each { |n| n * 2 }
    
    # good
    [1, 2, 3].each {|n| n * 2 }

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

          self.shots_to_date ? "Yes" : "No"
    Severity: Minor
    Found in app/models/dog.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"

    Space between { and | missing.
    Open

      scope :in_age_range, lambda {|age_query| filter_age(age_query)}
    Severity: Minor
    Found in app/models/dog.rb by rubocop

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

    Example: EnforcedStyle: space (default)

    # The `space` style enforces that block braces have
    # surrounding space.
    
    # bad
    some_array.each {puts e}
    
    # good
    some_array.each { puts e }

    Example: EnforcedStyle: no_space

    # The `no_space` style enforces that block braces don't
    # have surrounding space.
    
    # bad
    some_array.each { puts e }
    
    # good
    some_array.each {puts e}

    Example: EnforcedStyleForEmptyBraces: no_space (default)

    # The `no_space` EnforcedStyleForEmptyBraces style enforces that
    # block braces don't have a space in between when empty.
    
    # bad
    some_array.each {   }
    some_array.each {  }
    some_array.each { }
    
    # good
    some_array.each {}

    Example: EnforcedStyleForEmptyBraces: space

    # The `space` EnforcedStyleForEmptyBraces style enforces that
    # block braces have at least a spece in between when empty.
    
    # bad
    some_array.each {}
    
    # good
    some_array.each { }
    some_array.each {  }
    some_array.each {   }

    Example: SpaceBeforeBlockParameters: true (default)

    # The SpaceBeforeBlockParameters style set to `true` enforces that
    # there is a space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each {|n| n * 2 }
    
    # good
    [1, 2, 3].each { |n| n * 2 }

    Example: SpaceBeforeBlockParameters: true

    # The SpaceBeforeBlockParameters style set to `false` enforces that
    # there is no space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each { |n| n * 2 }
    
    # good
    [1, 2, 3].each {|n| n * 2 }

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

        ["Male", "Female"]
    Severity: Minor
    Found in app/models/dog.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"

    Space missing inside }.
    Open

        self.mixes.map {|m| m.value}
    Severity: Minor
    Found in app/models/dog.rb by rubocop

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

    Example: EnforcedStyle: space (default)

    # The `space` style enforces that block braces have
    # surrounding space.
    
    # bad
    some_array.each {puts e}
    
    # good
    some_array.each { puts e }

    Example: EnforcedStyle: no_space

    # The `no_space` style enforces that block braces don't
    # have surrounding space.
    
    # bad
    some_array.each { puts e }
    
    # good
    some_array.each {puts e}

    Example: EnforcedStyleForEmptyBraces: no_space (default)

    # The `no_space` EnforcedStyleForEmptyBraces style enforces that
    # block braces don't have a space in between when empty.
    
    # bad
    some_array.each {   }
    some_array.each {  }
    some_array.each { }
    
    # good
    some_array.each {}

    Example: EnforcedStyleForEmptyBraces: space

    # The `space` EnforcedStyleForEmptyBraces style enforces that
    # block braces have at least a spece in between when empty.
    
    # bad
    some_array.each {}
    
    # good
    some_array.each { }
    some_array.each {  }
    some_array.each {   }

    Example: SpaceBeforeBlockParameters: true (default)

    # The SpaceBeforeBlockParameters style set to `true` enforces that
    # there is a space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each {|n| n * 2 }
    
    # good
    [1, 2, 3].each { |n| n * 2 }

    Example: SpaceBeforeBlockParameters: true

    # The SpaceBeforeBlockParameters style set to `false` enforces that
    # there is no space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each { |n| n * 2 }
    
    # good
    [1, 2, 3].each {|n| n * 2 }

    Prefer to_s over string interpolation.
    Open

        "#{user.zipcode}"
    Severity: Minor
    Found in app/models/dog.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

    Trailing whitespace detected.
    Open

      
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    Line is too long. [95/80]
    Open

      validates :personalities, :presence => {:message => "Please select at least one personality"}
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    Line is too long. [100/80]
    Open

        errors[:photo] << "should be less than 3MB" if photo and photo.size and photo.size > 3.megabytes
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    Line is too long. [109/80]
    Open

        now.year - dob.year - ((now.month > dob.month || (now.month == dob.month && now.day >= dob.day)) ? 0 : 1)
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    Use the new Ruby 1.9 hash syntax.
    Open

                        :storage => :s3,
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks hash literal syntax.

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

    A separate offense is registered for each problematic pair.

    The supported styles are:

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

    Example: EnforcedStyle: ruby19 (default)

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

    Example: EnforcedStyle: hash_rockets

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

    Example: EnforcedStyle: nomixedkeys

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

    Example: EnforcedStyle: ruby19nomixed_keys

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

    Use the new Ruby 1.9 hash syntax.
    Open

                        :path => "/:class/:images/:id/:style/:basename.:extension"
    Severity: Minor
    Found in app/models/dog.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

                                     :medium   => '300x',
    Severity: Minor
    Found in app/models/dog.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

          :health => self.health,
    Severity: Minor
    Found in app/models/dog.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 -> { ... } lambda literal syntax for single line lambdas.
    Open

      scope :has_likes, lambda {|likes| filter_like(likes)}
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop (by default) checks for uses of the lambda literal syntax for single line lambdas, and the method call syntax for multiline lambdas. It is configurable to enforce one of the styles for both single line and multiline lambdas as well.

    Example: EnforcedStyle: linecountdependent (default)

    # bad
    f = lambda { |x| x }
    f = ->(x) do
          x
        end
    
    # good
    f = ->(x) { x }
    f = lambda do |x|
          x
        end

    Example: EnforcedStyle: lambda

    # bad
    f = ->(x) { x }
    f = ->(x) do
          x
        end
    
    # good
    f = lambda { |x| x }
    f = lambda do |x|
          x
        end

    Example: EnforcedStyle: literal

    # bad
    f = lambda { |x| x }
    f = lambda do |x|
          x
        end
    
    # good
    f = ->(x) { x }
    f = ->(x) do
          x
        end

    Redundant self detected.
    Open

          :dob => self.dob.year,
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for redundant uses of self.

    The usage of self is only needed when:

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

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

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

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

    Example:

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

    Redundant self detected.
    Open

          :shots_to_date => self.shots_to_date,
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for redundant uses of self.

    The usage of self is only needed when:

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

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

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

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

    Example:

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

    Redundant self detected.
    Open

          :shots_to_date => self.shots_to_date,
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for redundant uses of self.

    The usage of self is only needed when:

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

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

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

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

    Example:

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

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

        where(age_query) unless age_query == ""
    Severity: Minor
    Found in app/models/dog.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"

    Missing space after #.
    Open

      #paperclip avatar
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks whether comments have a leading space after the # denoting the start of the comment. The leading space is not required for some RDoc special syntax, like #++, #--, #:nodoc, =begin- and =end comments, "shebang" directives, or rackup options.

    Example:

    # bad
    #Some comment
    
    # good
    # Some comment

    Space missing inside }.
    Open

      scope :has_mix, lambda {|mix| filter_mix(mix)}
    Severity: Minor
    Found in app/models/dog.rb by rubocop

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

    Example: EnforcedStyle: space (default)

    # The `space` style enforces that block braces have
    # surrounding space.
    
    # bad
    some_array.each {puts e}
    
    # good
    some_array.each { puts e }

    Example: EnforcedStyle: no_space

    # The `no_space` style enforces that block braces don't
    # have surrounding space.
    
    # bad
    some_array.each { puts e }
    
    # good
    some_array.each {puts e}

    Example: EnforcedStyleForEmptyBraces: no_space (default)

    # The `no_space` EnforcedStyleForEmptyBraces style enforces that
    # block braces don't have a space in between when empty.
    
    # bad
    some_array.each {   }
    some_array.each {  }
    some_array.each { }
    
    # good
    some_array.each {}

    Example: EnforcedStyleForEmptyBraces: space

    # The `space` EnforcedStyleForEmptyBraces style enforces that
    # block braces have at least a spece in between when empty.
    
    # bad
    some_array.each {}
    
    # good
    some_array.each { }
    some_array.each {  }
    some_array.each {   }

    Example: SpaceBeforeBlockParameters: true (default)

    # The SpaceBeforeBlockParameters style set to `true` enforces that
    # there is a space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each {|n| n * 2 }
    
    # good
    [1, 2, 3].each { |n| n * 2 }

    Example: SpaceBeforeBlockParameters: true

    # The SpaceBeforeBlockParameters style set to `false` enforces that
    # there is no space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each { |n| n * 2 }
    
    # good
    [1, 2, 3].each {|n| n * 2 }

    Space missing inside }.
    Open

      scope :in_age_range, lambda {|age_query| filter_age(age_query)}
    Severity: Minor
    Found in app/models/dog.rb by rubocop

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

    Example: EnforcedStyle: space (default)

    # The `space` style enforces that block braces have
    # surrounding space.
    
    # bad
    some_array.each {puts e}
    
    # good
    some_array.each { puts e }

    Example: EnforcedStyle: no_space

    # The `no_space` style enforces that block braces don't
    # have surrounding space.
    
    # bad
    some_array.each { puts e }
    
    # good
    some_array.each {puts e}

    Example: EnforcedStyleForEmptyBraces: no_space (default)

    # The `no_space` EnforcedStyleForEmptyBraces style enforces that
    # block braces don't have a space in between when empty.
    
    # bad
    some_array.each {   }
    some_array.each {  }
    some_array.each { }
    
    # good
    some_array.each {}

    Example: EnforcedStyleForEmptyBraces: space

    # The `space` EnforcedStyleForEmptyBraces style enforces that
    # block braces have at least a spece in between when empty.
    
    # bad
    some_array.each {}
    
    # good
    some_array.each { }
    some_array.each {  }
    some_array.each {   }

    Example: SpaceBeforeBlockParameters: true (default)

    # The SpaceBeforeBlockParameters style set to `true` enforces that
    # there is a space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each {|n| n * 2 }
    
    # good
    [1, 2, 3].each { |n| n * 2 }

    Example: SpaceBeforeBlockParameters: true

    # The SpaceBeforeBlockParameters style set to `false` enforces that
    # there is no space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each { |n| n * 2 }
    
    # good
    [1, 2, 3].each {|n| n * 2 }

    Space inside } missing.
    Open

                                     :large    => '600x'},
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    Checks that braces used for hash literals have or don't have surrounding space depending on configuration.

    Example: EnforcedStyle: space

    # The `space` style enforces that hash literals have
    # surrounding space.
    
    # bad
    h = {a: 1, b: 2}
    
    # good
    h = { a: 1, b: 2 }

    Example: EnforcedStyle: no_space

    # The `no_space` style enforces that hash literals have
    # no surrounding space.
    
    # bad
    h = { a: 1, b: 2 }
    
    # good
    h = {a: 1, b: 2}

    Example: EnforcedStyle: compact

    # The `compact` style normally requires a space inside
    # hash braces, with the exception that successive left
    # braces or right braces are collapsed together in nested hashes.
    
    # bad
    h = { a: { b: 2 } }
    
    # good
    h = { a: { b: 2 }}

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

            if selected_counter < num_selected
              age_query += (base + " OR ")
            else
              age_query += base
            end
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    Use the new Ruby 1.9 hash syntax.
    Open

                        :bucket => ENV["AWS_BUCKET_NAME"],
    Severity: Minor
    Found in app/models/dog.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

          :fixed => self.fixed,
    Severity: Minor
    Found in app/models/dog.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

          :parent => self.user_id
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks hash literal syntax.

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

    A separate offense is registered for each problematic pair.

    The supported styles are:

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

    Example: EnforcedStyle: ruby19 (default)

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

    Example: EnforcedStyle: hash_rockets

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

    Example: EnforcedStyle: nomixedkeys

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

    Example: EnforcedStyle: ruby19nomixed_keys

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

    Redundant self detected.
    Open

          :description => self.description,
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for redundant uses of self.

    The usage of self is only needed when:

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

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

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

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

    Example:

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

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

                        :default_url => "",
    Severity: Minor
    Found in app/models/dog.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.add(:availability, "- Please select a proper availability.") if (!availability.nil? and availability != "Available" and availability != "Unavailable")
    Severity: Minor
    Found in app/models/dog.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[:photo] << "should be less than 3MB" if photo and photo.size and photo.size > 3.megabytes
    Severity: Minor
    Found in app/models/dog.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

        ["0-2 years", "2-4 years", "5-8 years", "9+ years"]
    Severity: Minor
    Found in app/models/dog.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

        first = (Time.now - ranges[i][1].years).strftime "%Y-%m-%d %H:%M:%S"
    Severity: Minor
    Found in app/models/dog.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"

    Space between { and | missing.
    Open

        self.barks.map {|b| b.value.capitalize}
    Severity: Minor
    Found in app/models/dog.rb by rubocop

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

    Example: EnforcedStyle: space (default)

    # The `space` style enforces that block braces have
    # surrounding space.
    
    # bad
    some_array.each {puts e}
    
    # good
    some_array.each { puts e }

    Example: EnforcedStyle: no_space

    # The `no_space` style enforces that block braces don't
    # have surrounding space.
    
    # bad
    some_array.each { puts e }
    
    # good
    some_array.each {puts e}

    Example: EnforcedStyleForEmptyBraces: no_space (default)

    # The `no_space` EnforcedStyleForEmptyBraces style enforces that
    # block braces don't have a space in between when empty.
    
    # bad
    some_array.each {   }
    some_array.each {  }
    some_array.each { }
    
    # good
    some_array.each {}

    Example: EnforcedStyleForEmptyBraces: space

    # The `space` EnforcedStyleForEmptyBraces style enforces that
    # block braces have at least a spece in between when empty.
    
    # bad
    some_array.each {}
    
    # good
    some_array.each { }
    some_array.each {  }
    some_array.each {   }

    Example: SpaceBeforeBlockParameters: true (default)

    # The SpaceBeforeBlockParameters style set to `true` enforces that
    # there is a space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each {|n| n * 2 }
    
    # good
    [1, 2, 3].each { |n| n * 2 }

    Example: SpaceBeforeBlockParameters: true

    # The SpaceBeforeBlockParameters style set to `false` enforces that
    # there is no space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each { |n| n * 2 }
    
    # good
    [1, 2, 3].each {|n| n * 2 }

    Space inside { missing.
    Open

      validates :mixes, :presence => {:message => "Please select the mix"}
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    Checks that braces used for hash literals have or don't have surrounding space depending on configuration.

    Example: EnforcedStyle: space

    # The `space` style enforces that hash literals have
    # surrounding space.
    
    # bad
    h = {a: 1, b: 2}
    
    # good
    h = { a: 1, b: 2 }

    Example: EnforcedStyle: no_space

    # The `no_space` style enforces that hash literals have
    # no surrounding space.
    
    # bad
    h = { a: 1, b: 2 }
    
    # good
    h = {a: 1, b: 2}

    Example: EnforcedStyle: compact

    # The `compact` style normally requires a space inside
    # hash braces, with the exception that successive left
    # braces or right braces are collapsed together in nested hashes.
    
    # bad
    h = { a: { b: 2 } }
    
    # good
    h = { a: { b: 2 }}

    Trailing whitespace detected.
    Open

      
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    Useless assignment to variable - base.
    Open

        base = %Q[("dogs"."dob" BETWEEN '#{first}' AND '#{second}')]
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for every useless assignment to local variable in every scope. The basic idea for this cop was from the warning of ruby -cw:

    assigned but unused variable - foo

    Currently this cop has advanced logic that detects unreferenced reassignments and properly handles varied cases such as branch, loop, rescue, ensure, etc.

    Example:

    # bad
    
    def some_method
      some_var = 1
      do_something
    end

    Example:

    # good
    
    def some_method
      some_var = 1
      do_something(some_var)
    end

    Line is too long. [88/80]
    Open

      validates_attachment_content_type :photo, :content_type => ['image/jpeg', 'image/png']
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    Use the new Ruby 1.9 hash syntax.
    Open

      has_many :personalities, :through => :dog_personality_linkers
    Severity: Minor
    Found in app/models/dog.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

          :personalities => self.readable_personalities.map {|val| val.downcase},
    Severity: Minor
    Found in app/models/dog.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

          :barks => self.readable_barks,
    Severity: Minor
    Found in app/models/dog.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

          :health => self.health,
    Severity: Minor
    Found in app/models/dog.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

          :description => self.description,
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks hash literal syntax.

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

    A separate offense is registered for each problematic pair.

    The supported styles are:

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

    Example: EnforcedStyle: ruby19 (default)

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

    Example: EnforcedStyle: hash_rockets

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

    Example: EnforcedStyle: nomixedkeys

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

    Example: EnforcedStyle: ruby19nomixed_keys

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

    Redundant self detected.
    Open

        self.energy_level ? self.energy_level.value.capitalize : ""
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for redundant uses of self.

    The usage of self is only needed when:

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

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

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

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

    Example:

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

    Redundant self detected.
    Open

        if !self.shots_to_date.nil?
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for redundant uses of self.

    The usage of self is only needed when:

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

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

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

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

    Example:

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

    Redundant self detected.
    Open

          :fixed => self.fixed,
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for redundant uses of self.

    The usage of self is only needed when:

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

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

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

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

    Example:

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

    Redundant self detected.
    Open

          :fixed => self.fixed,
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for redundant uses of self.

    The usage of self is only needed when:

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

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

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

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

    Example:

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

    Redundant self detected.
    Open

          :parent => self.user_id
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for redundant uses of self.

    The usage of self is only needed when:

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

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

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

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

    Example:

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

    Redundant self detected.
    Open

        self.events.where("end_date > ?", 1.day.ago.midnight).order("start_date ASC")
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for redundant uses of self.

    The usage of self is only needed when:

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

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

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

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

    Example:

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

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

        self.availability && self.availability != "Unavailable" ? true : false
    Severity: Minor
    Found in app/models/dog.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

        where("gender" => genders) unless genders.empty?
    Severity: Minor
    Found in app/models/dog.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"

    Space between { and | missing.
    Open

      scope :has_energy_level, lambda {|energy_levels| filter_energy_level(energy_levels)}
    Severity: Minor
    Found in app/models/dog.rb by rubocop

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

    Example: EnforcedStyle: space (default)

    # The `space` style enforces that block braces have
    # surrounding space.
    
    # bad
    some_array.each {puts e}
    
    # good
    some_array.each { puts e }

    Example: EnforcedStyle: no_space

    # The `no_space` style enforces that block braces don't
    # have surrounding space.
    
    # bad
    some_array.each { puts e }
    
    # good
    some_array.each {puts e}

    Example: EnforcedStyleForEmptyBraces: no_space (default)

    # The `no_space` EnforcedStyleForEmptyBraces style enforces that
    # block braces don't have a space in between when empty.
    
    # bad
    some_array.each {   }
    some_array.each {  }
    some_array.each { }
    
    # good
    some_array.each {}

    Example: EnforcedStyleForEmptyBraces: space

    # The `space` EnforcedStyleForEmptyBraces style enforces that
    # block braces have at least a spece in between when empty.
    
    # bad
    some_array.each {}
    
    # good
    some_array.each { }
    some_array.each {  }
    some_array.each {   }

    Example: SpaceBeforeBlockParameters: true (default)

    # The SpaceBeforeBlockParameters style set to `true` enforces that
    # there is a space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each {|n| n * 2 }
    
    # good
    [1, 2, 3].each { |n| n * 2 }

    Example: SpaceBeforeBlockParameters: true

    # The SpaceBeforeBlockParameters style set to `false` enforces that
    # there is no space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each { |n| n * 2 }
    
    # good
    [1, 2, 3].each {|n| n * 2 }

    Space inside { missing.
    Open

      validates :personalities, :presence => {:message => "Please select at least one personality"}
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    Checks that braces used for hash literals have or don't have surrounding space depending on configuration.

    Example: EnforcedStyle: space

    # The `space` style enforces that hash literals have
    # surrounding space.
    
    # bad
    h = {a: 1, b: 2}
    
    # good
    h = { a: 1, b: 2 }

    Example: EnforcedStyle: no_space

    # The `no_space` style enforces that hash literals have
    # no surrounding space.
    
    # bad
    h = { a: 1, b: 2 }
    
    # good
    h = {a: 1, b: 2}

    Example: EnforcedStyle: compact

    # The `compact` style normally requires a space inside
    # hash braces, with the exception that successive left
    # braces or right braces are collapsed together in nested hashes.
    
    # bad
    h = { a: { b: 2 } }
    
    # good
    h = { a: { b: 2 }}

    Trailing whitespace detected.
    Open

      
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    Line is too long. [86/80]
    Open

      scope :has_personalities, lambda {|personalities| filter_personality(personalities)}
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    Line is too long. [98/80]
    Open

        joins(:energy_level).where("energy_levels.value" => energy_levels) unless energy_levels.empty?
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    Use && instead of and.
    Open

        errors.add(:availability, "- Please select a proper availability.") if (!availability.nil? and availability != "Available" and availability != "Unavailable")
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for uses of and and or, and suggests using && and || instead. It can be configured to check only in conditions, or in all contexts.

    Example: EnforcedStyle: always (default)

    # bad
    foo.save and return
    
    # bad
    if foo and bar
    end
    
    # good
    foo.save && return
    
    # good
    if foo && bar
    end

    Example: EnforcedStyle: conditionals

    # bad
    if foo and bar
    end
    
    # good
    foo.save && return
    
    # good
    foo.save and return
    
    # good
    if foo && bar
    end

    Use the new Ruby 1.9 hash syntax.
    Open

      validates :mixes, :presence => {:message => "Please select the mix"}
    Severity: Minor
    Found in app/models/dog.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

      validates :personalities, :presence => {:message => "Please select at least one personality"}
    Severity: Minor
    Found in app/models/dog.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

      has_many :pictures, :dependent => :destroy
    Severity: Minor
    Found in app/models/dog.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

          :gender => self.gender,
    Severity: Minor
    Found in app/models/dog.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

          :available => self.available,
    Severity: Minor
    Found in app/models/dog.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 -> { ... } lambda literal syntax for single line lambdas.
    Open

      scope :has_mix, lambda {|mix| filter_mix(mix)}
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop (by default) checks for uses of the lambda literal syntax for single line lambdas, and the method call syntax for multiline lambdas. It is configurable to enforce one of the styles for both single line and multiline lambdas as well.

    Example: EnforcedStyle: linecountdependent (default)

    # bad
    f = lambda { |x| x }
    f = ->(x) do
          x
        end
    
    # good
    f = ->(x) { x }
    f = lambda do |x|
          x
        end

    Example: EnforcedStyle: lambda

    # bad
    f = ->(x) { x }
    f = ->(x) do
          x
        end
    
    # good
    f = lambda { |x| x }
    f = lambda do |x|
          x
        end

    Example: EnforcedStyle: literal

    # bad
    f = lambda { |x| x }
    f = lambda do |x|
          x
        end
    
    # good
    f = ->(x) { x }
    f = ->(x) do
          x
        end

    Redundant return detected.
    Open

        return {
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for redundant return expressions.

    Example:

    def test
      return something
    end
    
    def test
      one
      two
      three
      return something
    end

    It should be extended to handle methods whose body is if/else or a case expression with a default branch.

    Redundant self detected.
    Open

        self.barks.map {|b| b.value.capitalize}
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for redundant uses of self.

    The usage of self is only needed when:

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

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

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

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

    Example:

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

    Redundant self detected.
    Open

        user = self.owner
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for redundant uses of self.

    The usage of self is only needed when:

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

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

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

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

    Example:

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

    Redundant self detected.
    Open

          :energy_level => self.energy_level ? self.energy_level.id : 0,
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for redundant uses of self.

    The usage of self is only needed when:

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

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

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

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

    Example:

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

    Redundant self detected.
    Open

          :status => self.motto,
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for redundant uses of self.

    The usage of self is only needed when:

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

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

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

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

    Example:

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

    Redundant self detected.
    Open

          :barks => self.readable_barks,
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for redundant uses of self.

    The usage of self is only needed when:

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

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

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

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

    Example:

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

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

      validates :name, :presence => {:message => "Please enter a name"}
    Severity: Minor
    Found in app/models/dog.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

        self.chipped ? "Yes" : "No"
    Severity: Minor
    Found in app/models/dog.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

        ["0-2 years", "2-4 years", "5-8 years", "9+ years"]
    Severity: Minor
    Found in app/models/dog.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

        ["0-2 years", "2-4 years", "5-8 years", "9+ years"]
    Severity: Minor
    Found in app/models/dog.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

        second = (Time.now - ranges[i][0].years).strftime "%Y-%m-%d %H:%M:%S"
    Severity: Minor
    Found in app/models/dog.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 &:downcase as an argument to map instead of a block.
    Open

          :likes => self.readable_likes.map {|val| val.downcase},
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    Use symbols as procs when possible.

    Example:

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

    Extra empty line detected at class body end.
    Open

    
    end
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cops checks if empty lines around the bodies of classes match the configuration.

    Example: EnforcedStyle: empty_lines

    # good
    
    class Foo
    
      def bar
        # ...
      end
    
    end

    Example: EnforcedStyle: emptylinesexcept_namespace

    # good
    
    class Foo
      class Bar
    
        # ...
    
      end
    end

    Example: EnforcedStyle: emptylinesspecial

    # good
    class Foo
    
      def bar; end
    
    end

    Example: EnforcedStyle: noemptylines (default)

    # good
    
    class Foo
      def bar
        # ...
      end
    end

    Space missing inside }.
    Open

      scope :has_likes, lambda {|likes| filter_like(likes)}
    Severity: Minor
    Found in app/models/dog.rb by rubocop

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

    Example: EnforcedStyle: space (default)

    # The `space` style enforces that block braces have
    # surrounding space.
    
    # bad
    some_array.each {puts e}
    
    # good
    some_array.each { puts e }

    Example: EnforcedStyle: no_space

    # The `no_space` style enforces that block braces don't
    # have surrounding space.
    
    # bad
    some_array.each { puts e }
    
    # good
    some_array.each {puts e}

    Example: EnforcedStyleForEmptyBraces: no_space (default)

    # The `no_space` EnforcedStyleForEmptyBraces style enforces that
    # block braces don't have a space in between when empty.
    
    # bad
    some_array.each {   }
    some_array.each {  }
    some_array.each { }
    
    # good
    some_array.each {}

    Example: EnforcedStyleForEmptyBraces: space

    # The `space` EnforcedStyleForEmptyBraces style enforces that
    # block braces have at least a spece in between when empty.
    
    # bad
    some_array.each {}
    
    # good
    some_array.each { }
    some_array.each {  }
    some_array.each {   }

    Example: SpaceBeforeBlockParameters: true (default)

    # The SpaceBeforeBlockParameters style set to `true` enforces that
    # there is a space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each {|n| n * 2 }
    
    # good
    [1, 2, 3].each { |n| n * 2 }

    Example: SpaceBeforeBlockParameters: true

    # The SpaceBeforeBlockParameters style set to `false` enforces that
    # there is no space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each { |n| n * 2 }
    
    # good
    [1, 2, 3].each {|n| n * 2 }

    Space inside } missing.
    Open

      validates :size, :presence => {:message => "Please select a size"}
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    Checks that braces used for hash literals have or don't have surrounding space depending on configuration.

    Example: EnforcedStyle: space

    # The `space` style enforces that hash literals have
    # surrounding space.
    
    # bad
    h = {a: 1, b: 2}
    
    # good
    h = { a: 1, b: 2 }

    Example: EnforcedStyle: no_space

    # The `no_space` style enforces that hash literals have
    # no surrounding space.
    
    # bad
    h = { a: 1, b: 2 }
    
    # good
    h = {a: 1, b: 2}

    Example: EnforcedStyle: compact

    # The `compact` style normally requires a space inside
    # hash braces, with the exception that successive left
    # braces or right braces are collapsed together in nested hashes.
    
    # bad
    h = { a: { b: 2 } }
    
    # good
    h = { a: { b: 2 }}

    Trailing whitespace detected.
    Open

      
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    Trailing whitespace detected.
    Open

      
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    Use && instead of and.
    Open

        errors[:photo] << "should be less than 3MB" if photo and photo.size and photo.size > 3.megabytes
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for uses of and and or, and suggests using && and || instead. It can be configured to check only in conditions, or in all contexts.

    Example: EnforcedStyle: always (default)

    # bad
    foo.save and return
    
    # bad
    if foo and bar
    end
    
    # good
    foo.save && return
    
    # good
    if foo && bar
    end

    Example: EnforcedStyle: conditionals

    # bad
    if foo and bar
    end
    
    # good
    foo.save && return
    
    # good
    foo.save and return
    
    # good
    if foo && bar
    end

    Use the new Ruby 1.9 hash syntax.
    Open

      has_many :likes, :through => :dog_like_linkers
    Severity: Minor
    Found in app/models/dog.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

      validates_inclusion_of :chipped, in: [true, false], :message => "Please select a response for chipped"
    Severity: Minor
    Found in app/models/dog.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 -> { ... } lambda literal syntax for single line lambdas.
    Open

      scope :has_energy_level, lambda {|energy_levels| filter_energy_level(energy_levels)}
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop (by default) checks for uses of the lambda literal syntax for single line lambdas, and the method call syntax for multiline lambdas. It is configurable to enforce one of the styles for both single line and multiline lambdas as well.

    Example: EnforcedStyle: linecountdependent (default)

    # bad
    f = lambda { |x| x }
    f = ->(x) do
          x
        end
    
    # good
    f = ->(x) { x }
    f = lambda do |x|
          x
        end

    Example: EnforcedStyle: lambda

    # bad
    f = ->(x) { x }
    f = ->(x) do
          x
        end
    
    # good
    f = lambda { |x| x }
    f = lambda do |x|
          x
        end

    Example: EnforcedStyle: literal

    # bad
    f = lambda { |x| x }
    f = lambda do |x|
          x
        end
    
    # good
    f = ->(x) { x }
    f = ->(x) do
          x
        end

    Redundant self detected.
    Open

        self.likes.map {|l| l.value.capitalize}
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for redundant uses of self.

    The usage of self is only needed when:

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

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

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

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

    Example:

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

    Redundant self detected.
    Open

        self.fixed ? "Yes" : "No"
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for redundant uses of self.

    The usage of self is only needed when:

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

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

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

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

    Example:

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

    Redundant self detected.
    Open

        self.availability && self.availability != "Unavailable" ? true : false
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for redundant uses of self.

    The usage of self is only needed when:

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

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

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

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

    Example:

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

    Redundant self detected.
    Open

          :name => self.name,
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for redundant uses of self.

    The usage of self is only needed when:

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

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

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

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

    Example:

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

    Redundant self detected.
    Open

          :available => self.available,
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for redundant uses of self.

    The usage of self is only needed when:

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

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

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

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

    Example:

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

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

        joins(:mixes).where("mixes.value" => mix) unless mix == "All Mixes"
    Severity: Minor
    Found in app/models/dog.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 comma after the last item of a hash.
    Open

          :availability => self.availability,
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for trailing comma in array and hash literals.

    Example: EnforcedStyleForMultiline: consistent_comma

    # bad
    a = [1, 2,]
    
    # good
    a = [
      1, 2,
      3,
    ]
    
    # good
    a = [
      1,
      2,
    ]

    Example: EnforcedStyleForMultiline: comma

    # bad
    a = [1, 2,]
    
    # good
    a = [
      1,
      2,
    ]

    Example: EnforcedStyleForMultiline: no_comma (default)

    # bad
    a = [1, 2,]
    
    # good
    a = [
      1,
      2
    ]

    Space between { and | missing.
    Open

      scope :has_likes, lambda {|likes| filter_like(likes)}
    Severity: Minor
    Found in app/models/dog.rb by rubocop

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

    Example: EnforcedStyle: space (default)

    # The `space` style enforces that block braces have
    # surrounding space.
    
    # bad
    some_array.each {puts e}
    
    # good
    some_array.each { puts e }

    Example: EnforcedStyle: no_space

    # The `no_space` style enforces that block braces don't
    # have surrounding space.
    
    # bad
    some_array.each { puts e }
    
    # good
    some_array.each {puts e}

    Example: EnforcedStyleForEmptyBraces: no_space (default)

    # The `no_space` EnforcedStyleForEmptyBraces style enforces that
    # block braces don't have a space in between when empty.
    
    # bad
    some_array.each {   }
    some_array.each {  }
    some_array.each { }
    
    # good
    some_array.each {}

    Example: EnforcedStyleForEmptyBraces: space

    # The `space` EnforcedStyleForEmptyBraces style enforces that
    # block braces have at least a spece in between when empty.
    
    # bad
    some_array.each {}
    
    # good
    some_array.each { }
    some_array.each {  }
    some_array.each {   }

    Example: SpaceBeforeBlockParameters: true (default)

    # The SpaceBeforeBlockParameters style set to `true` enforces that
    # there is a space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each {|n| n * 2 }
    
    # good
    [1, 2, 3].each { |n| n * 2 }

    Example: SpaceBeforeBlockParameters: true

    # The SpaceBeforeBlockParameters style set to `false` enforces that
    # there is no space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each { |n| n * 2 }
    
    # good
    [1, 2, 3].each {|n| n * 2 }

    Space missing inside }.
    Open

          :likes => self.readable_likes.map {|val| val.downcase},
    Severity: Minor
    Found in app/models/dog.rb by rubocop

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

    Example: EnforcedStyle: space (default)

    # The `space` style enforces that block braces have
    # surrounding space.
    
    # bad
    some_array.each {puts e}
    
    # good
    some_array.each { puts e }

    Example: EnforcedStyle: no_space

    # The `no_space` style enforces that block braces don't
    # have surrounding space.
    
    # bad
    some_array.each { puts e }
    
    # good
    some_array.each {puts e}

    Example: EnforcedStyleForEmptyBraces: no_space (default)

    # The `no_space` EnforcedStyleForEmptyBraces style enforces that
    # block braces don't have a space in between when empty.
    
    # bad
    some_array.each {   }
    some_array.each {  }
    some_array.each { }
    
    # good
    some_array.each {}

    Example: EnforcedStyleForEmptyBraces: space

    # The `space` EnforcedStyleForEmptyBraces style enforces that
    # block braces have at least a spece in between when empty.
    
    # bad
    some_array.each {}
    
    # good
    some_array.each { }
    some_array.each {  }
    some_array.each {   }

    Example: SpaceBeforeBlockParameters: true (default)

    # The SpaceBeforeBlockParameters style set to `true` enforces that
    # there is a space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each {|n| n * 2 }
    
    # good
    [1, 2, 3].each { |n| n * 2 }

    Example: SpaceBeforeBlockParameters: true

    # The SpaceBeforeBlockParameters style set to `false` enforces that
    # there is no space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each { |n| n * 2 }
    
    # good
    [1, 2, 3].each {|n| n * 2 }

    Space inside } missing.
    Open

      validates :personalities, :presence => {:message => "Please select at least one personality"}
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    Checks that braces used for hash literals have or don't have surrounding space depending on configuration.

    Example: EnforcedStyle: space

    # The `space` style enforces that hash literals have
    # surrounding space.
    
    # bad
    h = {a: 1, b: 2}
    
    # good
    h = { a: 1, b: 2 }

    Example: EnforcedStyle: no_space

    # The `no_space` style enforces that hash literals have
    # no surrounding space.
    
    # bad
    h = { a: 1, b: 2 }
    
    # good
    h = {a: 1, b: 2}

    Example: EnforcedStyle: compact

    # The `compact` style normally requires a space inside
    # hash braces, with the exception that successive left
    # braces or right braces are collapsed together in nested hashes.
    
    # bad
    h = { a: { b: 2 } }
    
    # good
    h = { a: { b: 2 }}

    Useless assignment to variable - dogs.
    Open

        dogs = Dog.near(criteria[:zipcode], criteria[:radius])
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for every useless assignment to local variable in every scope. The basic idea for this cop was from the warning of ruby -cw:

    assigned but unused variable - foo

    Currently this cop has advanced logic that detects unreferenced reassignments and properly handles varied cases such as branch, loop, rescue, ensure, etc.

    Example:

    # bad
    
    def some_method
      some_var = 1
      do_something
    end

    Example:

    # good
    
    def some_method
      some_var = 1
      do_something(some_var)
    end

    Use the new Ruby 1.9 hash syntax.
    Open

      validates :gender, :presence => {:message => "Please select a gender"}
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks hash literal syntax.

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

    A separate offense is registered for each problematic pair.

    The supported styles are:

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

    Example: EnforcedStyle: ruby19 (default)

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

    Example: EnforcedStyle: hash_rockets

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

    Example: EnforcedStyle: nomixedkeys

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

    Example: EnforcedStyle: ruby19nomixed_keys

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

    Use the new Ruby 1.9 hash syntax.
    Open

                        :styles => { :small    => '150x',
    Severity: Minor
    Found in app/models/dog.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

                        :default_url => "",
    Severity: Minor
    Found in app/models/dog.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

      validates_attachment_content_type :photo, :content_type => ['image/jpeg', 'image/png']
    Severity: Minor
    Found in app/models/dog.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

          :energy_level => self.energy_level ? self.energy_level.id : 0,
    Severity: Minor
    Found in app/models/dog.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

          :availability => self.availability,
    Severity: Minor
    Found in app/models/dog.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

          :likes => self.readable_likes,
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks hash literal syntax.

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

    A separate offense is registered for each problematic pair.

    The supported styles are:

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

    Example: EnforcedStyle: ruby19 (default)

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

    Example: EnforcedStyle: hash_rockets

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

    Example: EnforcedStyle: nomixedkeys

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

    Example: EnforcedStyle: ruby19nomixed_keys

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

    Redundant return detected.
    Open

        return {
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for redundant return expressions.

    Example:

    def test
      return something
    end
    
    def test
      one
      two
      three
      return something
    end

    It should be extended to handle methods whose body is if/else or a case expression with a default branch.

    Redundant self detected.
    Open

          :name => self.name,
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for redundant uses of self.

    The usage of self is only needed when:

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

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

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

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

    Example:

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

    Redundant self detected.
    Open

          :personalities => self.readable_personalities,
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for redundant uses of self.

    The usage of self is only needed when:

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

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

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

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

    Example:

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

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

        errors.add(:availability, "- Please select a proper availability.") if (!availability.nil? and availability != "Available" and availability != "Unavailable")
    Severity: Minor
    Found in app/models/dog.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

        ["0-2 years", "2-4 years", "5-8 years", "9+ years"]
    Severity: Minor
    Found in app/models/dog.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 &:value as an argument to map instead of a block.
    Open

        self.mixes.map {|m| m.value}
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    Use symbols as procs when possible.

    Example:

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

    Space missing inside }.
    Open

      scope :has_size, lambda {|sizes| filter_size(sizes)}
    Severity: Minor
    Found in app/models/dog.rb by rubocop

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

    Example: EnforcedStyle: space (default)

    # The `space` style enforces that block braces have
    # surrounding space.
    
    # bad
    some_array.each {puts e}
    
    # good
    some_array.each { puts e }

    Example: EnforcedStyle: no_space

    # The `no_space` style enforces that block braces don't
    # have surrounding space.
    
    # bad
    some_array.each { puts e }
    
    # good
    some_array.each {puts e}

    Example: EnforcedStyleForEmptyBraces: no_space (default)

    # The `no_space` EnforcedStyleForEmptyBraces style enforces that
    # block braces don't have a space in between when empty.
    
    # bad
    some_array.each {   }
    some_array.each {  }
    some_array.each { }
    
    # good
    some_array.each {}

    Example: EnforcedStyleForEmptyBraces: space

    # The `space` EnforcedStyleForEmptyBraces style enforces that
    # block braces have at least a spece in between when empty.
    
    # bad
    some_array.each {}
    
    # good
    some_array.each { }
    some_array.each {  }
    some_array.each {   }

    Example: SpaceBeforeBlockParameters: true (default)

    # The SpaceBeforeBlockParameters style set to `true` enforces that
    # there is a space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each {|n| n * 2 }
    
    # good
    [1, 2, 3].each { |n| n * 2 }

    Example: SpaceBeforeBlockParameters: true

    # The SpaceBeforeBlockParameters style set to `false` enforces that
    # there is no space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each { |n| n * 2 }
    
    # good
    [1, 2, 3].each {|n| n * 2 }

    Space between { and | missing.
    Open

        self.likes.map {|l| l.value.capitalize}
    Severity: Minor
    Found in app/models/dog.rb by rubocop

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

    Example: EnforcedStyle: space (default)

    # The `space` style enforces that block braces have
    # surrounding space.
    
    # bad
    some_array.each {puts e}
    
    # good
    some_array.each { puts e }

    Example: EnforcedStyle: no_space

    # The `no_space` style enforces that block braces don't
    # have surrounding space.
    
    # bad
    some_array.each { puts e }
    
    # good
    some_array.each {puts e}

    Example: EnforcedStyleForEmptyBraces: no_space (default)

    # The `no_space` EnforcedStyleForEmptyBraces style enforces that
    # block braces don't have a space in between when empty.
    
    # bad
    some_array.each {   }
    some_array.each {  }
    some_array.each { }
    
    # good
    some_array.each {}

    Example: EnforcedStyleForEmptyBraces: space

    # The `space` EnforcedStyleForEmptyBraces style enforces that
    # block braces have at least a spece in between when empty.
    
    # bad
    some_array.each {}
    
    # good
    some_array.each { }
    some_array.each {  }
    some_array.each {   }

    Example: SpaceBeforeBlockParameters: true (default)

    # The SpaceBeforeBlockParameters style set to `true` enforces that
    # there is a space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each {|n| n * 2 }
    
    # good
    [1, 2, 3].each { |n| n * 2 }

    Example: SpaceBeforeBlockParameters: true

    # The SpaceBeforeBlockParameters style set to `false` enforces that
    # there is no space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each { |n| n * 2 }
    
    # good
    [1, 2, 3].each {|n| n * 2 }

    Space inside { missing.
    Open

      validates :name, :presence => {:message => "Please enter a name"}
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    Checks that braces used for hash literals have or don't have surrounding space depending on configuration.

    Example: EnforcedStyle: space

    # The `space` style enforces that hash literals have
    # surrounding space.
    
    # bad
    h = {a: 1, b: 2}
    
    # good
    h = { a: 1, b: 2 }

    Example: EnforcedStyle: no_space

    # The `no_space` style enforces that hash literals have
    # no surrounding space.
    
    # bad
    h = { a: 1, b: 2 }
    
    # good
    h = {a: 1, b: 2}

    Example: EnforcedStyle: compact

    # The `compact` style normally requires a space inside
    # hash braces, with the exception that successive left
    # braces or right braces are collapsed together in nested hashes.
    
    # bad
    h = { a: { b: 2 } }
    
    # good
    h = { a: { b: 2 }}

    Space inside { missing.
    Open

      validates :size, :presence => {:message => "Please select a size"}
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    Checks that braces used for hash literals have or don't have surrounding space depending on configuration.

    Example: EnforcedStyle: space

    # The `space` style enforces that hash literals have
    # surrounding space.
    
    # bad
    h = {a: 1, b: 2}
    
    # good
    h = { a: 1, b: 2 }

    Example: EnforcedStyle: no_space

    # The `no_space` style enforces that hash literals have
    # no surrounding space.
    
    # bad
    h = { a: 1, b: 2 }
    
    # good
    h = {a: 1, b: 2}

    Example: EnforcedStyle: compact

    # The `compact` style normally requires a space inside
    # hash braces, with the exception that successive left
    # braces or right braces are collapsed together in nested hashes.
    
    # bad
    h = { a: { b: 2 } }
    
    # good
    h = { a: { b: 2 }}

    Trailing whitespace detected.
    Open

      
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    Line is too long. [99/80]
    Open

        joins(:personalities).where("personalities.value" => personalities) unless personalities.empty?
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    Use % instead of %Q.
    Open

        base = %Q[("dogs"."dob" BETWEEN '#{first}' AND '#{second}')]
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks if usage of %() or %Q() matches configuration.

    Example: EnforcedStyle: bare_percent (default)

    # bad
    %Q(He said: "#{greeting}")
    %q{She said: 'Hi'}
    
    # good
    %(He said: "#{greeting}")
    %{She said: 'Hi'}

    Example: EnforcedStyle: percent_q

    # bad
    %|He said: "#{greeting}"|
    %/She said: 'Hi'/
    
    # good
    %Q|He said: "#{greeting}"|
    %q/She said: 'Hi'/

    Use the new Ruby 1.9 hash syntax.
    Open

      has_many :stars, :dependent => :destroy
    Severity: Minor
    Found in app/models/dog.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

      validates :name, :presence => {:message => "Please enter a name"}
    Severity: Minor
    Found in app/models/dog.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

          :likes => self.readable_likes.map {|val| val.downcase},
    Severity: Minor
    Found in app/models/dog.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 -> { ... } lambda literal syntax for single line lambdas.
    Open

      scope :has_size, lambda {|sizes| filter_size(sizes)}
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop (by default) checks for uses of the lambda literal syntax for single line lambdas, and the method call syntax for multiline lambdas. It is configurable to enforce one of the styles for both single line and multiline lambdas as well.

    Example: EnforcedStyle: linecountdependent (default)

    # bad
    f = lambda { |x| x }
    f = ->(x) do
          x
        end
    
    # good
    f = ->(x) { x }
    f = lambda do |x|
          x
        end

    Example: EnforcedStyle: lambda

    # bad
    f = ->(x) { x }
    f = ->(x) do
          x
        end
    
    # good
    f = lambda { |x| x }
    f = lambda do |x|
          x
        end

    Example: EnforcedStyle: literal

    # bad
    f = lambda { |x| x }
    f = lambda do |x|
          x
        end
    
    # good
    f = ->(x) { x }
    f = ->(x) do
          x
        end

    Use y.zero? instead of y == 0.
    Open

        out = "< 1 year old" if y == 0
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for usage of comparison operators (==, >, <) to test numbers as zero, positive, or negative. These can be replaced by their respective predicate methods. The cop can also be configured to do the reverse.

    The cop disregards #nonzero? as it its value is truthy or falsey, but not true and false, and thus not always interchangeable with != 0.

    The cop ignores comparisons to global variables, since they are often populated with objects which can be compared with integers, but are not themselves Interger polymorphic.

    Example: EnforcedStyle: predicate (default)

    # bad
    
    foo == 0
    0 > foo
    bar.baz > 0
    
    # good
    
    foo.zero?
    foo.negative?
    bar.baz.positive?

    Example: EnforcedStyle: comparison

    # bad
    
    foo.zero?
    foo.negative?
    bar.baz.positive?
    
    # good
    
    foo == 0
    0 > foo
    bar.baz > 0

    Redundant self detected.
    Open

          :size => self.size.id,
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for redundant uses of self.

    The usage of self is only needed when:

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

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

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

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

    Example:

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

    Redundant self detected.
    Open

          :gender => self.gender,
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for redundant uses of self.

    The usage of self is only needed when:

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

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

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

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

    Example:

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

    Redundant self detected.
    Open

          :personalities => self.readable_personalities.map {|val| val.downcase},
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for redundant uses of self.

    The usage of self is only needed when:

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

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

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

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

    Example:

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

    Redundant self detected.
    Open

          :gender => self.gender,
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for redundant uses of self.

    The usage of self is only needed when:

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

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

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

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

    Example:

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

    Redundant self detected.
    Open

          :status => self.motto,
    Severity: Minor
    Found in app/models/dog.rb by rubocop

    This cop checks for redundant uses of self.

    The usage of self is only needed when:

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

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

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

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

    Example:

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

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

        self.events.where("end_date > ?", 1.day.ago.midnight).order("start_date ASC")
    Severity: Minor
    Found in app/models/dog.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

          "Unknown"
    Severity: Minor
    Found in app/models/dog.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

              age_query += (base + " OR ")
    Severity: Minor
    Found in app/models/dog.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

        self.events.where("end_date > ?", 1.day.ago.midnight).pluck('end_date') != []
    Severity: Minor
    Found in app/models/dog.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

      validates :personalities, :presence => {:message => "Please select at least one personality"}
    Severity: Minor
    Found in app/models/dog.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

        joins(:mixes).where("mixes.value" => mix) unless mix == "All Mixes"
    Severity: Minor
    Found in app/models/dog.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

        joins(:size).where("sizes.value" => sizes) unless sizes.empty?
    Severity: Minor
    Found in app/models/dog.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

        age_query = ""
    Severity: Minor
    Found in app/models/dog.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