This is a working document outlining the coding standard for the general MariaDB codebase.
This is a working document outlining the coding standard for the general MariaDB codebase.
The document can be found in the 11.0 and newer trees in the root directory as "CODING_STANDARDS.md"
It does not cover the coding standards for individual plugins, these should have their own coding standards documentation.
It does not cover the coding standards for individual plugins, these should have their own coding standards documentation.
## Using Git with the MariaDB codebase
## Using Git with the MariaDB codebase
...
@@ -11,7 +13,7 @@ Git commit messages must conform to the 50/72 rule.
...
@@ -11,7 +13,7 @@ Git commit messages must conform to the 50/72 rule.
This is a de facto git standard which is automatically enforced by some editors.
This is a de facto git standard which is automatically enforced by some editors.
This means:
This means:
* 50 characters max for the first (description) line.
* 50 characters max for the first (description) line (see exception later)
* A blank line.
* A blank line.
* 72 characters max for every subsequent line.
* 72 characters max for every subsequent line.
...
@@ -26,7 +28,9 @@ the relative motion of conductors and fluxes, it’s produced by the
...
@@ -26,7 +28,9 @@ the relative motion of conductors and fluxes, it’s produced by the
modial interaction of magneto-reluctance and capacitive diractance.
modial interaction of magneto-reluctance and capacitive diractance.
```
```
The commit messages are typically rendered in Markdown format, so markdown formatting is permitted for the message body.
The only explicitly allowed exception to the 50-72 rules is that if the first line can be MDEV-###### title', even if the title would make the line longer than 50 characters.
The commit messages are typically rendered in [Markdown format](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax), so markdown formatting is permitted for the message body.
### Branch handling
### Branch handling
...
@@ -68,11 +72,13 @@ finalthing();
...
@@ -68,11 +72,13 @@ finalthing();
#### Switch / Case statements
#### Switch / Case statements
For switch / case statements the `case` needs to be inline with the `switch`.
For switch / case statements the `case` needs to be inline with the `switch`.
Preferably switch (expr) should be followed by '{' on the same line to