mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
reflect updated code-style and workflow in documentation
This commit is contained in:
parent
954d3f5058
commit
665aeeef61
2 changed files with 11 additions and 22 deletions
|
@ -1,30 +1,18 @@
|
|||
# Coding Style
|
||||
|
||||
The coding style used for the Taskwarrior, Taskserver, and other codebases is deliberately kept simple and a little vague.
|
||||
This is because there are many languages involved (C++, C, Python, sh, bash, HTML, troff and more), and specіfying those would be a major effort that detracts from the main focus which is improving the software.
|
||||
The coding style used for the Taskwarrior is based on the [Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html), with small modifications in the line length.
|
||||
|
||||
Instead, the general guideline is simply this:
|
||||
# Automatic formatting
|
||||
|
||||
Make all changes and additions such that they blend in perfectly with the surrounding code, so it looks like only one person worked on the source, and that person is rigidly consistent.
|
||||
In order to have consistancy and automatic formatting [pre-commit](https://pre-commit.com) is used to apply [clang-format](https://clang.llvm.org/docs/ClangFormat.html) and [black](https://github.com/psf/black) are used.
|
||||
In order to set them up locally please run:
|
||||
```python
|
||||
pip install pre-commit
|
||||
pre-commit install
|
||||
```
|
||||
|
||||
To be a little more explicit:
|
||||
|
||||
## C++
|
||||
|
||||
- All functionality in C++17 is allowed.
|
||||
|
||||
- Indent C++ code using two spaces, no tabs
|
||||
|
||||
- Surround operators and expression terms with a space.
|
||||
This includes a space between a function name and its list of arguments.
|
||||
|
||||
- No cuddled braces
|
||||
|
||||
- Class names are capitalized, variable names are not
|
||||
|
||||
## Python
|
||||
|
||||
Follow [PEP8](https://www.python.org/dev/peps/pep-0008/) as much as possible.
|
||||
For more information refer to the [quick-start of pre-commit](https://pre-commit.com/#quick-start).
|
||||
The setup is also included in the CI, hence if one can not install it automatically then the CI will take care for it in the PR.
|
||||
|
||||
## Rust
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
## Install Optional Dependencies:
|
||||
* python 3 (for running the test suite)
|
||||
* pre-commit (for applying formatting changes locally)
|
||||
* clangd or ccls (for C++ integration in many editors)
|
||||
* rust-analyzer (for Rust integration in many editors)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue