angelakuo/citydogshare

View on GitHub

Showing 3,976 of 3,976 total issues

Redundant return detected.
Open

      return []
Severity: Minor
Found in app/controllers/dogs_controller.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.

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

      flash[:notice] = "Please update your zipcode to add a dog. "
Severity: Minor
Found in app/controllers/dogs_controller.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 &:address as an argument to collect instead of a block.
Open

    @dogs.all.collect{|dog| dog.address}
Severity: Minor
Found in app/controllers/dogs_controller.rb by rubocop

Use symbols as procs when possible.

Example:

# bad
something.map { |s| s.upcase }

# good
something.map(&:upcase)

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

      render :json => { "success" => false, "message" => "User not found"}
Severity: Minor
Found in app/controllers/users_controller.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 &:to_i as an argument to collect instead of a block.
Open

    seen_ids = params[:seen].collect {|id| id.to_i} if params[:seen]
Severity: Minor
Found in app/controllers/dogs_controller.rb by rubocop

Use symbols as procs when possible.

Example:

# bad
something.map { |s| s.upcase }

# good
something.map(&:upcase)

Use !empty? instead of length != 0.
Open

      :energy_level => dog_attributes['energy_level'] && dog_attributes['energy_level'].length != 0 ? EnergyLevel.find(dog_attributes['energy_level']) : nil, 
Severity: Minor
Found in app/controllers/dogs_controller.rb by rubocop

This cop checks for numeric comparisons that can be replaced by a predicate method, such as receiver.length == 0, receiver.length > 0, receiver.length != 0, receiver.length < 1 and receiver.size == 0 that can be replaced by receiver.empty? and !receiver.empty.

Example:

# bad
[1, 2, 3].length == 0
0 == "foobar".length
array.length < 1
{a: 1, b: 2}.length != 0
string.length > 0
hash.size > 0

# good
[1, 2, 3].empty?
"foobar".empty?
array.empty?
!{a: 1, b: 2}.empty?
!string.empty?
!hash.empty?

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

        "message" => "User found",
Severity: Minor
Found in app/controllers/users_controller.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"

Trailing whitespace detected.
Open

  
Severity: Minor
Found in app/controllers/users_controller.rb by rubocop

Space inside } missing.
Open

      render :json => { "success" => false, "message" => "User not found"}
Severity: Minor
Found in app/controllers/users_controller.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 }}

Indent the first line of the right-hand-side of a multi-line assignment.
Open

      { :start_date => params["event"]["start_date"],
        :end_date => params["event"]["end_date"].empty? ? params["event"]["start_date"] : params["event"]["end_date"],
        :filled => params["event"]["filled"] == "Filled" ? true : false,
        :location_id => params["event"]["location"],
        :description => params["event"]["description"]

This cop checks the indentation of the first line of the right-hand-side of a multi-line assignment.

Example:

# bad
value =
if foo
  'bar'
end

# good
value =
  if foo
    'bar'
  end

The indentation of the remaining lines can be corrected with other cops such as IndentationConsistency and EndAlignment.

Trailing whitespace detected.
Open

  
Severity: Minor
Found in app/controllers/users_controller.rb by rubocop

Missing space after #.
Open

    if params["fc_update"].nil? #normal update via form

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

Use a guard clause instead of wrapping the code inside a conditional expression.
Open

    if params[:user]
Severity: Minor
Found in app/controllers/users_controller.rb by rubocop

Use a guard clause instead of wrapping the code inside a conditional expression

Example:

# bad
def test
  if something
    work
  end
end

# good
def test
  return unless something
  work
end

# also good
def test
  work if something
end

# bad
if something
  raise 'exception'
else
  ok
end

# good
raise 'exception' if something
ok

Line is too long. [126/80]
Open

      flash[:notice] = "Please update your zipcode to add a dog. All information added here will be visible to other members."
Severity: Minor
Found in app/controllers/users_controller.rb by rubocop

Do not use parentheses for method calls with no arguments.
Open

    redirect_to root_path()
Severity: Minor
Found in app/controllers/users_controller.rb by rubocop

This cop checks for unwanted parentheses in parameterless method calls.

Example:

# bad
object.some_method()

# good
object.some_method

Use ! instead of not.
Open

      if @event.update_attributes(params_hash) and params["event"]["dogs"] and not params["event"]["dogs"].empty?

This cop checks for uses of the keyword not instead of !.

Example:

# bad - parentheses are required because of op precedence
x = (not something)

# good
x = !something

Use || instead of or.
Open

    if !(@is_admin or (@user != nil and @user == @current_user))
Severity: Minor
Found in app/controllers/users_controller.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

Final newline missing.
Open

end

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

        :description => params["event"]["description"]

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 && instead of and.
Open

    if !@current_user.nil? and @current_user.id != params[:id].to_i
Severity: Minor
Found in app/controllers/users_controller.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
Severity
Category
Status
Source
Language