Skip to content

Fix RuboCop offenses for Lint/UselessMethodDefinition

What does this MR do and why?

This MR fixes all offenses for 👮 rule Lint/UselessMethodDefinition and enables it again as it was disabled due to too many offenses previously.

This MR also disables some offenses:

  • We need to re-expose some Rails' internal method status as action
  • Limit amount of passed parameters

The self-review contains more details and also references commit shas of latest refactoring to give more context on why 👮 rule offenses were introduced in the first place.

Related to #354328 (closed)

Process

bundle exec rake 'rubocop:todo:generate[Lint/UselessMethodDefinition]'

files=$(rg -r '$1' "\s*- '(.*)'" .rubocop_todo/lint/useless_method_definition.yml | xargs)

bundle exec rubocop -A --only Lint/UselessMethodDefinition,Layout/TrailingWhitespace,Layout/EmptyLineBetweenDefs,Layout/EmptyLines,Layout/EmptyLinesAroundClassBody $files

# Manual post-process

Screenshots or screen recordings

n/a

How to set up and validate locally

n/a

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

Loading