Gem puppetlabs_spec_helper
requirements already given on line 23 of the Gemfile. Open
gem 'puppetlabs_spec_helper', '< 2.0.0', :require => false
- 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 puppetlabs_spec_helper
should appear before rake
. Open
gem 'puppetlabs_spec_helper', :require => false
- 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 beaker
should appear before beaker-rspec
. Open
gem 'beaker', *location_for(ENV['BEAKER_VERSION'] || '>= 3.2.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'
Use &&
instead of and
. Open
if ENV['PUPPET_GEM_VERSION'] and ENV['PUPPET_GEM_VERSION'] =~ /^\s*(~>\s*3\.[01])|(<\s*3\.2(\.0)?)|(<=\s*3\.1)/
- Read upRead up
- Exclude checks
This cop checks for uses of and
and or
, and suggests using &&
and
|| instead
. It can be configured to check only in conditions, or in
all contexts.
Example: EnforcedStyle: always (default)
# bad
foo.save and return
# bad
if foo and bar
end
# good
foo.save && return
# good
if foo && bar
end
Example: EnforcedStyle: conditionals
# bad
if foo and bar
end
# good
foo.save && return
# good
foo.save and return
# good
if foo && bar
end
Gem beaker-rspec
requirements already given on line 54 of the Gemfile. Open
gem 'beaker-rspec', *location_for(ENV['BEAKER_RSPEC_VERSION'] || '>= 3.4')
- 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 beaker
requirements already given on line 55 of the Gemfile. Open
gem 'beaker', *location_for(ENV['BEAKER_VERSION'] || '~> 2')
- 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 puppetlabs_spec_helper
should appear before rake
. Open
gem 'puppetlabs_spec_helper', '< 2.0.0', :require => false
- 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'
Line is too long. [94/80] Open
gem 'rspec', '~> 2.0' if ver(RUBY_VERSION) >= ver('1.8.7') && ver(RUBY_VERSION) < ver('1.9')
- Exclude checks
Gem beaker
requirements already given on line 55 of the Gemfile. Open
gem 'beaker', *location_for(ENV['BEAKER_VERSION'] || '>= 3.2.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]
Avoid single-line method definitions. Open
def ver(s); Gem::Version.new(s.dup); end
- Read upRead up
- Exclude checks
This cop checks for single-line method definitions that contain a body. It will accept single-line methods with no body.
Example:
# bad
def some_method; body end
def link_to(url); {:name => url}; end
def @table.columns; super; end
# good
def no_op; end
def self.resource_class=(klass); end
def @table.columns; end
Gem rspec-puppet
requirements already given on line 36 of the Gemfile. Open
gem 'rspec-puppet'
- 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 nokogiri
requirements already given on line 46 of the Gemfile. Open
gem 'nokogiri', '< 1.7', :require => false
- 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 beaker-rspec
requirements already given on line 54 of the Gemfile. Open
gem 'beaker-rspec', *location_for(ENV['BEAKER_RSPEC_VERSION'] || '>= 3.4')
- 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'] || '~> 2')
- 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'
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'
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?