Showing 303 of 303 total issues
Do not use space inside reference brackets. Open
@illness = Illness.find( params[ :id ])
- Read upRead up
- Exclude checks
Checks that reference brackets have or don't have surrounding space depending on configuration.
Example: EnforcedStyle: no_space (default)
# The `no_space` style enforces that reference brackets have
# no surrounding space.
# bad
hash[ :key ]
array[ index ]
# good
hash[:key]
array[index]
Example: EnforcedStyle: space
# The `space` style enforces that reference brackets have
# surrounding space.
# bad
hash[:key]
array[index]
# good
hash[ :key ]
array[ index ]
Do not use space inside reference brackets. Open
@location = Location.find( params[ :id ])
- Read upRead up
- Exclude checks
Checks that reference brackets have or don't have surrounding space depending on configuration.
Example: EnforcedStyle: no_space (default)
# The `no_space` style enforces that reference brackets have
# no surrounding space.
# bad
hash[ :key ]
array[ index ]
# good
hash[:key]
array[index]
Example: EnforcedStyle: space
# The `space` style enforces that reference brackets have
# surrounding space.
# bad
hash[:key]
array[index]
# good
hash[ :key ]
array[ index ]
Do not use space inside reference brackets. Open
@illness = Illness.find( params[ :id ])
- Read upRead up
- Exclude checks
Checks that reference brackets have or don't have surrounding space depending on configuration.
Example: EnforcedStyle: no_space (default)
# The `no_space` style enforces that reference brackets have
# no surrounding space.
# bad
hash[ :key ]
array[ index ]
# good
hash[:key]
array[index]
Example: EnforcedStyle: space
# The `space` style enforces that reference brackets have
# surrounding space.
# bad
hash[:key]
array[index]
# good
hash[ :key ]
array[ index ]
Use a guard clause instead of wrapping the code inside a conditional expression. Open
if !record.last_payment_date.nil? && record.last_payment_date > Date.today
- Read upRead up
- Exclude checks
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
Space inside parentheses detected. Open
@location = Location.find( params[ :id ])
- Read upRead up
- Exclude checks
Checks for spaces inside ordinary round parentheses.
Example:
# bad
f( 3)
g = (a + 3 )
# good
f(3)
g = (a + 3)
include
is used at the top level. Use inside class
or module
. Open
include FileUtils
- Read upRead up
- Exclude checks
This cop checks that include
, extend
and prepend
exists at
the top level.
Using these at the top level affects the behavior of Object
.
There will not be using include
, extend
and prepend
at
the top level. Let's use it inside class
or module
.
Example:
# bad
include M
class C
end
# bad
extend M
class C
end
# bad
prepend M
class C
end
# good
class C
include M
end
# good
class C
extend M
end
# good
class C
prepend M
end
Line is too long. [83/80] Open
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
- Exclude checks
Do not use space inside reference brackets. Open
@location = Location.find( params[ :id ])
- Read upRead up
- Exclude checks
Checks that reference brackets have or don't have surrounding space depending on configuration.
Example: EnforcedStyle: no_space (default)
# The `no_space` style enforces that reference brackets have
# no surrounding space.
# bad
hash[ :key ]
array[ index ]
# good
hash[:key]
array[index]
Example: EnforcedStyle: space
# The `space` style enforces that reference brackets have
# surrounding space.
# bad
hash[:key]
array[index]
# good
hash[ :key ]
array[ index ]
Line is too long. [92/80] Open
params.require(:location).permit(:name, :description, :address, :longitude, :latitude)
- Exclude checks
Line is too long. [93/80] Open
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
- Exclude checks
Line is too long. [138/80] Open
sufferings_attributes: [:id, :illness_id, :cat_id, :diagnosis_date, :notes, :chronic, :status, :_destroy])
- Exclude checks
Prefer single-quoted strings when you don't need string interpolation or special symbols. Open
flash[:alert] = "You are not autorized to perform this action"
- Read upRead up
- Exclude checks
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
!@user.nil? && (@user.role == "volunteer" || @user.role == "admin")
- Read upRead up
- Exclude checks
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
belongs_to :assignment
- Read upRead up
- Exclude checks
This cops checks for inconsistent indentation.
Example:
class A
def test
puts 'hello'
puts 'world'
end
end
Tab detected. Open
validates_with TurnValidator
- Exclude checks
Do not use space inside reference brackets. Open
redirect_to (illness_path( params[ :id ] ))
- Read upRead up
- Exclude checks
Checks that reference brackets have or don't have surrounding space depending on configuration.
Example: EnforcedStyle: no_space (default)
# The `no_space` style enforces that reference brackets have
# no surrounding space.
# bad
hash[ :key ]
array[ index ]
# good
hash[:key]
array[index]
Example: EnforcedStyle: space
# The `space` style enforces that reference brackets have
# surrounding space.
# bad
hash[:key]
array[index]
# good
hash[ :key ]
array[ index ]
Space inside parentheses detected. Open
@location = Location.find( params[ :id ])
- Read upRead up
- Exclude checks
Checks for spaces inside ordinary round parentheses.
Example:
# bad
f( 3)
g = (a + 3 )
# good
f(3)
g = (a + 3)
Do not use space inside reference brackets. Open
@location = Location.find( params[ :id ])
- Read upRead up
- Exclude checks
Checks that reference brackets have or don't have surrounding space depending on configuration.
Example: EnforcedStyle: no_space (default)
# The `no_space` style enforces that reference brackets have
# no surrounding space.
# bad
hash[ :key ]
array[ index ]
# good
hash[:key]
array[index]
Example: EnforcedStyle: space
# The `space` style enforces that reference brackets have
# surrounding space.
# bad
hash[:key]
array[index]
# good
hash[ :key ]
array[ index ]
Prefer single-quoted strings when you don't need string interpolation or special symbols. Open
flash[:alert] = "You are not autorized to perform this action"
- Read upRead up
- Exclude checks
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
scope.where(:id => record.id).exists?
- Read upRead up
- Exclude checks
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}