rougail/docs/structured_data/naming_convention.rst

75 lines
2.3 KiB
ReStructuredText
Raw Normal View History

2026-05-30 15:51:52 +02:00
Naming convention
=====================
.. _filenamingconvention:
2025-11-30 18:22:56 +01:00
File naming convention
2026-05-30 15:51:52 +02:00
--------------------------
2025-11-30 18:22:56 +01:00
The structure files in a given folder
2026-05-30 15:51:52 +02:00
''''''''''''''''''''''''''''''''''''''''''
2025-11-30 18:22:56 +01:00
For the sake of clarity, we put the structure definitions in separate files.
It's a good way to organize your rougail structures this way,
in the real world we need separate files for different topics.
For example some files like this:
A file named :file:`firefox/00-proxy.yml` structure file and file named :file:`firefox/10-manual.yml`
::
.
└── firefox
├── 00-proxy.yml
└── 10-manual.yml
2025-12-04 18:26:08 +01:00
.. note:: We of course could have put everything in one file.
2025-11-30 18:22:56 +01:00
Again, it is better to separate the structures in different files
for reasons of ordering and clarity.
Ordering your structure files
2026-05-30 15:51:52 +02:00
'''''''''''''''''''''''''''''''''
2025-11-30 18:22:56 +01:00
The order in which files are loaded is important in Rougail.
In a given folder, files are loaded in alphabetical order.
Furthermore, for better readability of the order in which files are
loaded into a folder, we have adopted a convention.
To facilitate classification, we have defined a standard notation for structure file names:
::
XX-<name>.yml
2025-12-03 21:13:38 +01:00
Where `XX` is a two digits integer followed by an hyphen, and `<name>` is a name that describes
2025-11-30 18:22:56 +01:00
the structure that is in this file. We advise you to adopt this convention as well.
2026-05-30 15:51:52 +02:00
File naming convention
'''''''''''''''''''''''''''''
2026-05-30 15:51:52 +02:00
The is no restriction to the `<name>` name part of file name. But it is preferable to only use
lowercase ASCII letters, numbers and the `"_"` (undescore) character.
2026-05-30 15:51:52 +02:00
.. _namingconvention:
2026-05-30 15:51:52 +02:00
Variable and family naming convention
---------------------------------------
2026-05-30 15:51:52 +02:00
The name of a variable and a family must be chosen carefully.
It is the path that will allow users to retrieve their defined values.
An obscure name will cause confusion.
2026-05-30 15:51:52 +02:00
By design, you cannot use just any character to name your variable.
2026-05-30 15:51:52 +02:00
The regular expression that validates our variable and family naming policy is:
2026-05-30 15:51:52 +02:00
.. code-block:: python
2026-05-30 15:51:52 +02:00
re.compile(r"^[a-z0-9_]*$")
2026-05-30 15:51:52 +02:00
You can see that it is mandatory to only use lowercase ASCII letters, numbers and the `"_"` (undescore) character.
The snake case typographic convention is therefore used.
2026-05-30 19:49:27 +02:00
.. attention:: The name must not starts with `_` character.