Skip to content

Commit 4049653

Browse files
jdsikaonebitme
andauthored
Review: Onebitme patch 1 (#412)
* Changed all remainings of camel case Signed-off-by: Carlo van Driesten <[email protected]> Co-authored-by: Ersun Sözen <[email protected]>
1 parent 4d0e566 commit 4049653

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

doc/interfaceconventions.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ When adding new messages, enums, field messages and field enums to OSI we enforc
77

88
Message Naming
99
---------------
10-
A message definition should always be in camel case. This means that the first letter of each word in a message should be upper case without any spaces. See example below:
10+
A message definition should always be in PascalCase. This means that the first letter of each word in a message should be upper case without any spaces. See example below:
1111

1212
.. code-block:: protobuf
1313
@@ -37,7 +37,7 @@ All messages that are intended to be exchanged as a stand-alone message, i.e. no
3737
3838
Field Message Naming
3939
---------------------
40-
After defining a message fields can be added to it in snake case format. This means every letter is lower case and the words are connected through an underline character. See example below:
40+
After defining a message fields can be added to it in snake_case format. This means every letter is lower case and the words are connected through an underline character. See example below:
4141

4242
.. code-block:: protobuf
4343
@@ -55,7 +55,7 @@ All field numbers of 10000 and above are reserved for user-defined extensions an
5555

5656
Enum Naming
5757
------------
58-
The naming of an enum should be camel case. See example below:
58+
The naming of an enum should be PascalCase. See example below:
5959

6060
.. code-block:: protobuf
6161
@@ -70,7 +70,7 @@ The naming of an enum should be camel case. See example below:
7070
7171
Enum Field Naming
7272
------------
73-
The naming of an enum field should be all in upper case. The start should be converted from the enum name camel case to upper case snake case. It is mandatory to add to the first enum field name the postfix ``_UNKNOWN`` and to the second the postfix ``_OTHER``. After that the naming can be decided by the user. It is often mentioned that the value ``_UNKNOWN`` should not be used in a ``GroundTruth`` message as there are now uncertanties by definition in ``the truth``. These values are mostly used in messages like ``SensorData`` where the content is subject to interpretation. See example below:
73+
The naming of an enum field should be all in upper case. The start should be converted from the enum name PascalCase to UPPER_CASE_SNAKE_CASE. It is mandatory to add to the first enum field name the postfix ``_UNKNOWN`` and to the second the postfix ``_OTHER``. After that the naming can be decided by the user. It is often mentioned that the value ``_UNKNOWN`` should not be used in a ``GroundTruth`` message as there are now uncertanties by definition in ``the truth``. These values are mostly used in messages like ``SensorData`` where the content is subject to interpretation. See example below:
7474

7575
.. code-block:: protobuf
7676
@@ -92,12 +92,12 @@ Summary
9292
--------
9393
Here a small summary for the naming conventions:
9494

95-
Messages: camel case
95+
Messages: PascalCase
9696

97-
Message Fields: snake case
97+
Message Fields: snake_case
9898

99-
Enum: camel case
99+
Enum: PascalCase
100100

101-
Enum Fields: upper case, name of enum converted in upper case snake case and then following the specified name
101+
Enum Fields: Name of enum converted in UPPER_CASE_SNAKE_CASE and then following the specified name
102102

103103
After defining the messages do not forget to comment them. See also the `section for commenting <https://opensimulationinterface.github.io/osi-documentation/open-simulation-interface/doc/commenting.html>`_ of fields and messages.

tests/test_invalid_enum.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def test_correct_enum_name(self):
4545
saveStatement = statement[matchSep.end():]
4646
statement = statement[:matchSep.end()]
4747

48-
# This section will check camelcase for enums and check enum name?
48+
# This section will check PascalCase for enums and check enum name?
4949

5050
if isEnum is True:
5151
matchName = re.search(r"\b\w[\S:]+\b", statement)
@@ -117,7 +117,7 @@ def test_invalid_enum(self):
117117
saveStatement = statement[matchSep.end():]
118118
statement = statement[:matchSep.end()]
119119

120-
# This section will check camelcase for enums and check enum name?
120+
# This section will check PascalCase for enums and check enum name?
121121

122122
if isEnum is True:
123123
matchName = re.search(r"\b\w[\S:]+\b", statement)

0 commit comments

Comments
 (0)