[openstreetmap/openstreetmap-website] Ensure consistent naming for all factory files (PR #6607)

Andy Allan notifications at github.com
Wed Dec 10 16:27:21 UTC 2025


gravitystorm left a comment (openstreetmap/openstreetmap-website#6607)

I agree this should be consistent.

It's exactly the kind of thing we need a linter for, otherwise it'll just drift again in the future - it's clearly not an easy thing to spot during reviews! I've checked the `rubocop-factory_bot` repo, and found https://github.com/rubocop/rubocop-factory_bot/issues/57 . Ideally, that would be implemented upstream, or perhaps we would implement it ourselves as a [custom cop](https://github.com/openstreetmap/openstreetmap-website/tree/4c97ee96df281efd0e4129e3a841d12fbdb898f7/.rubocop).

As for which name - it seems like there's three conventions:
* singular model name
* plural model name
* singular model name plus "_factory" suffix

I've check the factory_bot docs, and they don't mention anything. [`annotate_models`](https://github.com/ctran/annotate_models/) (mentioned in the issue above) supports the three alternatives (while referring to "_factory" suffix as ["old style"](https://github.com/ctran/annotate_models/blob/develop/lib/annotate/annotate_models/file_patterns.rb#L107)). Neither Discourse nor Mastodon use factory_bot. I can't find a style guide with any suggestions.

Personally I prefer the plural option, since my IDE then shows "user.rb" and "users.rb" and I know which is which :smile: But I'm eager to find some better reasoning than that.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/6607#issuecomment-3637922562
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/6607/c3637922562 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20251210/558e1699/attachment.htm>


More information about the rails-dev mailing list