Showing 55 of 55 total issues
Empty line detected around arguments. Open
package { 'www/apache22':
- Read upRead up
- Exclude checks
This cops checks if empty lines exist around the arguments of a method invocation.
Example:
# bad
do_something(
foo
)
process(bar,
baz: qux,
thud: fred)
some_method(
[1,2,3],
x: y
)
# good
do_something(
foo
)
process(bar,
baz: qux,
thud: fred)
some_method(
[1,2,3],
x: y
)
%w
-literals should be delimited by [
and ]
. Open
self::DEFAULT_REINSTALL_OPTIONS = %w(-r -f -M BATCH=yes).freeze
- Read upRead up
- Exclude checks
This cop enforces the consistent usage of %
-literal delimiters.
Specify the 'default' key to set all preferred delimiters at once. You can continue to specify individual preferred delimiters to override the default.
Example:
# Style/PercentLiteralDelimiters:
# PreferredDelimiters:
# default: '[]'
# '%i': '()'
# good
%w[alpha beta] + %i(gamma delta)
# bad
%W(alpha #{beta})
# bad
%I(alpha beta)
%w
-literals should be delimited by [
and ]
. Open
prepare_options(ops, self.class::DEFAULT_REINSTALL_OPTIONS, %w(-f), %w(-N))
- Read upRead up
- Exclude checks
This cop enforces the consistent usage of %
-literal delimiters.
Specify the 'default' key to set all preferred delimiters at once. You can continue to specify individual preferred delimiters to override the default.
Example:
# Style/PercentLiteralDelimiters:
# PreferredDelimiters:
# default: '[]'
# '%i': '()'
# good
%w[alpha beta] + %i(gamma delta)
# bad
%W(alpha #{beta})
# bad
%I(alpha beta)
Gem rake
requirements already given on line 22 of the Gemfile. Open
gem 'rake', '< 10.0'
- Read upRead up
- Exclude checks
A Gem's requirements should be listed only once in a Gemfile.
Example:
# bad
gem 'rubocop'
gem 'rubocop'
# bad
group :development do
gem 'rubocop'
end
group :test do
gem 'rubocop'
end
# good
group :development, :test do
gem 'rubocop'
end
# good
gem 'rubocop', groups: [:development, :test]
Gem puppet
requirements already given on line 66 of the Gemfile. Open
gem 'puppet', *location_for(ENV['PUPPET_GEM_VERSION'] || '~>3.8.0')
- Read upRead up
- Exclude checks
A Gem's requirements should be listed only once in a Gemfile.
Example:
# bad
gem 'rubocop'
gem 'rubocop'
# bad
group :development do
gem 'rubocop'
end
group :test do
gem 'rubocop'
end
# good
group :development, :test do
gem 'rubocop'
end
# good
gem 'rubocop', groups: [:development, :test]
Gems should be sorted in an alphabetical order within their section of the Gemfile. Gem beaker
should appear before beaker-rspec
. Open
gem 'beaker', *location_for(ENV['BEAKER_VERSION'] || '~> 1')
- Read upRead up
- Exclude checks
Gems should be alphabetically sorted within groups.
Example:
# bad
gem 'rubocop'
gem 'rspec'
# good
gem 'rspec'
gem 'rubocop'
# good
gem 'rubocop'
gem 'rspec'
# good only if TreatCommentsAsGroupSeparators is true
# For code quality
gem 'rubocop'
# For tests
gem 'rspec'
Gems should be sorted in an alphabetical order within their section of the Gemfile. Gem term-ansicolor
should appear before tins
. Open
gem 'term-ansicolor', '< 1.4.0'
- Read upRead up
- Exclude checks
Gems should be alphabetically sorted within groups.
Example:
# bad
gem 'rubocop'
gem 'rspec'
# good
gem 'rspec'
gem 'rubocop'
# good
gem 'rubocop'
gem 'rspec'
# good only if TreatCommentsAsGroupSeparators is true
# For code quality
gem 'rubocop'
# For tests
gem 'rspec'
Avoid multi-line ternary operators, use if
or unless
instead. Open
default_puppet = host['platform'] =~ /9\.[0-1]/ ? 'puppet' :
(host['platform'] =~ /10\.[0-4]/ ? 'puppet4' : 'puppet5')
- Read upRead up
- Exclude checks
This cop checks for multi-line ternary op expressions.
Example:
# bad
a = cond ?
b : c
a = cond ? b :
c
a = cond ?
b :
c
# good
a = cond ? b : c
a =
if cond
b
else
c
end
Empty line detected around arguments. Open
`uninstall_options` are passed to uninstall command. When the target system
- Read upRead up
- Exclude checks
This cops checks if empty lines exist around the arguments of a method invocation.
Example:
# bad
do_something(
foo
)
process(bar,
baz: qux,
thud: fred)
some_method(
[1,2,3],
x: y
)
# good
do_something(
foo
)
process(bar,
baz: qux,
thud: fred)
some_method(
[1,2,3],
x: y
)
%w
-literals should be delimited by [
and ]
. Open
%w(vash portsutil backports).each do |p|
- Read upRead up
- Exclude checks
This cop enforces the consistent usage of %
-literal delimiters.
Specify the 'default' key to set all preferred delimiters at once. You can continue to specify individual preferred delimiters to override the default.
Example:
# Style/PercentLiteralDelimiters:
# PreferredDelimiters:
# default: '[]'
# '%i': '()'
# good
%w[alpha beta] + %i(gamma delta)
# bad
%W(alpha #{beta})
# bad
%I(alpha beta)
Use %i
or %I
for an array of symbols. Open
self::PORT_ATTRIBUTES = [
:pkgname,
:portorigin,
:portname,
:portstatus,
- Read upRead up
- Exclude checks
This cop can check for array literals made up of symbols that are not using the %i() syntax.
Alternatively, it checks for symbol arrays using the %i() syntax on projects which do not want to use that syntax.
Configuration option: MinSize
If set, arrays with fewer elements than this value will not trigger the
cop. For example, a MinSize of
3` will not enforce a style on an array
of 2 or fewer elements.
Example: EnforcedStyle: percent (default)
# good
%i[foo bar baz]
# bad
[:foo, :bar, :baz]
Example: EnforcedStyle: brackets
# good
[:foo, :bar, :baz]
# bad
%i[foo bar baz]
%w
-literals should be delimited by [
and ]
. Open
self::DEFAULT_UNINSTALL_OPTIONS = %w(delete -y).freeze
- Read upRead up
- Exclude checks
This cop enforces the consistent usage of %
-literal delimiters.
Specify the 'default' key to set all preferred delimiters at once. You can continue to specify individual preferred delimiters to override the default.
Example:
# Style/PercentLiteralDelimiters:
# PreferredDelimiters:
# default: '[]'
# '%i': '()'
# good
%w[alpha beta] + %i(gamma delta)
# bad
%W(alpha #{beta})
# bad
%I(alpha beta)
Gem puppet
requirements already given on line 66 of the Gemfile. Open
gem 'puppet', *location_for(ENV['PUPPET_GEM_VERSION'] || '~>4.4.0')
- Read upRead up
- Exclude checks
A Gem's requirements should be listed only once in a Gemfile.
Example:
# bad
gem 'rubocop'
gem 'rubocop'
# bad
group :development do
gem 'rubocop'
end
group :test do
gem 'rubocop'
end
# good
group :development, :test do
gem 'rubocop'
end
# good
gem 'rubocop', groups: [:development, :test]
Line is too long. [113/80] Open
if ENV['PUPPET_GEM_VERSION'] and ENV['PUPPET_GEM_VERSION'] =~ /^\s*(~>\s*3\.[01])|(<\s*3\.2(\.0)?)|(<=\s*3\.1)/
- Exclude checks
Favor modifier if
usage when having a single-line body. Another good alternative is the usage of control flow &&
/||
. Open
if ver(RUBY_VERSION) < ver('2.1')
- Read upRead up
- Exclude checks
Checks for if and unless statements that would fit on one line
if written as a modifier if/unless. The maximum line length is
configured in the Metrics/LineLength
cop.
Example:
# bad
if condition
do_stuff(bar)
end
unless qux.empty?
Foo.do_something
end
# good
do_stuff(bar) if condition
Foo.do_something unless qux.empty?