lib/tasks/actions.rake
Prefer single-quoted strings when you don't need string interpolation or special symbols. Open
Open
longest_params = actions.map { |action| action.required_params.join(", ").length }.max
- 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 inside interpolations. Open
Open
params = "#{action.required_params.join(", ")}" if action.required_params.any?
- Read upRead up
- Exclude checks
This cop checks that quotes inside the string interpolation match the configured preference.
Example: EnforcedStyle: single_quotes (default)
# bad
result = "Tests #{success ? "PASS" : "FAIL"}"
# good
result = "Tests #{success ? 'PASS' : 'FAIL'}"
Example: EnforcedStyle: double_quotes
# bad
result = "Tests #{success ? 'PASS' : 'FAIL'}"
# good
result = "Tests #{success ? "PASS" : "FAIL"}"
Line is too long. [84/80] Open
Open
params = "#{action.required_params.join(", ")}" if action.required_params.any?
- Exclude checks
Prefer to_s
over string interpolation. Open
Open
params = "#{action.required_params.join(", ")}" if action.required_params.any?
- Read upRead up
- Exclude checks
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
Line is too long. [109/80] Open
Open
puts " \e[36m#{action.name.ljust(longest_name)}\e[0m \e[96m#{params.to_s.ljust(longest_params)}\e[0m"
- Exclude checks
Line is too long. [90/80] Open
Open
longest_params = actions.map { |action| action.required_params.join(", ").length }.max
- Exclude checks
Prefer single-quoted strings when you don't need string interpolation or special symbols. Open
Open
desc "Lists actions"
- 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"