|
| 1 | +# How to contribute? |
| 2 | + |
| 3 | +## Pull requests |
| 4 | + |
| 5 | +Every change in the Analytics Toolbox must be included in a pull request. It will be merged by squashing the commits, resulting in one commit against `main` that uses the pull request name and number in the commit description. |
| 6 | + |
| 7 | +The pull request must have a good name and description. We recommend following [Conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) for the naming, which helps have a more structured and descriptive git tree. |
| 8 | + |
| 9 | +These are the main types to be used: `feat`, `fix`, `doc`, `test`, `chore`, and `refactor`, but others can also be used if needed. |
| 10 | + |
| 11 | +The scope is included to refer to the cloud or clouds (`bq`, `sf`, `rs`, `pg`, `db`), and the module or modules affected (`h3`, `lds`, etc.). The format of the scope will be as follows: |
| 12 | + |
| 13 | +``` |
| 14 | +(<cloud(s)>|<module(s)>) |
| 15 | +``` |
| 16 | + |
| 17 | +Here there are some examples: |
| 18 | + |
| 19 | +``` |
| 20 | +feat(bq,sf,rs,pg|quadbin): add quadbin/quadkey conversion functions |
| 21 | +``` |
| 22 | + |
| 23 | +``` |
| 24 | +fix(sf|lds): decrease isolines batch size |
| 25 | +``` |
| 26 | + |
| 27 | +## Documentation |
| 28 | + |
| 29 | +The Analytics Toolbox repositories include all the SQL references for each function/procedure in all the modules. This is the source data for the public SQL reference in the documentation: https://docs.carto.com/data-and-analysis/analytics-toolbox-overview. |
| 30 | + |
| 31 | +### Structure |
| 32 | + |
| 33 | +This is the structure of a generic doc folder: |
| 34 | + |
| 35 | +``` |
| 36 | +clouds/<cloud>/modules/doc/<module>/ |
| 37 | +- _INTRO.md |
| 38 | +- FUNCTION_A.md |
| 39 | +- PROCEDURE_B.md |
| 40 | +``` |
| 41 | + |
| 42 | +The language for documentation is Markdown extended with new metadata and special markers. Here is a guide to contributing to the documentation: |
| 43 | + |
| 44 | +**Introduction** |
| 45 | + |
| 46 | +The file *_INTRO.md* contains the introduction of the module's documentation. The template could vary for each cloud provider. |
| 47 | + |
| 48 | +It allows passing a yml-like metadata header with the following information: |
| 49 | +- badges: core, advanced, beta, etc. |
| 50 | +- order (optional): list of the functions/procedures. By default, it sorts by alphabetical order. |
| 51 | + |
| 52 | +```md |
| 53 | +--- |
| 54 | +badges: |
| 55 | +- advanced |
| 56 | +- beta |
| 57 | +order: |
| 58 | +- PROCEDURE_B |
| 59 | +- FUNCTION_A |
| 60 | +--- |
| 61 | + |
| 62 | +# module |
| 63 | + |
| 64 | +Description of the module. |
| 65 | +``` |
| 66 | + |
| 67 | +**Function** |
| 68 | + |
| 69 | +````md |
| 70 | +## FUNCTION_A |
| 71 | + |
| 72 | +```sql:signature |
| 73 | +carto.FUNCTION_A(param_a, param_b) |
| 74 | +``` |
| 75 | + |
| 76 | +**Description** |
| 77 | + |
| 78 | +Description of the function. |
| 79 | + |
| 80 | +* `param_a`: `STRING` description of param a. |
| 81 | +* `param_b` (optional): `INT64` description of param b. |
| 82 | + |
| 83 | +**Return type** |
| 84 | + |
| 85 | +`FLOAT64` |
| 86 | + |
| 87 | +**Example** |
| 88 | + |
| 89 | +```sql |
| 90 | +SELECT carto.FUNCTION_A('a', 123); |
| 91 | +-- 1234.0 |
| 92 | +``` |
| 93 | +```` |
| 94 | + |
| 95 | +**Procedure** |
| 96 | + |
| 97 | +````md |
| 98 | +## PROCEDURE_B |
| 99 | + |
| 100 | +```sql:signature |
| 101 | +carto.PROCEDURE_B(param_a, param_b) |
| 102 | +``` |
| 103 | + |
| 104 | +**Description** |
| 105 | + |
| 106 | +Description of the procedure. |
| 107 | + |
| 108 | +* `param_a`: `STRING` description of param a. |
| 109 | +* `param_b` (optional): `FLOAT64` description of param b. |
| 110 | + |
| 111 | +**Output** |
| 112 | + |
| 113 | +The result is a table with ... |
| 114 | + |
| 115 | +**Example** |
| 116 | + |
| 117 | +```sql |
| 118 | +CALL carto.PROCEDURE_B( |
| 119 | + ''' |
| 120 | + SELECT * ... |
| 121 | + ''', |
| 122 | + 123 |
| 123 | +); |
| 124 | +``` |
| 125 | +```` |
| 126 | + |
| 127 | +### Extras |
| 128 | + |
| 129 | +Additionally, the documentation allows hint blocks (info/warning): |
| 130 | + |
| 131 | +**Hints** |
| 132 | + |
| 133 | +````` |
| 134 | +````hint:info |
| 135 | +**Title** |
| 136 | +... |
| 137 | +```` |
| 138 | +````` |
0 commit comments