|
| 1 | +# Contributing |
| 2 | + |
| 3 | +## Code of Conduct |
| 4 | + |
| 5 | +This project and everyone participating in it is governed by a [Code of Conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. Please report unacceptable behavior to [node-duckdb@deepcrawl.com](mailto:node-duckdb@deepcrawl.com). |
| 6 | + |
| 7 | +## **Did you find a bug?** |
| 8 | + |
| 9 | +- **Ensure the bug was not already reported** by searching on GitHub under [Issues](https://github.com/deepcrawl/node-duckdb/issues). |
| 10 | +- If you're unable to find an open issue addressing the problem, [open a new one](https://github.com/deepcrawl/node-duckdb/issues/issues/new). Be sure to include a **title and clear description**, as much relevant information as possible, and a **code sample** or an **executable test case** demonstrating the expected behavior that is not occurring. |
| 11 | + |
| 12 | +## **Did you write a patch that fixes a bug?** |
| 13 | + |
| 14 | +- Great! |
| 15 | +- If possible, add a unit test case to make sure the issue does not occur again. |
| 16 | +- Make sure you run the code linter (`yarn lint`). |
| 17 | +- Open a new GitHub pull request with the patch. |
| 18 | +- Ensure the PR description clearly describes the problem and solution. Include the relevant issue number if applicable. |
| 19 | + |
| 20 | +## Branches |
| 21 | + |
| 22 | +- Do not commit/push directly to the master branch. Instead, create a feature branch/fork and file a merge request. |
| 23 | +- When maintaining a branch, merge frequently with the master. |
| 24 | +- When maintaining a branch, submit merge requests to the master frequently. |
| 25 | +- If you are working on a bigger issue try to split it up into several smaller issues. |
| 26 | + |
| 27 | +## Building and testing |
| 28 | + |
| 29 | +- See the "Developing" section of the [README](README.md) |
| 30 | + |
| 31 | +## Formatting and linting (TS) |
| 32 | + |
| 33 | +- We use prettier and eslint, their respective configurations are in the default places |
| 34 | +- Files should use kebab-case, e.g. duckdb-config.ts |
| 35 | + |
| 36 | +## Naming Conventions (C++) |
| 37 | + |
| 38 | +- Files: snake-case, e.g., abstract_operator.cpp |
| 39 | +- Types (classes, structs, enums, typedefs, using): CamelCase starting with uppercase letter, e.g., BaseColumn |
| 40 | +- Variables: lowercase separated by underscores, e.g., chunk_size |
| 41 | +- Functions: CamelCase starting with uppercase letter, e.g., GetChunk |
| 42 | +- Choose descriptive names. |
| 43 | +- Avoid i, j, etc. in **nested** loops. Prefer to use e.g. **column_idx**, **check_idx**. In a **non-nested** loop it is permissible to use **i** as iterator index. |
| 44 | + |
| 45 | +## C++ Guidelines |
| 46 | + |
| 47 | +- Do not use `malloc`, prefer the use of smart pointers |
| 48 | +- Strongly prefer the use of `unique_ptr` over `shared_ptr`, only use `shared_ptr` if you **absolutely** have to |
| 49 | +- Do **not** import namespaces in headers (e.g. `using std`), only in source files |
| 50 | +- When overriding a virtual method, avoid repeating virtual and always use override or final |
| 51 | +- Use `[u]int(8|16|32|64)_t` instead of int, long, uint etc. In particular, use `index_t` instead of `size_t` for offsets/indices/counts of any kind. |
| 52 | +- Prefer using references over pointers |
| 53 | +- Use C++11 for loops when possible: for (const auto& item : items) {...} |
| 54 | +- Use braces for indenting `if` statements and loops. Avoid single-line if statements and loops, especially nested ones. |
| 55 | +- **Class Layout:** Start out with a `public` block containing the constructor and public variables, followed by a `public` block containing public methods of the class. After that follow any private functions and private variables. |
0 commit comments