Showing 1,558 of 1,564 total issues
Line is too long. [128/100] Open
def build(project_props = { dhis2_url: "http://play.dhis2.org/demo", user: "admin", password: "district", bypass_ssl: false })
- Exclude checks
Missing magic comment # frozen_string_literal: true
. Open
class CreateDhis2ElementForFormulaMappingWorker < CreateDhis2ElementWorker
- Read upRead up
- Exclude checks
This cop is designed to help upgrade to after Ruby 3.0. It will add the
comment # frozen_string_literal: true
to the top of files to
enable frozen string literals. Frozen string literals may be default
after Ruby 3.0. The comment will be added below a shebang and encoding
comment. The frozen string literal comment is only valid in Ruby 2.3+.
Example: EnforcedStyle: always (default)
# The `always` style will always add the frozen string literal comment
# to a file, regardless of the Ruby version or if `freeze` or `<<` are
# called on a string literal.
# bad
module Bar
# ...
end
# good
# frozen_string_literal: true
module Bar
# ...
end
Example: EnforcedStyle: never
# The `never` will enforce that the frozen string literal comment does
# not exist in a file.
# bad
# frozen_string_literal: true
module Baz
# ...
end
# good
module Baz
# ...
end
Align the elements of a hash literal if they span more than one line. Open
kind: kind,
- Read upRead up
- Exclude checks
Check that the keys, separators, and values of a multi-line hash literal are aligned according to configuration. The configuration options are:
- key (left align keys, one space before hash rockets and values)
- separator (align hash rockets and colons, right align keys)
- table (left align keys, hash rockets, and values)
The treatment of hashes passed as the last argument to a method call can also be configured. The options are:
- always_inspect
- always_ignore
- ignore_implicit (without curly braces)
Alternatively you can specify multiple allowed styles. That's done by passing a list of styles to EnforcedStyles.
Example: EnforcedHashRocketStyle: key (default)
# bad
{
:foo => bar,
:ba => baz
}
{
:foo => bar,
:ba => baz
}
# good
{
:foo => bar,
:ba => baz
}
Example: EnforcedHashRocketStyle: separator
# bad
{
:foo => bar,
:ba => baz
}
{
:foo => bar,
:ba => baz
}
# good
{
:foo => bar,
:ba => baz
}
Example: EnforcedHashRocketStyle: table
# bad
{
:foo => bar,
:ba => baz
}
# good
{
:foo => bar,
:ba => baz
}
Example: EnforcedColonStyle: key (default)
# bad
{
foo: bar,
ba: baz
}
{
foo: bar,
ba: baz
}
# good
{
foo: bar,
ba: baz
}
Example: EnforcedColonStyle: separator
# bad
{
foo: bar,
ba: baz
}
# good
{
foo: bar,
ba: baz
}
Example: EnforcedColonStyle: table
# bad
{
foo: bar,
ba: baz
}
# good
{
foo: bar,
ba: baz
}
Example: EnforcedLastArgumentHashStyle: always_inspect (default)
# Inspect both implicit and explicit hashes.
# bad
do_something(foo: 1,
bar: 2)
# bad
do_something({foo: 1,
bar: 2})
# good
do_something(foo: 1,
bar: 2)
# good
do_something(
foo: 1,
bar: 2
)
# good
do_something({foo: 1,
bar: 2})
# good
do_something({
foo: 1,
bar: 2
})
Example: EnforcedLastArgumentHashStyle: always_ignore
# Ignore both implicit and explicit hashes.
# good
do_something(foo: 1,
bar: 2)
# good
do_something({foo: 1,
bar: 2})
Example: EnforcedLastArgumentHashStyle: ignore_implicit
# Ignore only implicit hashes.
# bad
do_something({foo: 1,
bar: 2})
# good
do_something(foo: 1,
bar: 2)
Example: EnforcedLastArgumentHashStyle: ignore_explicit
# Ignore only explicit hashes.
# bad
do_something(foo: 1,
bar: 2)
# good
do_something({foo: 1,
bar: 2})
Align the elements of a hash literal if they span more than one line. Open
payment_rule: payment_rule,
- Read upRead up
- Exclude checks
Check that the keys, separators, and values of a multi-line hash literal are aligned according to configuration. The configuration options are:
- key (left align keys, one space before hash rockets and values)
- separator (align hash rockets and colons, right align keys)
- table (left align keys, hash rockets, and values)
The treatment of hashes passed as the last argument to a method call can also be configured. The options are:
- always_inspect
- always_ignore
- ignore_implicit (without curly braces)
Alternatively you can specify multiple allowed styles. That's done by passing a list of styles to EnforcedStyles.
Example: EnforcedHashRocketStyle: key (default)
# bad
{
:foo => bar,
:ba => baz
}
{
:foo => bar,
:ba => baz
}
# good
{
:foo => bar,
:ba => baz
}
Example: EnforcedHashRocketStyle: separator
# bad
{
:foo => bar,
:ba => baz
}
{
:foo => bar,
:ba => baz
}
# good
{
:foo => bar,
:ba => baz
}
Example: EnforcedHashRocketStyle: table
# bad
{
:foo => bar,
:ba => baz
}
# good
{
:foo => bar,
:ba => baz
}
Example: EnforcedColonStyle: key (default)
# bad
{
foo: bar,
ba: baz
}
{
foo: bar,
ba: baz
}
# good
{
foo: bar,
ba: baz
}
Example: EnforcedColonStyle: separator
# bad
{
foo: bar,
ba: baz
}
# good
{
foo: bar,
ba: baz
}
Example: EnforcedColonStyle: table
# bad
{
foo: bar,
ba: baz
}
# good
{
foo: bar,
ba: baz
}
Example: EnforcedLastArgumentHashStyle: always_inspect (default)
# Inspect both implicit and explicit hashes.
# bad
do_something(foo: 1,
bar: 2)
# bad
do_something({foo: 1,
bar: 2})
# good
do_something(foo: 1,
bar: 2)
# good
do_something(
foo: 1,
bar: 2
)
# good
do_something({foo: 1,
bar: 2})
# good
do_something({
foo: 1,
bar: 2
})
Example: EnforcedLastArgumentHashStyle: always_ignore
# Ignore both implicit and explicit hashes.
# good
do_something(foo: 1,
bar: 2)
# good
do_something({foo: 1,
bar: 2})
Example: EnforcedLastArgumentHashStyle: ignore_implicit
# Ignore only implicit hashes.
# bad
do_something({foo: 1,
bar: 2})
# good
do_something(foo: 1,
bar: 2)
Example: EnforcedLastArgumentHashStyle: ignore_explicit
# Ignore only explicit hashes.
# bad
do_something(foo: 1,
bar: 2)
# good
do_something({foo: 1,
bar: 2})
Align the elements of a hash literal if they span more than one line. Open
name: "Payment rule pma",
- Read upRead up
- Exclude checks
Check that the keys, separators, and values of a multi-line hash literal are aligned according to configuration. The configuration options are:
- key (left align keys, one space before hash rockets and values)
- separator (align hash rockets and colons, right align keys)
- table (left align keys, hash rockets, and values)
The treatment of hashes passed as the last argument to a method call can also be configured. The options are:
- always_inspect
- always_ignore
- ignore_implicit (without curly braces)
Alternatively you can specify multiple allowed styles. That's done by passing a list of styles to EnforcedStyles.
Example: EnforcedHashRocketStyle: key (default)
# bad
{
:foo => bar,
:ba => baz
}
{
:foo => bar,
:ba => baz
}
# good
{
:foo => bar,
:ba => baz
}
Example: EnforcedHashRocketStyle: separator
# bad
{
:foo => bar,
:ba => baz
}
{
:foo => bar,
:ba => baz
}
# good
{
:foo => bar,
:ba => baz
}
Example: EnforcedHashRocketStyle: table
# bad
{
:foo => bar,
:ba => baz
}
# good
{
:foo => bar,
:ba => baz
}
Example: EnforcedColonStyle: key (default)
# bad
{
foo: bar,
ba: baz
}
{
foo: bar,
ba: baz
}
# good
{
foo: bar,
ba: baz
}
Example: EnforcedColonStyle: separator
# bad
{
foo: bar,
ba: baz
}
# good
{
foo: bar,
ba: baz
}
Example: EnforcedColonStyle: table
# bad
{
foo: bar,
ba: baz
}
# good
{
foo: bar,
ba: baz
}
Example: EnforcedLastArgumentHashStyle: always_inspect (default)
# Inspect both implicit and explicit hashes.
# bad
do_something(foo: 1,
bar: 2)
# bad
do_something({foo: 1,
bar: 2})
# good
do_something(foo: 1,
bar: 2)
# good
do_something(
foo: 1,
bar: 2
)
# good
do_something({foo: 1,
bar: 2})
# good
do_something({
foo: 1,
bar: 2
})
Example: EnforcedLastArgumentHashStyle: always_ignore
# Ignore both implicit and explicit hashes.
# good
do_something(foo: 1,
bar: 2)
# good
do_something({foo: 1,
bar: 2})
Example: EnforcedLastArgumentHashStyle: ignore_implicit
# Ignore only implicit hashes.
# bad
do_something({foo: 1,
bar: 2})
# good
do_something(foo: 1,
bar: 2)
Example: EnforcedLastArgumentHashStyle: ignore_explicit
# Ignore only explicit hashes.
# bad
do_something(foo: 1,
bar: 2)
# good
do_something({foo: 1,
bar: 2})
Align the elements of a hash literal if they span more than one line. Open
expression: "quantity_total_pma * quality_bonus_percentage_value",
- Read upRead up
- Exclude checks
Check that the keys, separators, and values of a multi-line hash literal are aligned according to configuration. The configuration options are:
- key (left align keys, one space before hash rockets and values)
- separator (align hash rockets and colons, right align keys)
- table (left align keys, hash rockets, and values)
The treatment of hashes passed as the last argument to a method call can also be configured. The options are:
- always_inspect
- always_ignore
- ignore_implicit (without curly braces)
Alternatively you can specify multiple allowed styles. That's done by passing a list of styles to EnforcedStyles.
Example: EnforcedHashRocketStyle: key (default)
# bad
{
:foo => bar,
:ba => baz
}
{
:foo => bar,
:ba => baz
}
# good
{
:foo => bar,
:ba => baz
}
Example: EnforcedHashRocketStyle: separator
# bad
{
:foo => bar,
:ba => baz
}
{
:foo => bar,
:ba => baz
}
# good
{
:foo => bar,
:ba => baz
}
Example: EnforcedHashRocketStyle: table
# bad
{
:foo => bar,
:ba => baz
}
# good
{
:foo => bar,
:ba => baz
}
Example: EnforcedColonStyle: key (default)
# bad
{
foo: bar,
ba: baz
}
{
foo: bar,
ba: baz
}
# good
{
foo: bar,
ba: baz
}
Example: EnforcedColonStyle: separator
# bad
{
foo: bar,
ba: baz
}
# good
{
foo: bar,
ba: baz
}
Example: EnforcedColonStyle: table
# bad
{
foo: bar,
ba: baz
}
# good
{
foo: bar,
ba: baz
}
Example: EnforcedLastArgumentHashStyle: always_inspect (default)
# Inspect both implicit and explicit hashes.
# bad
do_something(foo: 1,
bar: 2)
# bad
do_something({foo: 1,
bar: 2})
# good
do_something(foo: 1,
bar: 2)
# good
do_something(
foo: 1,
bar: 2
)
# good
do_something({foo: 1,
bar: 2})
# good
do_something({
foo: 1,
bar: 2
})
Example: EnforcedLastArgumentHashStyle: always_ignore
# Ignore both implicit and explicit hashes.
# good
do_something(foo: 1,
bar: 2)
# good
do_something({foo: 1,
bar: 2})
Example: EnforcedLastArgumentHashStyle: ignore_implicit
# Ignore only implicit hashes.
# bad
do_something({foo: 1,
bar: 2})
# good
do_something(foo: 1,
bar: 2)
Example: EnforcedLastArgumentHashStyle: ignore_explicit
# Ignore only explicit hashes.
# bad
do_something(foo: 1,
bar: 2)
# good
do_something({foo: 1,
bar: 2})
Align the elements of a hash literal if they span more than one line. Open
activity: activity,
- Read upRead up
- Exclude checks
Check that the keys, separators, and values of a multi-line hash literal are aligned according to configuration. The configuration options are:
- key (left align keys, one space before hash rockets and values)
- separator (align hash rockets and colons, right align keys)
- table (left align keys, hash rockets, and values)
The treatment of hashes passed as the last argument to a method call can also be configured. The options are:
- always_inspect
- always_ignore
- ignore_implicit (without curly braces)
Alternatively you can specify multiple allowed styles. That's done by passing a list of styles to EnforcedStyles.
Example: EnforcedHashRocketStyle: key (default)
# bad
{
:foo => bar,
:ba => baz
}
{
:foo => bar,
:ba => baz
}
# good
{
:foo => bar,
:ba => baz
}
Example: EnforcedHashRocketStyle: separator
# bad
{
:foo => bar,
:ba => baz
}
{
:foo => bar,
:ba => baz
}
# good
{
:foo => bar,
:ba => baz
}
Example: EnforcedHashRocketStyle: table
# bad
{
:foo => bar,
:ba => baz
}
# good
{
:foo => bar,
:ba => baz
}
Example: EnforcedColonStyle: key (default)
# bad
{
foo: bar,
ba: baz
}
{
foo: bar,
ba: baz
}
# good
{
foo: bar,
ba: baz
}
Example: EnforcedColonStyle: separator
# bad
{
foo: bar,
ba: baz
}
# good
{
foo: bar,
ba: baz
}
Example: EnforcedColonStyle: table
# bad
{
foo: bar,
ba: baz
}
# good
{
foo: bar,
ba: baz
}
Example: EnforcedLastArgumentHashStyle: always_inspect (default)
# Inspect both implicit and explicit hashes.
# bad
do_something(foo: 1,
bar: 2)
# bad
do_something({foo: 1,
bar: 2})
# good
do_something(foo: 1,
bar: 2)
# good
do_something(
foo: 1,
bar: 2
)
# good
do_something({foo: 1,
bar: 2})
# good
do_something({
foo: 1,
bar: 2
})
Example: EnforcedLastArgumentHashStyle: always_ignore
# Ignore both implicit and explicit hashes.
# good
do_something(foo: 1,
bar: 2)
# good
do_something({foo: 1,
bar: 2})
Example: EnforcedLastArgumentHashStyle: ignore_implicit
# Ignore only implicit hashes.
# bad
do_something({foo: 1,
bar: 2})
# good
do_something(foo: 1,
bar: 2)
Example: EnforcedLastArgumentHashStyle: ignore_explicit
# Ignore only explicit hashes.
# bad
do_something(foo: 1,
bar: 2)
# good
do_something({foo: 1,
bar: 2})
Do not write to stdout. Use Rails's logger if you want to log. Open
puts "Snapshoting for #{project_anchor.projects.first.name} : #{now}"
- Read upRead up
- Exclude checks
This cop checks for the use of output calls like puts and print
Example:
# bad
puts 'A debug message'
pp 'A debug message'
print 'A debug message'
# good
Rails.logger.debug 'A debug message'
Do not write to stdout. Use Rails's logger if you want to log. Open
puts "DiscardInvoicingJobWorker invoicing_jobs : #{invoicing_jobs.size} vs scheduled and running workers #{alive_jids.size}"
- Read upRead up
- Exclude checks
This cop checks for the use of output calls like puts and print
Example:
# bad
puts 'A debug message'
pp 'A debug message'
print 'A debug message'
# good
Rails.logger.debug 'A debug message'
Align the elements of a hash literal if they span more than one line. Open
name: activity_state.name,
- Read upRead up
- Exclude checks
Check that the keys, separators, and values of a multi-line hash literal are aligned according to configuration. The configuration options are:
- key (left align keys, one space before hash rockets and values)
- separator (align hash rockets and colons, right align keys)
- table (left align keys, hash rockets, and values)
The treatment of hashes passed as the last argument to a method call can also be configured. The options are:
- always_inspect
- always_ignore
- ignore_implicit (without curly braces)
Alternatively you can specify multiple allowed styles. That's done by passing a list of styles to EnforcedStyles.
Example: EnforcedHashRocketStyle: key (default)
# bad
{
:foo => bar,
:ba => baz
}
{
:foo => bar,
:ba => baz
}
# good
{
:foo => bar,
:ba => baz
}
Example: EnforcedHashRocketStyle: separator
# bad
{
:foo => bar,
:ba => baz
}
{
:foo => bar,
:ba => baz
}
# good
{
:foo => bar,
:ba => baz
}
Example: EnforcedHashRocketStyle: table
# bad
{
:foo => bar,
:ba => baz
}
# good
{
:foo => bar,
:ba => baz
}
Example: EnforcedColonStyle: key (default)
# bad
{
foo: bar,
ba: baz
}
{
foo: bar,
ba: baz
}
# good
{
foo: bar,
ba: baz
}
Example: EnforcedColonStyle: separator
# bad
{
foo: bar,
ba: baz
}
# good
{
foo: bar,
ba: baz
}
Example: EnforcedColonStyle: table
# bad
{
foo: bar,
ba: baz
}
# good
{
foo: bar,
ba: baz
}
Example: EnforcedLastArgumentHashStyle: always_inspect (default)
# Inspect both implicit and explicit hashes.
# bad
do_something(foo: 1,
bar: 2)
# bad
do_something({foo: 1,
bar: 2})
# good
do_something(foo: 1,
bar: 2)
# good
do_something(
foo: 1,
bar: 2
)
# good
do_something({foo: 1,
bar: 2})
# good
do_something({
foo: 1,
bar: 2
})
Example: EnforcedLastArgumentHashStyle: always_ignore
# Ignore both implicit and explicit hashes.
# good
do_something(foo: 1,
bar: 2)
# good
do_something({foo: 1,
bar: 2})
Example: EnforcedLastArgumentHashStyle: ignore_implicit
# Ignore only implicit hashes.
# bad
do_something({foo: 1,
bar: 2})
# good
do_something(foo: 1,
bar: 2)
Example: EnforcedLastArgumentHashStyle: ignore_explicit
# Ignore only explicit hashes.
# bad
do_something(foo: 1,
bar: 2)
# good
do_something({foo: 1,
bar: 2})
Align the elements of a hash literal if they span more than one line. Open
origin: activity_state.origin,
- Read upRead up
- Exclude checks
Check that the keys, separators, and values of a multi-line hash literal are aligned according to configuration. The configuration options are:
- key (left align keys, one space before hash rockets and values)
- separator (align hash rockets and colons, right align keys)
- table (left align keys, hash rockets, and values)
The treatment of hashes passed as the last argument to a method call can also be configured. The options are:
- always_inspect
- always_ignore
- ignore_implicit (without curly braces)
Alternatively you can specify multiple allowed styles. That's done by passing a list of styles to EnforcedStyles.
Example: EnforcedHashRocketStyle: key (default)
# bad
{
:foo => bar,
:ba => baz
}
{
:foo => bar,
:ba => baz
}
# good
{
:foo => bar,
:ba => baz
}
Example: EnforcedHashRocketStyle: separator
# bad
{
:foo => bar,
:ba => baz
}
{
:foo => bar,
:ba => baz
}
# good
{
:foo => bar,
:ba => baz
}
Example: EnforcedHashRocketStyle: table
# bad
{
:foo => bar,
:ba => baz
}
# good
{
:foo => bar,
:ba => baz
}
Example: EnforcedColonStyle: key (default)
# bad
{
foo: bar,
ba: baz
}
{
foo: bar,
ba: baz
}
# good
{
foo: bar,
ba: baz
}
Example: EnforcedColonStyle: separator
# bad
{
foo: bar,
ba: baz
}
# good
{
foo: bar,
ba: baz
}
Example: EnforcedColonStyle: table
# bad
{
foo: bar,
ba: baz
}
# good
{
foo: bar,
ba: baz
}
Example: EnforcedLastArgumentHashStyle: always_inspect (default)
# Inspect both implicit and explicit hashes.
# bad
do_something(foo: 1,
bar: 2)
# bad
do_something({foo: 1,
bar: 2})
# good
do_something(foo: 1,
bar: 2)
# good
do_something(
foo: 1,
bar: 2
)
# good
do_something({foo: 1,
bar: 2})
# good
do_something({
foo: 1,
bar: 2
})
Example: EnforcedLastArgumentHashStyle: always_ignore
# Ignore both implicit and explicit hashes.
# good
do_something(foo: 1,
bar: 2)
# good
do_something({foo: 1,
bar: 2})
Example: EnforcedLastArgumentHashStyle: ignore_implicit
# Ignore only implicit hashes.
# bad
do_something({foo: 1,
bar: 2})
# good
do_something(foo: 1,
bar: 2)
Example: EnforcedLastArgumentHashStyle: ignore_explicit
# Ignore only explicit hashes.
# bad
do_something(foo: 1,
bar: 2)
# good
do_something({foo: 1,
bar: 2})
Align the elements of a hash literal if they span more than one line. Open
formulas: map_formulas(rule.formulas),
- Read upRead up
- Exclude checks
Check that the keys, separators, and values of a multi-line hash literal are aligned according to configuration. The configuration options are:
- key (left align keys, one space before hash rockets and values)
- separator (align hash rockets and colons, right align keys)
- table (left align keys, hash rockets, and values)
The treatment of hashes passed as the last argument to a method call can also be configured. The options are:
- always_inspect
- always_ignore
- ignore_implicit (without curly braces)
Alternatively you can specify multiple allowed styles. That's done by passing a list of styles to EnforcedStyles.
Example: EnforcedHashRocketStyle: key (default)
# bad
{
:foo => bar,
:ba => baz
}
{
:foo => bar,
:ba => baz
}
# good
{
:foo => bar,
:ba => baz
}
Example: EnforcedHashRocketStyle: separator
# bad
{
:foo => bar,
:ba => baz
}
{
:foo => bar,
:ba => baz
}
# good
{
:foo => bar,
:ba => baz
}
Example: EnforcedHashRocketStyle: table
# bad
{
:foo => bar,
:ba => baz
}
# good
{
:foo => bar,
:ba => baz
}
Example: EnforcedColonStyle: key (default)
# bad
{
foo: bar,
ba: baz
}
{
foo: bar,
ba: baz
}
# good
{
foo: bar,
ba: baz
}
Example: EnforcedColonStyle: separator
# bad
{
foo: bar,
ba: baz
}
# good
{
foo: bar,
ba: baz
}
Example: EnforcedColonStyle: table
# bad
{
foo: bar,
ba: baz
}
# good
{
foo: bar,
ba: baz
}
Example: EnforcedLastArgumentHashStyle: always_inspect (default)
# Inspect both implicit and explicit hashes.
# bad
do_something(foo: 1,
bar: 2)
# bad
do_something({foo: 1,
bar: 2})
# good
do_something(foo: 1,
bar: 2)
# good
do_something(
foo: 1,
bar: 2
)
# good
do_something({foo: 1,
bar: 2})
# good
do_something({
foo: 1,
bar: 2
})
Example: EnforcedLastArgumentHashStyle: always_ignore
# Ignore both implicit and explicit hashes.
# good
do_something(foo: 1,
bar: 2)
# good
do_something({foo: 1,
bar: 2})
Example: EnforcedLastArgumentHashStyle: ignore_implicit
# Ignore only implicit hashes.
# bad
do_something({foo: 1,
bar: 2})
# good
do_something(foo: 1,
bar: 2)
Example: EnforcedLastArgumentHashStyle: ignore_explicit
# Ignore only explicit hashes.
# bad
do_something(foo: 1,
bar: 2)
# good
do_something({foo: 1,
bar: 2})
Missing magic comment # frozen_string_literal: true
. Open
module Meta
- Read upRead up
- Exclude checks
This cop is designed to help upgrade to after Ruby 3.0. It will add the
comment # frozen_string_literal: true
to the top of files to
enable frozen string literals. Frozen string literals may be default
after Ruby 3.0. The comment will be added below a shebang and encoding
comment. The frozen string literal comment is only valid in Ruby 2.3+.
Example: EnforcedStyle: always (default)
# The `always` style will always add the frozen string literal comment
# to a file, regardless of the Ruby version or if `freeze` or `<<` are
# called on a string literal.
# bad
module Bar
# ...
end
# good
# frozen_string_literal: true
module Bar
# ...
end
Example: EnforcedStyle: never
# The `never` will enforce that the frozen string literal comment does
# not exist in a file.
# bad
# frozen_string_literal: true
module Baz
# ...
end
# good
module Baz
# ...
end
Align the elements of a hash literal if they span more than one line. Open
code: %i[dhis2_code orbf_code]
- Read upRead up
- Exclude checks
Check that the keys, separators, and values of a multi-line hash literal are aligned according to configuration. The configuration options are:
- key (left align keys, one space before hash rockets and values)
- separator (align hash rockets and colons, right align keys)
- table (left align keys, hash rockets, and values)
The treatment of hashes passed as the last argument to a method call can also be configured. The options are:
- always_inspect
- always_ignore
- ignore_implicit (without curly braces)
Alternatively you can specify multiple allowed styles. That's done by passing a list of styles to EnforcedStyles.
Example: EnforcedHashRocketStyle: key (default)
# bad
{
:foo => bar,
:ba => baz
}
{
:foo => bar,
:ba => baz
}
# good
{
:foo => bar,
:ba => baz
}
Example: EnforcedHashRocketStyle: separator
# bad
{
:foo => bar,
:ba => baz
}
{
:foo => bar,
:ba => baz
}
# good
{
:foo => bar,
:ba => baz
}
Example: EnforcedHashRocketStyle: table
# bad
{
:foo => bar,
:ba => baz
}
# good
{
:foo => bar,
:ba => baz
}
Example: EnforcedColonStyle: key (default)
# bad
{
foo: bar,
ba: baz
}
{
foo: bar,
ba: baz
}
# good
{
foo: bar,
ba: baz
}
Example: EnforcedColonStyle: separator
# bad
{
foo: bar,
ba: baz
}
# good
{
foo: bar,
ba: baz
}
Example: EnforcedColonStyle: table
# bad
{
foo: bar,
ba: baz
}
# good
{
foo: bar,
ba: baz
}
Example: EnforcedLastArgumentHashStyle: always_inspect (default)
# Inspect both implicit and explicit hashes.
# bad
do_something(foo: 1,
bar: 2)
# bad
do_something({foo: 1,
bar: 2})
# good
do_something(foo: 1,
bar: 2)
# good
do_something(
foo: 1,
bar: 2
)
# good
do_something({foo: 1,
bar: 2})
# good
do_something({
foo: 1,
bar: 2
})
Example: EnforcedLastArgumentHashStyle: always_ignore
# Ignore both implicit and explicit hashes.
# good
do_something(foo: 1,
bar: 2)
# good
do_something({foo: 1,
bar: 2})
Example: EnforcedLastArgumentHashStyle: ignore_implicit
# Ignore only implicit hashes.
# bad
do_something({foo: 1,
bar: 2})
# good
do_something(foo: 1,
bar: 2)
Example: EnforcedLastArgumentHashStyle: ignore_explicit
# Ignore only explicit hashes.
# bad
do_something(foo: 1,
bar: 2)
# good
do_something({foo: 1,
bar: 2})
Align the elements of a hash literal if they span more than one line. Open
kind: formula.rule.kind,
- Read upRead up
- Exclude checks
Check that the keys, separators, and values of a multi-line hash literal are aligned according to configuration. The configuration options are:
- key (left align keys, one space before hash rockets and values)
- separator (align hash rockets and colons, right align keys)
- table (left align keys, hash rockets, and values)
The treatment of hashes passed as the last argument to a method call can also be configured. The options are:
- always_inspect
- always_ignore
- ignore_implicit (without curly braces)
Alternatively you can specify multiple allowed styles. That's done by passing a list of styles to EnforcedStyles.
Example: EnforcedHashRocketStyle: key (default)
# bad
{
:foo => bar,
:ba => baz
}
{
:foo => bar,
:ba => baz
}
# good
{
:foo => bar,
:ba => baz
}
Example: EnforcedHashRocketStyle: separator
# bad
{
:foo => bar,
:ba => baz
}
{
:foo => bar,
:ba => baz
}
# good
{
:foo => bar,
:ba => baz
}
Example: EnforcedHashRocketStyle: table
# bad
{
:foo => bar,
:ba => baz
}
# good
{
:foo => bar,
:ba => baz
}
Example: EnforcedColonStyle: key (default)
# bad
{
foo: bar,
ba: baz
}
{
foo: bar,
ba: baz
}
# good
{
foo: bar,
ba: baz
}
Example: EnforcedColonStyle: separator
# bad
{
foo: bar,
ba: baz
}
# good
{
foo: bar,
ba: baz
}
Example: EnforcedColonStyle: table
# bad
{
foo: bar,
ba: baz
}
# good
{
foo: bar,
ba: baz
}
Example: EnforcedLastArgumentHashStyle: always_inspect (default)
# Inspect both implicit and explicit hashes.
# bad
do_something(foo: 1,
bar: 2)
# bad
do_something({foo: 1,
bar: 2})
# good
do_something(foo: 1,
bar: 2)
# good
do_something(
foo: 1,
bar: 2
)
# good
do_something({foo: 1,
bar: 2})
# good
do_something({
foo: 1,
bar: 2
})
Example: EnforcedLastArgumentHashStyle: always_ignore
# Ignore both implicit and explicit hashes.
# good
do_something(foo: 1,
bar: 2)
# good
do_something({foo: 1,
bar: 2})
Example: EnforcedLastArgumentHashStyle: ignore_implicit
# Ignore only implicit hashes.
# bad
do_something({foo: 1,
bar: 2})
# good
do_something(foo: 1,
bar: 2)
Example: EnforcedLastArgumentHashStyle: ignore_explicit
# Ignore only explicit hashes.
# bad
do_something(foo: 1,
bar: 2)
# good
do_something({foo: 1,
bar: 2})
Align the elements of a hash literal if they span more than one line. Open
code: :quality_bonus_value,
- Read upRead up
- Exclude checks
Check that the keys, separators, and values of a multi-line hash literal are aligned according to configuration. The configuration options are:
- key (left align keys, one space before hash rockets and values)
- separator (align hash rockets and colons, right align keys)
- table (left align keys, hash rockets, and values)
The treatment of hashes passed as the last argument to a method call can also be configured. The options are:
- always_inspect
- always_ignore
- ignore_implicit (without curly braces)
Alternatively you can specify multiple allowed styles. That's done by passing a list of styles to EnforcedStyles.
Example: EnforcedHashRocketStyle: key (default)
# bad
{
:foo => bar,
:ba => baz
}
{
:foo => bar,
:ba => baz
}
# good
{
:foo => bar,
:ba => baz
}
Example: EnforcedHashRocketStyle: separator
# bad
{
:foo => bar,
:ba => baz
}
{
:foo => bar,
:ba => baz
}
# good
{
:foo => bar,
:ba => baz
}
Example: EnforcedHashRocketStyle: table
# bad
{
:foo => bar,
:ba => baz
}
# good
{
:foo => bar,
:ba => baz
}
Example: EnforcedColonStyle: key (default)
# bad
{
foo: bar,
ba: baz
}
{
foo: bar,
ba: baz
}
# good
{
foo: bar,
ba: baz
}
Example: EnforcedColonStyle: separator
# bad
{
foo: bar,
ba: baz
}
# good
{
foo: bar,
ba: baz
}
Example: EnforcedColonStyle: table
# bad
{
foo: bar,
ba: baz
}
# good
{
foo: bar,
ba: baz
}
Example: EnforcedLastArgumentHashStyle: always_inspect (default)
# Inspect both implicit and explicit hashes.
# bad
do_something(foo: 1,
bar: 2)
# bad
do_something({foo: 1,
bar: 2})
# good
do_something(foo: 1,
bar: 2)
# good
do_something(
foo: 1,
bar: 2
)
# good
do_something({foo: 1,
bar: 2})
# good
do_something({
foo: 1,
bar: 2
})
Example: EnforcedLastArgumentHashStyle: always_ignore
# Ignore both implicit and explicit hashes.
# good
do_something(foo: 1,
bar: 2)
# good
do_something({foo: 1,
bar: 2})
Example: EnforcedLastArgumentHashStyle: ignore_implicit
# Ignore only implicit hashes.
# bad
do_something({foo: 1,
bar: 2})
# good
do_something(foo: 1,
bar: 2)
Example: EnforcedLastArgumentHashStyle: ignore_explicit
# Ignore only explicit hashes.
# bad
do_something(foo: 1,
bar: 2)
# good
do_something({foo: 1,
bar: 2})
Align the elements of a hash literal if they span more than one line. Open
name: "Clients sous traitement ARV suivi pendant les 6 premiers mois - decl",
- Read upRead up
- Exclude checks
Check that the keys, separators, and values of a multi-line hash literal are aligned according to configuration. The configuration options are:
- key (left align keys, one space before hash rockets and values)
- separator (align hash rockets and colons, right align keys)
- table (left align keys, hash rockets, and values)
The treatment of hashes passed as the last argument to a method call can also be configured. The options are:
- always_inspect
- always_ignore
- ignore_implicit (without curly braces)
Alternatively you can specify multiple allowed styles. That's done by passing a list of styles to EnforcedStyles.
Example: EnforcedHashRocketStyle: key (default)
# bad
{
:foo => bar,
:ba => baz
}
{
:foo => bar,
:ba => baz
}
# good
{
:foo => bar,
:ba => baz
}
Example: EnforcedHashRocketStyle: separator
# bad
{
:foo => bar,
:ba => baz
}
{
:foo => bar,
:ba => baz
}
# good
{
:foo => bar,
:ba => baz
}
Example: EnforcedHashRocketStyle: table
# bad
{
:foo => bar,
:ba => baz
}
# good
{
:foo => bar,
:ba => baz
}
Example: EnforcedColonStyle: key (default)
# bad
{
foo: bar,
ba: baz
}
{
foo: bar,
ba: baz
}
# good
{
foo: bar,
ba: baz
}
Example: EnforcedColonStyle: separator
# bad
{
foo: bar,
ba: baz
}
# good
{
foo: bar,
ba: baz
}
Example: EnforcedColonStyle: table
# bad
{
foo: bar,
ba: baz
}
# good
{
foo: bar,
ba: baz
}
Example: EnforcedLastArgumentHashStyle: always_inspect (default)
# Inspect both implicit and explicit hashes.
# bad
do_something(foo: 1,
bar: 2)
# bad
do_something({foo: 1,
bar: 2})
# good
do_something(foo: 1,
bar: 2)
# good
do_something(
foo: 1,
bar: 2
)
# good
do_something({foo: 1,
bar: 2})
# good
do_something({
foo: 1,
bar: 2
})
Example: EnforcedLastArgumentHashStyle: always_ignore
# Ignore both implicit and explicit hashes.
# good
do_something(foo: 1,
bar: 2)
# good
do_something({foo: 1,
bar: 2})
Example: EnforcedLastArgumentHashStyle: ignore_implicit
# Ignore only implicit hashes.
# bad
do_something({foo: 1,
bar: 2})
# good
do_something(foo: 1,
bar: 2)
Example: EnforcedLastArgumentHashStyle: ignore_explicit
# Ignore only explicit hashes.
# bad
do_something(foo: 1,
bar: 2)
# good
do_something({foo: 1,
bar: 2})
Line is too long. [127/100] Open
expression: "IF(quality_technical_score_value > 50, (0.35 * quality_technical_score_value) + (0.30 * 10.0), 0.0)",
- Exclude checks
Use e
instead of ignored
. Open
rescue StandardError => ignored
- Read upRead up
- Exclude checks
This cop makes sure that rescued exceptions variables are named as expected.
The PreferredName
config option takes a String
. It represents
the required name of the variable. Its default is e
.
Example: PreferredName: e (default)
# bad
begin
# do something
rescue MyException => exception
# do something
end
# good
begin
# do something
rescue MyException => e
# do something
end
# good
begin
# do something
rescue MyException => _e
# do something
end
Example: PreferredName: exception
# bad
begin
# do something
rescue MyException => e
# do something
end
# good
begin
# do something
rescue MyException => exception
# do something
end
# good
begin
# do something
rescue MyException => _exception
# do something
end
Do not use Time.new
without zone. Use one of Time.zone.now
, Time.current
, Time.new.in_time_zone
, Time.new.utc
, Time.new.getlocal
, Time.new.xmlschema
, Time.new.iso8601
, Time.new.jisx0301
, Time.new.rfc3339
, Time.new.httpdate
, Time.new.to_i
, Time.new.to_f
instead. Open
start = Time.new
- Read upRead up
- Exclude checks
This cop checks for the use of Time methods without zone.
Built on top of Ruby on Rails style guide (https://github.com/rubocop-hq/rails-style-guide#time) and the article http://danilenko.org/2012/7/6/rails_timezones/
Two styles are supported for this cop. When EnforcedStyle is 'strict' then only use of Time.zone is allowed.
When EnforcedStyle is 'flexible' then it's also allowed to use Time.intimezone.
Example: EnforcedStyle: strict
# `strict` means that `Time` should be used with `zone`.
# bad
Time.now
Time.parse('2015-03-02 19:05:37')
# bad
Time.current
Time.at(timestamp).in_time_zone
# good
Time.zone.now
Time.zone.parse('2015-03-02 19:05:37')
Example: EnforcedStyle: flexible (default)
# `flexible` allows usage of `in_time_zone` instead of `zone`.
# bad
Time.now
Time.parse('2015-03-02 19:05:37')
# good
Time.zone.now
Time.zone.parse('2015-03-02 19:05:37')
# good
Time.current
Time.at(timestamp).in_time_zone