Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File naming with acronyms #842

Open
YannIsCoding opened this issue Sep 14, 2020 · 3 comments
Open

File naming with acronyms #842

YannIsCoding opened this issue Sep 14, 2020 · 3 comments

Comments

@YannIsCoding
Copy link

YannIsCoding commented Sep 14, 2020

The guide doesn't give any specification about file naming in the case of acronyms in the class name. https://github.com/rubocop-hq/ruby-style-guide#snake-case-for-files

Following the logic that each word should be separated by an underscore in the file name and a capital letter in the class name, one might expect that the class "SomeXML" should be translated into "some_x_m_l.rb".

This however does not work with Rails and there is no mention of class naming in the rails guide.

This might be a useful addition to this guide.

@bbatsov
Copy link
Collaborator

bbatsov commented Oct 21, 2020

Agreed.

I was under the impression that acronyms are typically presented as one work in the file name. I've never seen a file name like some_x_m_l.rb, so I'd advice against this practice.

@andyw8
Copy link
Contributor

andyw8 commented Feb 21, 2021

I agree that file should always be named some_xml.rb, but I think it could be worth covering whether the class name would be SomeXML or SomeXml. My impression is the former is more common in the Ruby world, the latter in the JavaScript and Java worlds.

@andyw8
Copy link
Contributor

andyw8 commented Feb 21, 2021

(maybe it's not so clear-cut in JS - XMLHttpRequest has two style in the one name!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants