rubocop-sorbet icon indicating copy to clipboard operation
rubocop-sorbet copied to clipboard

Cop suggestion: Sorbet/StructPropName for T::Struct properties

Open marknuzz opened this issue 7 months ago • 1 comments

It would be great to have a cop that works like Naming/MethodName, but for T::Struct props

Personally I only plan to use snake_case for this right now, but for completeness the cop could support the same options as Naming/MethodName.

Naming/MethodName source: https://github.com/rubocop/rubocop/blob/master/lib/rubocop/cop/naming/method_name.rb

Example:

class Foo < T::Struct
  const :fooConst, String # bad
  const :foo_const, String # good
  
  prop :fooProp, T::Boolean # bad
  prop :foo_prop, T::Boolean # good
end

marknuzz avatar Jun 28 '24 21:06 marknuzz