Shopify’s Ruby Style Guide
2.15.1
by @sambostock in https://github.com/Shopify/ruby-style-guide/pull/615
This should fix the cannot load such file -- rubocop/shopify/gem_version_string_comparable_backport
error present in v2.15.0
.Full Changelog: https://github.com/Shopify/ruby-style-guide/compare/v2.15.0...v2.15.1
Layout/LineContinuationLeadingSpace
(#585)Layout/LineContinuationSpacing
(#585)Lint/ItWithoutArgumentsInBlock
(#593)Lint/LiteralAssignmentInCondition
(#593)Lint/MixedCaseRange
(#550)Lint/RedundantRegexpQuantifiers
(#550)Style/EndlessMethod
(#577)Style/IfWithBooleanLiteralBranches
(#551)Style/RedundantArrayConstructor
(#544)Style/RedundantCurrentDirectoryInPath
(#550)Style/RedundantFilterChain
(#544)Style/RedundantRegexpArgument
(#550)Style/RedundantRegexpConstructor
(#544)Style/ReturnNilInPredicateMethodDefinition
(#550)Style/SingleLineDoEndBlock
(#582)Style/SuperWithArgsParentheses
(#593)Style/YAMLFileRead
(#550)Naming/InclusiveLanguage
's AllowedRegex
is changed to permit any unbroken word which includes master
. (#564)
The motivation for this change is to avoid continuously needing to add exclusions such as mastercard
, remaster
, etc. to the list, while still allowing the cop to catch problematic uses of the word master
.Style/FrozenStringLiteralComment
's EnforcedStyle
is changed from always
to always_true
. (#589)
Consumers should aim to use frozen_string_literal: true
in all files, but if certain files need frozen_string_literal: false
, they should disable the cop in those files, mark them as TODO, or add them to the Exclude
list.AllCops
ConfigurationNewCops
is changed from enable
to disable
. (#581)
This silences the warning about pending cops for consumers, as the style guide maintainers will triage them instead.Despite enabling new cops, the minimum RuboCop version is unchanged from the previous release, and remains 1.51.0
.
This is possible due to the new approach taken in rubocop.yml
, in which ERB is used to conditionally enable cops based on the RuboCop version. (#582, #593, #612)
<% rubocop_version = Gem.loaded_specs.fetch("rubocop").version %>
<% if rubocop_version >= "1.23" %>
Department/NewCopName:
Enabled: true
<% end %>
The motivation for this is to try the approach ahead of rubocop-shopify
including optional configuration for rubocop-*
extensions, which would need to work without adding dependencies on the extensions, or their versions.
Style/IfWithBooleanLiteralBranches
by @nvasilevski in https://github.com/Shopify/ruby-style-guide/pull/551
frozen_string_literal: true
by @sambostock in https://github.com/Shopify/ruby-style-guide/pull/589
~> 1.51
by @sambostock in https://github.com/Shopify/ruby-style-guide/pull/612
Full Changelog: https://github.com/Shopify/ruby-style-guide/compare/v2.14.0...v2.15.0
Style/ReturnNil
(#529)Lint/NoReturnInBeginEndBlocks
(#545)Naming/InclusiveLanguage
AllowedRegex
to allow more git repository links (#535)The minimum Rubocop version is now 1.51.0 (https://github.com/Shopify/ruby-style-guide/pull/541).
Naming/InclusiveLanguage
AllowedRegex
by @sambostock in https://github.com/Shopify/ruby-style-guide/pull/535
Full Changelog: https://github.com/Shopify/ruby-style-guide/compare/v2.13.0...v2.14.0
The following cops have been enabled:
Lint/DuplicateMatchPattern
(#525)Metrics/CollectionLiteralLength
(#510)Style/DataInheritance
(#524)Style/DirEmpty
(#510)Style/FileEmpty
(#510)Style/RedundantHeredocDelimiterQuotes
(#497)Style/RedundantLineContinuation
(#524)Layout/LineLength
now allows inline # rubocop:disable ...
comments to exceed the line length. (#488)Layout/LineLength
now allows def test_...
lines to exceed the line length limit, making it consistent with test "..." do
lines, which were already permitted to exceed the limit. (#496)Naming/MethodName
now allows methods starting with test_
to violate the snake_case
convention. (#511)Style/AndOr
now allows and
and or
outside of conditionals (which must still use &&
and ||
instead). (#515)The minimum Rubocop version is now 1.50.0
(#525).
def test_...
lines to be long by @sambostock in https://github.com/Shopify/ruby-style-guide/pull/496
test_
method names to violate snake_case
by @sambostock in https://github.com/Shopify/ruby-style-guide/pull/511
Full Changelog: https://github.com/Shopify/ruby-style-guide/compare/v2.12.0...v2.13.0
The following cops have been enabled:
Lint/UselessRescue
(#486)Style/ArrayIntersect
(#487)Style/ComparableClamp
(#486)Style/InvertibleUnlessCondition
(#486)Style/OperatorMethodCall
The following cops have been disabled:
Gemspec/DevelopmentDependencies
(#486)The minimum rubocop
version is now 1.44
. (#486)
Full Changelog: https://github.com/Shopify/ruby-style-guide/compare/v2.11.1...v2.12.0
Style/OperatorMethodCall
rule by @Korri in https://github.com/Shopify/ruby-style-guide/pull/474
(The autocorrect would introduce syntax errors in some edge cases.)rubocop
1.42.0 (https://github.com/Shopify/ruby-style-guide/pull/467)Style/NumericLiteralPrefix
's EnforcedOctalStyle
to zero_with_o
by @sambostock https://github.com/Shopify/ruby-style-guide/pull/442
Style/MinMaxComparison
by @Korri in https://github.com/Shopify/ruby-style-guide/pull/467
Lint/DuplicateMagicComment
by @sambostock https://github.com/Shopify/ruby-style-guide/pull/452
Style/OperatorMethodCall
by @sambostock https://github.com/Shopify/ruby-style-guide/pull/452
Style/RedundantStringEscape
by @sambostock https://github.com/Shopify/ruby-style-guide/pull/452
Style/RedundantEach
by @sambostock https://github.com/Shopify/ruby-style-guide/pull/457
Style/ConcatArrayLiterals
by @sambostock https://github.com/Shopify/ruby-style-guide/pull/465
Style/RedundantConstantBase
by @sambostock https://github.com/Shopify/ruby-style-guide/pull/465
Style/RedundantDoubleSplatHashBraces
by @sambostock https://github.com/Shopify/ruby-style-guide/pull/465
Full Changelog: https://github.com/Shopify/ruby-style-guide/compare/v2.10.1...v2.11.0
Full Changelog: https://github.com/Shopify/ruby-style-guide/compare/v2.10.0...v2.10.1
Full Changelog: https://github.com/Shopify/ruby-style-guide/compare/v2.9.0...v2.10.0
Style/ClassMethodsDefinitions
with style self_class
in (https://github.com/Shopify/ruby-style-guide/pull/422)Full Changelog: https://github.com/Shopify/ruby-style-guide/compare/v2.8.0...v2.9.0