Skip to content

RuboCop: Enable previously disabled cops from Performance department

Peter Leitzen requested to merge pl-rubocop-enable-performance-cops into master

What does this MR do and why?

This MR enables the following 👮 rules which were disabled only due to too many offenses:

Contributes to #369268 (closed)

All pending TODOs have been regenerated via

# Remove `Enabled: false` from .rubocop_todo/**/*.yml

# Regenerate TODOs
bundle exec rake rubocop:todo:generate[Performance/BlockGivenWithExplicitBlock,Performance/CollectionLiteralInLoop,Performance/ConstantRegexp,Performance/MethodObjectAsBlock]

Screenshots or similar

Spec output improvement

Before

layouts/_flash
  closable flash messages
    shows a close button
    shows a close button
    shows a close button
  non closable flash messages
    shows a close button
    shows a close button
    shows a close button
    shows a close button

After

layouts/_flash
  closable flash messages
    flash_type: "success"
      shows a close button
    flash_type: "notice"
      shows a close button
    flash_type: "alert"
      shows a close button
  non closable flash messages
    flash_type: "toast"
      does not show a close button
    flash_type: "message"
      does not show a close button
    flash_type: "warning"
      does not show a close button
    flash_type: "error"
      does not show a close button

How to set up and validate locally

bundle exec rake rubocop:todo:generate[Performance/BlockGivenWithExplicitBlock,Performance/CollectionLiteralInLoop,Performance/ConstantRegexp,Performance/MethodObjectAsBlock]

git status

# No changes expected

MR acceptance checklist

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

Edited by Peter Leitzen

Merge request reports