config.gemspec
Block has too many lines. [40/25] Open
Open
Gem::Specification.new do |s|
s.name = 'config'
s.version = Config::VERSION
s.date = Time.now.strftime '%F'
s.authors = ['Piotr Kuczynski', 'Fred Wu', 'Jacques Crocker']
- Read upRead up
- Exclude checks
This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.
Prefer $INPUT_RECORD_SEPARATOR
or $RS
from the stdlib 'English' module (don't forget to require it) over $/
. Open
Open
s.files = `git ls-files`.split($/)
- Exclude checks
Use \
instead of +
or <<
to concatenate those strings. Open
Open
s.description = 'Easiest way to manage multi-environment settings in any ruby project or framework: ' +
- Read upRead up
- Exclude checks
This cop checks for string literal concatenation at the end of a line.
Example:
# bad
some_str = 'ala' +
'bala'
some_str = 'ala' <<
'bala'
# good
some_str = 'ala' \
'bala'
Prefer single-quoted strings when you don't need string interpolation or special symbols. Open
Open
'changelog_uri' => "https://github.com/rubyconfig/config/blob/master/CHANGELOG.md",
- 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"
required_ruby_version
(2.6, declared in config.gemspec) and TargetRubyVersion
(2.1, declared in .rubocop.yml) should be equal. Open
Open
s.required_ruby_version = '>= 2.6.0'
- Read upRead up
- Exclude checks
Checks that required_ruby_version
of gemspec and TargetRubyVersion
of .rubocop.yml are equal.
Thereby, RuboCop to perform static analysis working on the version
required by gemspec.
Example:
# When `TargetRubyVersion` of .rubocop.yml is `2.3`.
# bad
Gem::Specification.new do |spec|
spec.required_ruby_version = '>= 2.2.0'
end
# bad
Gem::Specification.new do |spec|
spec.required_ruby_version = '>= 2.4.0'
end
# good
Gem::Specification.new do |spec|
spec.required_ruby_version = '>= 2.3.0'
end
# good
Gem::Specification.new do |spec|
spec.required_ruby_version = '>= 2.3'
end
# good
Gem::Specification.new do |spec|
spec.required_ruby_version = ['>= 2.3.0', '< 2.5.0']
end