jjeremydiaz/OpenHouse

View on GitHub
app/helpers/search_helper.rb

Summary

Maintainability
A
0 mins
Test Coverage

Assignment Branch Condition size for populateMap is too high. [28.18/15]
Open

    def populateMap()
        all_users = User.where(:searchable => true)
        all_users.near(@full_location).each do |user|
            @users.push(user)
            url = request.base_url + "/users/" + user.id.to_s
Severity: Minor
Found in app/helpers/search_helper.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. [12/10]
Open

    def populateMap()
        all_users = User.where(:searchable => true)
        all_users.near(@full_location).each do |user|
            @users.push(user)
            url = request.base_url + "/users/" + user.id.to_s
Severity: Minor
Found in app/helpers/search_helper.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.

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

    def googleSearch
        result = Geocoder.search(@full_location)[0]
        if result != nil
            @curr_loc_lat = result.geometry['location']['lat']
            @curr_loc_lng = result.geometry['location']['lng']
Severity: Minor
Found in app/helpers/search_helper.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.

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

            url = request.base_url + "/users/" + user.id.to_s
Severity: Minor
Found in app/helpers/search_helper.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"

Inconsistent indentation detected.
Open

            all_users.each do |user|
                url = request.base_url + "/users/" + user.id.to_s
                @nearby_locations.push([user.latitude, user.longitude, user.price, user.home_street_address, url])
            end
Severity: Minor
Found in app/helpers/search_helper.rb by rubocop

This cops checks for inconsistent indentation.

Example:

class A
  def test
    puts 'hello'
     puts 'world'
  end
end

Final newline missing.
Open

end
Severity: Minor
Found in app/helpers/search_helper.rb by rubocop

Line is too long. [114/80]
Open

                @nearby_locations.push([user.latitude, user.longitude, user.price, user.home_street_address, url])
Severity: Minor
Found in app/helpers/search_helper.rb by rubocop

Use the new Ruby 1.9 hash syntax.
Open

        all_users = User.where(:searchable => true)
Severity: Minor
Found in app/helpers/search_helper.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 2 (not 4) spaces for indentation.
Open

            @curr_loc_lat = result.geometry['location']['lat']
Severity: Minor
Found in app/helpers/search_helper.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

Use 2 (not 4) spaces for indentation.
Open

                url = request.base_url + "/users/" + user.id.to_s
Severity: Minor
Found in app/helpers/search_helper.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

Omit the parentheses in defs when the method doesn't accept any arguments.
Open

    def populateMap()
Severity: Minor
Found in app/helpers/search_helper.rb by rubocop

This cop checks for parentheses in the definition of a method, that does not take any arguments. Both instance and class/singleton methods are checked.

Example:

# bad
def foo()
  # does a thing
end

# good
def foo
  # does a thing
end

# also good
def foo() does_a_thing end

Example:

# bad
def Baz.foo()
  # does a thing
end

# good
def Baz.foo
  # does a thing
end

Missing top-level module documentation comment.
Open

module SearchHelper
Severity: Minor
Found in app/helpers/search_helper.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 2 (not 4) spaces for indentation.
Open

            @users.push(user)
Severity: Minor
Found in app/helpers/search_helper.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

Trailing whitespace detected.
Open

    
Severity: Minor
Found in app/helpers/search_helper.rb by rubocop

Use snake_case for method names.
Open

    def populateMap()
Severity: Minor
Found in app/helpers/search_helper.rb by rubocop

This cop makes sure that all methods use the configured style, snake_case or camelCase, for their names.

Example: EnforcedStyle: snake_case (default)

# bad
def fooBar; end

# good
def foo_bar; end

Example: EnforcedStyle: camelCase

# bad
def foo_bar; end

# good
def fooBar; end

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

                url = request.base_url + "/users/" + user.id.to_s
Severity: Minor
Found in app/helpers/search_helper.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 2 (not 4) spaces for indentation.
Open

        all_users = User.where(:searchable => true)
Severity: Minor
Found in app/helpers/search_helper.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

Trailing whitespace detected.
Open

            @curr_loc_lat = 37.8044 
Severity: Minor
Found in app/helpers/search_helper.rb by rubocop

Inconsistent indentation detected.
Open

            false
Severity: Minor
Found in app/helpers/search_helper.rb by rubocop

This cops checks for inconsistent indentation.

Example:

class A
  def test
    puts 'hello'
     puts 'world'
  end
end

Trailing whitespace detected.
Open

        
Severity: Minor
Found in app/helpers/search_helper.rb by rubocop

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

            @full_location = "Oakland, CA"
Severity: Minor
Found in app/helpers/search_helper.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 2 (not 4) spaces for indentation.
Open

    def googleSearch
Severity: Minor
Found in app/helpers/search_helper.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

Use 2 (not 4) spaces for indentation.
Open

            @full_location = "Oakland, CA"
Severity: Minor
Found in app/helpers/search_helper.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

Line is too long. [110/80]
Open

            @nearby_locations.push([user.latitude, user.longitude, user.price, user.home_street_address, url])
Severity: Minor
Found in app/helpers/search_helper.rb by rubocop

Use snake_case for method names.
Open

    def googleSearch
Severity: Minor
Found in app/helpers/search_helper.rb by rubocop

This cop makes sure that all methods use the configured style, snake_case or camelCase, for their names.

Example: EnforcedStyle: snake_case (default)

# bad
def fooBar; end

# good
def foo_bar; end

Example: EnforcedStyle: camelCase

# bad
def foo_bar; end

# good
def fooBar; end

Use 2 (not 4) spaces for indentation.
Open

        result = Geocoder.search(@full_location)[0]
Severity: Minor
Found in app/helpers/search_helper.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

Prefer !expression.nil? over expression != nil.
Open

        if result != nil
Severity: Minor
Found in app/helpers/search_helper.rb by rubocop

This cop checks for non-nil checks, which are usually redundant.

Example:

# bad
if x != nil
end

# good (when not allowing semantic changes)
# bad (when allowing semantic changes)
if !x.nil?
end

# good (when allowing semantic changes)
if x
end

Non-nil checks are allowed if they are the final nodes of predicate.

# good
def signed_in?
  !current_user.nil?
end

There are no issues that match your filters.

Category
Status