Code cleanup. Part two. Make naming convention and code style more consistent
Is your feature request related to a problem? Please describe.
Naming convention for internal variables is not consistent currently. See for example void ArrayState::applyArrays(uint32_t firstBinding, const DataList& in_arrays):
https://github.com/artemkulyk/VulkanSceneGraph/blob/3866c2e3da80a2d4e8147a96dc4acfdab6c7c57b/src/vsg/state/ArrayState.cpp#L93
- first argument in camelCase, second argument in snake_case.
- first "if" in the method in one line
- the last "if" in the method with braces
https://github.com/artemkulyk/VulkanSceneGraph/blob/3866c2e3da80a2d4e8147a96dc4acfdab6c7c57b/src/vsg/state/ArrayState.cpp#L315
- snake_case
https://github.com/artemkulyk/VulkanSceneGraph/blob/3866c2e3da80a2d4e8147a96dc4acfdab6c7c57b/src/vsg/state/GraphicsPipeline.cpp#L27 https://github.com/artemkulyk/VulkanSceneGraph/blob/3866c2e3da80a2d4e8147a96dc4acfdab6c7c57b/src/vsg/state/GraphicsPipeline.cpp#L41
- snake_camelCase
https://github.com/artemkulyk/VulkanSceneGraph/blob/3866c2e3da80a2d4e8147a96dc4acfdab6c7c57b/src/vsg/state/InputAssemblyState.cpp#L56
- camelCase
Describe the solution you'd like I propose to define some consistent naming convention / coding style for the project and add corresponding documentation. Then refactor the code accordingly. I am ready to do this mechanical work. For example:
- use _camelCase for private data members
- use camelCase for public data members
- use camelCase for arguments
- use camelCase for functions
- use PascalCase for class names
Describe alternatives you've considered Review already available coding style documents for public repositories and follow the one.
What I have found is the different naming conventions work best in different situations. Legibility is more important than consistency,
In general the VSG uses ClassName and publicMemberName, _proctectedMemberName convnetion, but for ref_ptr/observer_ptr are used to be consistent with C++ standard, while the maths classes are all lowers to be consistent with GLSL.
When there is a member variable that is passed in as parameter then in_ should be used as a prefix to avoid compiler conflicts.
With the implementations what is most legible is the general guide. if one using one convention over another for a particular block of code makes it more legible then it's OK to deviate from the above.