Andy Waite

Results 394 comments of Andy Waite

I agree. As the docs say, this setting is intended to "help you migrate all your models to have their associations required by default." https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#new-framework-defaults

To check how common this is, I grepped the set of apps from [real-world-rails](https://github.com/eliotsykes/real-world-rails) and only found a handful of occurrences: ``` discourse/app/models/category.rb 110: delegate :post_template, to: 'self.class' e-petitions/app/models/constituency.rb 17:...

I'd suggest first opening a PR to add this to https://github.com/rubocop/rails-style-guide, and then adding it here if there's consensus.

I'm in favour of it as long as: * It's disabled by default * The order is configurable * There is a default ordering (i..e. when enabled, the cop will...

Not just private methods, it should ignore _any_ that aren't part of the standard 7, and should allow non-standard methods to exist before, after, or intermingled with the standard 7.

> I hope to influence people to only use the default methods I think that should be treated as a separate cop from the action ordering.

I agree, and I think this would apply to many cops. Regardless of the default, whenever there's an option to enforce a style, there should usually also be an option...

I wasn't suggesting separate cops, just configuration.

For migrations, you can use `say` and `say_with_time`: https://guides.rubyonrails.org/active_record_migrations.html#changing-the-output-of-running-migrations For generators, the `readme` method can output the contents of a file: https://guides.rubyonrails.org/generators.html#readme Does that cover your use cases?

Another approach could be a library which connects to a language server which provides method definitions, e.g. Solargraph, but that would be out of scope for RuboCop. Limiting it to...