Showing 331 of 343 total issues
Align the elements of a hash literal if they span more than one line. Open
Open
user: project.users.find_by_username(matches[2]),
- Exclude checks
Align the elements of a hash literal if they span more than one line. Open
Open
created_at: matches[3])
- Exclude checks
Line is too long. [113/100] Open
Open
if iteration_service.current_iteration_number == iteration_service.iteration_number_for_date(accepted_at)
- Exclude checks
Use the new Ruby 1.9 hash syntax. Open
Open
:type=>'text/javascript'
- 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'"
# good
{a: 2, b: 1}
{:c => 2, 'd' => 2} # acceptable since 'd' isn't a symbol
{d: 1, 'e' => 2} # technically not forbidden
# bad
{:a => 2}
{b: 1, :c => 2}
Example:
"EnforcedStyle => 'hash_rockets'"
# good
{:a => 1, :b => 2}
# bad
{a: 1, b: 2}
{c: 1, 'd' => 5}
Example:
"EnforcedStyle => 'no_mixed_keys'"
# good
{:a => 1, :b => 2}
{c: 1, d: 2}
# bad
{:a => 1, b: 2}
{c: 1, 'd' => 2}
Example:
"EnforcedStyle => 'ruby19_no_mixed_keys'"
# good
{a: 1, b: 2}
{:c => 3, 'd' => 4}
# bad
{:a => 1, :b => 2}
{c: 2, 'd' => 3} # should just use hash rockets
Freeze mutable objects assigned to constants. Open
Open
CLOUDINARY_JS_CONFIG_PARAMS = %i[
api_key
cloud_name
private_cdn
secure_distribution
- Read upRead up
- Exclude checks
This cop checks whether some constant value isn't a mutable literal (e.g. array or hash).
Example:
# bad
CONST = [1, 2, 3]
# good
CONST = [1, 2, 3].freeze
Align reduce
with @accepted_stories.
on line 146. Open
Open
reduce({}) do |group, iteration|
- Exclude checks
Align group_by
with @accepted_stories.
on line 146. Open
Open
group_by { |story| story.iteration_number }.
- Exclude checks
Prefer single-quoted strings when you don't need string interpolation or special symbols. Open
Open
relation = relation.where("accepted_at > ? or accepted_at is null", since) if since
- Exclude checks
Pass &:iteration_number
as an argument to group_by
instead of a block. Open
Open
owner.last.group_by { |story| story.iteration_number }.
- Read upRead up
- Exclude checks
Use symbols as procs when possible.
Example:
# bad
something.map { |s| s.upcase }
# good
something.map(&:upcase)
Assignment in condition - you probably meant to use ==
. Open
Open
next unless matches = /(.*)\((.*) - (.*)\)$/.match(value)
- Read upRead up
- Exclude checks
This cop checks for assignments in the conditions of if/while/until.
Example:
# bad
if some_var = true
do_something
end
Example:
# good
if some_var == true
do_something
end
Prefer single-quoted strings when you don't need string interpolation or special symbols. Open
Open
"Story Type", "Estimate", "Current State", "Started At", "Created at", "Accepted at",
- Exclude checks
Use find_by
instead of dynamic find_by_username
. Open
Open
user: project.users.find_by_username(matches[2]),
- Read upRead up
- Exclude checks
This cop checks dynamic find_by_*
methods.
Use find_by
instead of dynamic method.
See. https://github.com/bbatsov/rails-style-guide#find_by
Example:
# bad
User.find_by_name(name)
# bad
User.find_by_name_and_email(name)
# bad
User.find_by_email!(name)
# good
User.find_by(name: name)
# good
User.find_by(name: name, email: email)
# good
User.find_by!(email: email)
Line is too long. [105/100] Open
Open
requested_by_attrs = user.requested?(story) ? { requested_by_id: nil, requested_by_name: nil } : {}
- Exclude checks
Place the . on the next line, together with the method name. Open
Open
select { |story| story.column == '#done' }.
- Exclude checks
Place the . on the next line, together with the method name. Open
Open
@group_by_iteration ||= @accepted_stories.
- Exclude checks
Place the . on the next line, together with the method name. Open
Open
@group_by_bugs ||= @accepted_stories.
- Exclude checks
Space inside parentheses detected. Open
Open
reduce(0) { |points, story| points + (story.estimate || 0) } )
- Exclude checks
Space inside parentheses detected. Open
Open
extra_iterations = ( std_dev * iterations.size / mean_of_last_ten_iterations ).round
- Exclude checks
Prefer single-quoted strings when you don't need string interpolation or special symbols. Open
Open
@dummy_user ||= User.find_or_create_by!(username: "dummy", email: "dummy@foo.com", name: "Dummy", initials: "XX")
- Exclude checks
Pass &:accepted_at
as an argument to select
instead of a block. Open
Open
accepted += backlog_iterations.first.select { |story| story.accepted_at }
- Read upRead up
- Exclude checks
Use symbols as procs when possible.
Example:
# bad
something.map { |s| s.upcase }
# good
something.map(&:upcase)