Skip to content

Commit

Permalink
Dynamically enable Style/SingleLineDoEndBlock
Browse files Browse the repository at this point in the history
This enables `Style/SingleLineDoEndBlock` for consumers on a new enough
version of RuboCop. This allows us to enable the cop without dropping
support for old RuboCop versions.
  • Loading branch information
sambostock committed Dec 11, 2023
1 parent 4874b30 commit 194baa9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<% rubocop_version = Gem.loaded_specs.fetch("rubocop").version %>

inherit_mode:
merge:
- Exclude
Expand Down Expand Up @@ -794,6 +796,11 @@ Style/SelectByRegexp:
Style/SingleArgumentDig:
Enabled: false

<% if rubocop_version >= Gem::Version.new('1.57') %>
Style/SingleLineDoEndBlock:
Enabled: true
<% end %>

Style/SlicingWithRange:
Enabled: false

Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/full_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3943,7 +3943,7 @@ Style/SingleLineBlockParams:
- elem
Style/SingleLineDoEndBlock:
Description: Checks for single-line `do`...`end` blocks.
Enabled: pending
Enabled: true
VersionAdded: '1.57'
Style/SingleLineMethods:
Description: Avoid single-line methods.
Expand Down

0 comments on commit 194baa9

Please sign in to comment.