Skip to content

Fix Rubocop Style/PercentLiteralDelimiters offence

Tan Le requested to merge tl-percent-literal-delimiters-spec-m-to-p into master

What does this MR do and why?

Fix Style/PercentLiteralDelimiters Rubocop.

REVEAL_RUBOCOP_TODO=1 bundle exec rubocop --show-cops Style/PercentLiteralDelimiters
# Supports --autocorrect
Style/PercentLiteralDelimiters:
  Description: Use `%`-literal delimiters consistently.
  StyleGuide: "#percent-literal-braces"
  Enabled: true
  VersionAdded: '0.19'
  PreferredDelimiters:
    default: "()"
    "%i": "[]"
    "%I": "[]"
    "%r": "{}"
    "%w": "[]"
    "%W": "[]"
  VersionChanged: '0.48'

Implementations

The code this is MR is autocorrected by running the following commands.

$ REVEAL_RUBOCOP_TODO=1 bundle exec rubocop --only Style/PercentLiteralDelimiters --parallel -a spec/[m-p]*/**/*.rb
$ bundle exec rake rubocop:todo:generate[Style/PercentLiteralDelimiters]
Generating RuboCop TODOs with:
  rubocop --parallel --format RuboCop::Formatter::TodoFormatter --only Style/PercentLiteralDelimiters

This might take a while...
Written to .rubocop_todo/style/percent_literal_delimiters.yml

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Running this command should not result in error.

$ bundle exec rubocop --only Style/PercentLiteralDelimiters --parallel

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Merge request reports