mirror of
https://github.com/bellingcat/auto-archiver.git
synced 2026-06-07 19:08:30 +03:00
Add documentation, pre-commit hook, more make commands and
This commit is contained in:
@@ -32,4 +32,5 @@ testing
|
||||
docs
|
||||
release
|
||||
settings_page
|
||||
style_guide
|
||||
```
|
||||
39
docs/source/development/style_guide.md
Normal file
39
docs/source/development/style_guide.md
Normal file
@@ -0,0 +1,39 @@
|
||||
### Style Guide
|
||||
|
||||
The project uses [ruff](https://docs.astral.sh/ruff/) for linting and formatting.
|
||||
Our style configurations are set in the `pyproject.toml` file.
|
||||
|
||||
We have a pre-commit hook to run the formatter before you commit, but Ruff can also be [integrated with most editors](https://docs.astral.sh/ruff/editors/setup/) to run automatically.
|
||||
|
||||
We recommend you also run the linter before pushing code.
|
||||
|
||||
# Running the linter
|
||||
|
||||
We have Makefile commands to run common tasks (Note if you're on Windows you might need to install `make` first, or you can use ruff directly):
|
||||
|
||||
This outputs a report of any issues found:
|
||||
```shell
|
||||
make ruff-check
|
||||
```
|
||||
|
||||
This command will attempt to fix any issues it can:
|
||||
|
||||
⚠️ Warning: This can cause breaking changes. ⚠️
|
||||
|
||||
Ensure you check any modifications by this before committing them.
|
||||
```shell
|
||||
make ruff-fix
|
||||
```
|
||||
|
||||
**Note:** If you're on Windows you might not have `make` installed by default.
|
||||
This is included with [Git for Windows](https://gitforwindows.org/) or you can install make via [Chocolatey](https://chocolatey.org/):
|
||||
```shell
|
||||
choco install make
|
||||
```
|
||||
|
||||
**Running directly with ruff**
|
||||
|
||||
Alternatively, you can run the commands directly with ruff.
|
||||
|
||||
Our rules are quite lenient for general usage, but if you want to explore more rigorous checks you can explore the [ruff documentation](https://docs.astral.sh/ruff/configuration/).
|
||||
You can then run checks to see more nuanced errors which you can review manually.
|
||||
Reference in New Issue
Block a user