Update style guide.

PiperOrigin-RevId: 559743120
Change-Id: I6073911526bef9a9cc72d95122c4e8b9993b22ba
This commit is contained in:
Yuval Tassa
2023-08-24 07:09:40 -07:00
committed by Copybara-Service
parent 1dad5993f0
commit 9255cc58a9
+8 -6
View File
@@ -34,7 +34,7 @@ takes precedence. Additional principles include:
- Follow the [naming conventions](https://mujoco.readthedocs.io/en/latest/programming#naming-convention). - Follow the [naming conventions](https://mujoco.readthedocs.io/en/latest/programming#naming-convention).
- Be sparing with horizontal space: Try to keep lines short, avoid line-breaks - Be sparing with horizontal space: Try to keep lines short, avoid line-breaks
where possble. where possible.
- Be generous with vertical space: Empty lines between code blocks are good. - Be generous with vertical space: Empty lines between code blocks are good.
- Keep names short. - Keep names short.
- Inline comments are part of the code, treat them as such. - Inline comments are part of the code, treat them as such.
@@ -59,7 +59,7 @@ spot such a pattern, feel free to send a PR to update the guide.
Line length is 100 characters. In rare situations, like the collision table at Line length is 100 characters. In rare situations, like the collision table at
the top of the top of
[engine_collision_driver.c](https://github.com/deepmind/mujoco/blob/c8ff7b3d341560e8cc33fbdcaffbcdbc4c32327c/src/engine/engine_collision_driver.c#L36), [engine_collision_driver.c](https://github.com/deepmind/mujoco/blob/c8ff7b3d341560e8cc33fbdcaffbcdbc4c32327c/src/engine/engine_collision_driver.c#L36),
longer lines are alowed for readability. longer lines are allowed for readability.
#### Comments #### Comments
@@ -138,11 +138,13 @@ assignments:
} }
``` ```
- Spaces are not allowed around comparison operators in `for` statements and - Spaces are required around comparison operators.
inside array subscripts `[]`. For an example, inspect the `mju_transpose`
implementation above.
- Three empty lines between function declarations. - Spaces are not allowed around operators in array subscripts `[]` or in
variable initialisation in `for` loops. For example, inspect the
`mju_transpose` implementation above.
- Three blank lines are required between function implementations in source files.
#### Variable declarations #### Variable declarations