Skip to content

Cop/StaticTranslationDefinition: Allow constant assignments for Structs

What does this MR do and why?

Prior this commit, 👮 Cop/StaticTranslationDefinition would flag the following code:

SomeClass = Struct.new do
  def text
     _('Some translated text')
  end
end

This commit allow such style again so workarounds are not longer needed like:

Struct.new('SomeClass') do
  def text
    _('Some translated text')
  end
end

Closes #338295 (closed)

How to set up and validate locally

Run the specs 😅

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