CppCXY / EmmyLuaCodeStyle

fast, powerful, and feature-rich Lua formatting and checking tool.
MIT License
139 stars 27 forks source link

About the definition of `snake-case` and `upper-snake-case` #149

Closed AndreaWalchshoferSCCH closed 1 year ago

AndreaWalchshoferSCCH commented 1 year ago

This might be more of a question than an issue.

It was encountered that when using the namestyle upper-snake-case, a variable name like CONSTANT_VALUE_1 does cause a namestyle violation, but CONSTANT_VALUE1 doesn't.

There are arguments for both variants to be the "correct" snake-case, so I mainly want to ask: Is your understanding of snake_case and upper_snake_case that numerical components have to be prefixed with letters, or could it be adapted in the implementations of snake_case and upper_snake_case themselves?

Of course, there's always the options to implement any custom namestyle variant with a regular expression, but if there are predefined styles, the configuration ends up simpler.

CppCXY commented 1 year ago

Actually, I always use camelCase or PascalCase styles for my code. Naming style checks are just something I did on the side because there were no plugins involved in Lua. In my earliest version, it only allowed numbers to appear at the end of identifiers. After looking at a lot of code, I realized this wasn't adequate, so I changed the way the checks were done. The issue with snake_case was simply because at that time, I didn't deal with the underscore followed by a number. Actually, I haven't read any specific naming conventions, I just rely on my intuition.