git-bot-feedback 0.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- git_bot_feedback-0.0.1/.gitattributes +21 -0
- git_bot_feedback-0.0.1/.gitignore +194 -0
- git_bot_feedback-0.0.1/.pre-commit-config.yaml +30 -0
- git_bot_feedback-0.0.1/CHANGELOG.md +53 -0
- git_bot_feedback-0.0.1/CONTRIBUTING.md +166 -0
- git_bot_feedback-0.0.1/Cargo.lock +2504 -0
- git_bot_feedback-0.0.1/Cargo.toml +71 -0
- git_bot_feedback-0.0.1/LICENSE +674 -0
- git_bot_feedback-0.0.1/PKG-INFO +94 -0
- git_bot_feedback-0.0.1/README.md +72 -0
- git_bot_feedback-0.0.1/README.rst +68 -0
- git_bot_feedback-0.0.1/bindings/python/CHANGELOG.md +57 -0
- git_bot_feedback-0.0.1/bindings/python/Cargo.toml +22 -0
- git_bot_feedback-0.0.1/bindings/python/README.rst +68 -0
- git_bot_feedback-0.0.1/bindings/python/git_bot_feedback.pyi +240 -0
- git_bot_feedback-0.0.1/bindings/python/src/lib.rs +75 -0
- git_bot_feedback-0.0.1/bindings/python/src/wrapper.rs +311 -0
- git_bot_feedback-0.0.1/build.rs +14 -0
- git_bot_feedback-0.0.1/codecov.yml +11 -0
- git_bot_feedback-0.0.1/cspell.config.yml +59 -0
- git_bot_feedback-0.0.1/docs/API/client.rst +5 -0
- git_bot_feedback-0.0.1/docs/API/file-annotations.rst +23 -0
- git_bot_feedback-0.0.1/docs/API/file-changes.rst +27 -0
- git_bot_feedback-0.0.1/docs/API/index.rst +11 -0
- git_bot_feedback-0.0.1/docs/API/output-variables.rst +5 -0
- git_bot_feedback-0.0.1/docs/API/pr-reviews.rst +22 -0
- git_bot_feedback-0.0.1/docs/API/thread-comments.rst +30 -0
- git_bot_feedback-0.0.1/docs/_static/favicon.ico +0 -0
- git_bot_feedback-0.0.1/docs/_static/logo.png +0 -0
- git_bot_feedback-0.0.1/docs/conf.py +33 -0
- git_bot_feedback-0.0.1/docs/index.rst +5 -0
- git_bot_feedback-0.0.1/docs/logo.xcf +0 -0
- git_bot_feedback-0.0.1/git_bot_feedback.pyi +240 -0
- git_bot_feedback-0.0.1/nurfile +136 -0
- git_bot_feedback-0.0.1/pyproject.toml +50 -0
- git_bot_feedback-0.0.1/src/client/github/graphql.rs +510 -0
- git_bot_feedback-0.0.1/src/client/github/mod.rs +338 -0
- git_bot_feedback-0.0.1/src/client/github/serde_structs.rs +127 -0
- git_bot_feedback-0.0.1/src/client/github/specific_api.rs +420 -0
- git_bot_feedback-0.0.1/src/client/local.rs +176 -0
- git_bot_feedback-0.0.1/src/client/mod.rs +314 -0
- git_bot_feedback-0.0.1/src/comments/mod.rs +12 -0
- git_bot_feedback-0.0.1/src/comments/review_comments.rs +173 -0
- git_bot_feedback-0.0.1/src/comments/thread_comments.rs +168 -0
- git_bot_feedback-0.0.1/src/error.rs +282 -0
- git_bot_feedback-0.0.1/src/file_annotations.rs +117 -0
- git_bot_feedback-0.0.1/src/file_utils/file_filter.rs +517 -0
- git_bot_feedback-0.0.1/src/file_utils/mod.rs +309 -0
- git_bot_feedback-0.0.1/src/git_diff.rs +261 -0
- git_bot_feedback-0.0.1/src/lib.rs +34 -0
- git_bot_feedback-0.0.1/src/output_variable.rs +159 -0
- git_bot_feedback-0.0.1/uv.lock +658 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Set the default behavior, in case people don't have core.autocrlf set.
|
|
2
|
+
* text=auto
|
|
3
|
+
|
|
4
|
+
# Explicitly declare text files you want to always be normalized and converted
|
|
5
|
+
# to native line endings on checkout.
|
|
6
|
+
*.py text eol=lf
|
|
7
|
+
*.css text eol=lf
|
|
8
|
+
*.md text eol=lf
|
|
9
|
+
*.rst text eol=lf
|
|
10
|
+
*.rs text eol=lf
|
|
11
|
+
*.yml text eol=lf
|
|
12
|
+
*.yaml text eol=lf
|
|
13
|
+
*.json text eol=lf
|
|
14
|
+
*.toml text eol=lf
|
|
15
|
+
*.lock text eol=lf
|
|
16
|
+
.gitattributes text eol=lf
|
|
17
|
+
.gitignore text eol=lf
|
|
18
|
+
**.gitmodules text eol=lf
|
|
19
|
+
*.txt text eol=lf
|
|
20
|
+
*.nu text eol=lf
|
|
21
|
+
nurfile text eol=lf
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
# Created by https://www.toptal.com/developers/gitignore/api/python,rust
|
|
2
|
+
# Edit at https://www.toptal.com/developers/gitignore?templates=python,rust
|
|
3
|
+
|
|
4
|
+
### Python ###
|
|
5
|
+
# Byte-compiled / optimized / DLL files
|
|
6
|
+
__pycache__/
|
|
7
|
+
*.py[cod]
|
|
8
|
+
*$py.class
|
|
9
|
+
|
|
10
|
+
# C extensions
|
|
11
|
+
*.so
|
|
12
|
+
|
|
13
|
+
# Distribution / packaging
|
|
14
|
+
.Python
|
|
15
|
+
build/
|
|
16
|
+
develop-eggs/
|
|
17
|
+
dist/
|
|
18
|
+
downloads/
|
|
19
|
+
eggs/
|
|
20
|
+
.eggs/
|
|
21
|
+
lib/
|
|
22
|
+
lib64/
|
|
23
|
+
parts/
|
|
24
|
+
sdist/
|
|
25
|
+
var/
|
|
26
|
+
wheels/
|
|
27
|
+
share/python-wheels/
|
|
28
|
+
*.egg-info/
|
|
29
|
+
.installed.cfg
|
|
30
|
+
*.egg
|
|
31
|
+
MANIFEST
|
|
32
|
+
|
|
33
|
+
# PyInstaller
|
|
34
|
+
# Usually these files are written by a python script from a template
|
|
35
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
36
|
+
*.manifest
|
|
37
|
+
*.spec
|
|
38
|
+
|
|
39
|
+
# Installer logs
|
|
40
|
+
pip-log.txt
|
|
41
|
+
pip-delete-this-directory.txt
|
|
42
|
+
|
|
43
|
+
# Unit test / coverage reports
|
|
44
|
+
htmlcov/
|
|
45
|
+
.tox/
|
|
46
|
+
.nox/
|
|
47
|
+
.coverage
|
|
48
|
+
.coverage.*
|
|
49
|
+
.cache
|
|
50
|
+
nosetests.xml
|
|
51
|
+
coverage.xml
|
|
52
|
+
*.cover
|
|
53
|
+
*.py,cover
|
|
54
|
+
.hypothesis/
|
|
55
|
+
.pytest_cache/
|
|
56
|
+
cover/
|
|
57
|
+
|
|
58
|
+
# Translations
|
|
59
|
+
*.mo
|
|
60
|
+
*.pot
|
|
61
|
+
|
|
62
|
+
# Django stuff:
|
|
63
|
+
*.log
|
|
64
|
+
local_settings.py
|
|
65
|
+
db.sqlite3
|
|
66
|
+
db.sqlite3-journal
|
|
67
|
+
|
|
68
|
+
# Flask stuff:
|
|
69
|
+
instance/
|
|
70
|
+
.webassets-cache
|
|
71
|
+
|
|
72
|
+
# Scrapy stuff:
|
|
73
|
+
.scrapy
|
|
74
|
+
|
|
75
|
+
# Sphinx documentation
|
|
76
|
+
docs/_build/
|
|
77
|
+
|
|
78
|
+
# PyBuilder
|
|
79
|
+
.pybuilder/
|
|
80
|
+
target/
|
|
81
|
+
|
|
82
|
+
# Jupyter Notebook
|
|
83
|
+
.ipynb_checkpoints
|
|
84
|
+
|
|
85
|
+
# IPython
|
|
86
|
+
profile_default/
|
|
87
|
+
ipython_config.py
|
|
88
|
+
|
|
89
|
+
# pyenv
|
|
90
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
91
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
92
|
+
# .python-version
|
|
93
|
+
|
|
94
|
+
# pipenv
|
|
95
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
96
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
97
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
98
|
+
# install all needed dependencies.
|
|
99
|
+
#Pipfile.lock
|
|
100
|
+
|
|
101
|
+
# poetry
|
|
102
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
103
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
104
|
+
# commonly ignored for libraries.
|
|
105
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
106
|
+
#poetry.lock
|
|
107
|
+
|
|
108
|
+
# pdm
|
|
109
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
110
|
+
#pdm.lock
|
|
111
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
112
|
+
# in version control.
|
|
113
|
+
# https://pdm.fming.dev/#use-with-ide
|
|
114
|
+
.pdm.toml
|
|
115
|
+
|
|
116
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
117
|
+
__pypackages__/
|
|
118
|
+
|
|
119
|
+
# Celery stuff
|
|
120
|
+
celerybeat-schedule
|
|
121
|
+
celerybeat.pid
|
|
122
|
+
|
|
123
|
+
# SageMath parsed files
|
|
124
|
+
*.sage.py
|
|
125
|
+
|
|
126
|
+
# Environments
|
|
127
|
+
.env
|
|
128
|
+
.venv
|
|
129
|
+
env/
|
|
130
|
+
venv/
|
|
131
|
+
ENV/
|
|
132
|
+
env.bak/
|
|
133
|
+
venv.bak/
|
|
134
|
+
|
|
135
|
+
# Spyder project settings
|
|
136
|
+
.spyderproject
|
|
137
|
+
.spyproject
|
|
138
|
+
|
|
139
|
+
# Rope project settings
|
|
140
|
+
.ropeproject
|
|
141
|
+
|
|
142
|
+
# mkdocs documentation
|
|
143
|
+
/site
|
|
144
|
+
|
|
145
|
+
# mypy
|
|
146
|
+
.mypy_cache/
|
|
147
|
+
.dmypy.json
|
|
148
|
+
dmypy.json
|
|
149
|
+
|
|
150
|
+
# Pyre type checker
|
|
151
|
+
.pyre/
|
|
152
|
+
|
|
153
|
+
# pytype static type analyzer
|
|
154
|
+
.pytype/
|
|
155
|
+
|
|
156
|
+
# Cython debug symbols
|
|
157
|
+
cython_debug/
|
|
158
|
+
|
|
159
|
+
# PyCharm
|
|
160
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
161
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
162
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
163
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
164
|
+
#.idea/
|
|
165
|
+
|
|
166
|
+
### Python Patch ###
|
|
167
|
+
# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
|
|
168
|
+
poetry.toml
|
|
169
|
+
|
|
170
|
+
# ruff
|
|
171
|
+
.ruff_cache/
|
|
172
|
+
|
|
173
|
+
# LSP config files
|
|
174
|
+
pyrightconfig.json
|
|
175
|
+
|
|
176
|
+
### Rust ###
|
|
177
|
+
# Generated by Cargo
|
|
178
|
+
# will have compiled files and executables
|
|
179
|
+
debug/
|
|
180
|
+
|
|
181
|
+
# These are backup files generated by rustfmt
|
|
182
|
+
**/*.rs.bk
|
|
183
|
+
|
|
184
|
+
# MSVC Windows builds of rustc generate these, which store debugging information
|
|
185
|
+
*.pdb
|
|
186
|
+
|
|
187
|
+
# End of https://www.toptal.com/developers/gitignore/api/python,rust
|
|
188
|
+
|
|
189
|
+
# generated release notes
|
|
190
|
+
*/ReleaseNotes.md
|
|
191
|
+
|
|
192
|
+
# coverage reports
|
|
193
|
+
lcov.info
|
|
194
|
+
coverage.json
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# See https://pre-commit.com for more information
|
|
2
|
+
# See https://pre-commit.com/hooks.html for more hooks
|
|
3
|
+
repos:
|
|
4
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
5
|
+
rev: v6.0.0
|
|
6
|
+
hooks:
|
|
7
|
+
- id: trailing-whitespace
|
|
8
|
+
- id: end-of-file-fixer
|
|
9
|
+
- id: check-yaml
|
|
10
|
+
- id: check-toml
|
|
11
|
+
- id: check-added-large-files
|
|
12
|
+
- id: mixed-line-ending
|
|
13
|
+
args: ['--fix=lf']
|
|
14
|
+
- repo: https://github.com/streetsidesoftware/cspell-cli
|
|
15
|
+
rev: v10.0.1
|
|
16
|
+
hooks:
|
|
17
|
+
- id: cspell
|
|
18
|
+
exclude: CHANGELOG.md$
|
|
19
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
20
|
+
# Ruff version.
|
|
21
|
+
rev: v0.15.20
|
|
22
|
+
hooks:
|
|
23
|
+
# Run the linter.
|
|
24
|
+
- id: ruff-check
|
|
25
|
+
# Run the formatter.
|
|
26
|
+
- id: ruff-format
|
|
27
|
+
- repo: https://github.com/pre-commit/mirrors-mypy
|
|
28
|
+
rev: v2.1.0
|
|
29
|
+
hooks:
|
|
30
|
+
- id: mypy
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
<!-- markdownlint-disable MD024 -->
|
|
8
|
+
|
|
9
|
+
## [git-bot-feedback/v0.7.0] - 2026-06-29
|
|
10
|
+
|
|
11
|
+
### <!-- 1 --> 🚀 Added
|
|
12
|
+
|
|
13
|
+
- Implement GitHub client by @2bndy5 in [#1](https://github.com/2bndy5/git-bot-feedback/pull/1)
|
|
14
|
+
- List file changes by @2bndy5 in [#11](https://github.com/2bndy5/git-bot-feedback/pull/11)
|
|
15
|
+
- Allow custom base for local diff by @2bndy5 in [#30](https://github.com/2bndy5/git-bot-feedback/pull/30)
|
|
16
|
+
- Propagate more errors to user for adequate handling by @2bndy5 in [#31](https://github.com/2bndy5/git-bot-feedback/pull/31)
|
|
17
|
+
- Use helper functions to reduce error handling code by @2bndy5 in [#33](https://github.com/2bndy5/git-bot-feedback/pull/33)
|
|
18
|
+
- Comprehensive output variable validation by @2bndy5 in [#35](https://github.com/2bndy5/git-bot-feedback/pull/35)
|
|
19
|
+
- Support file annotations by @2bndy5 in [#37](https://github.com/2bndy5/git-bot-feedback/pull/37)
|
|
20
|
+
- Support PR reviews by @2bndy5 in [#34](https://github.com/2bndy5/git-bot-feedback/pull/34)
|
|
21
|
+
- Expose `debug_enabled` and `event_name` by @2bndy5 in [#60](https://github.com/2bndy5/git-bot-feedback/pull/60)
|
|
22
|
+
- Implement Display for LinesChangedOnly by @2bndy5 in [#59](https://github.com/2bndy5/git-bot-feedback/pull/59)
|
|
23
|
+
- Add `init_client()` and `LocalClient` by @2bndy5 in [#61](https://github.com/2bndy5/git-bot-feedback/pull/61)
|
|
24
|
+
- Allow custom user-agent header value by @2bndy5 in [#62](https://github.com/2bndy5/git-bot-feedback/pull/62)
|
|
25
|
+
- Revise `FileFilter::walk_dir()` by @2bndy5 in [#78](https://github.com/2bndy5/git-bot-feedback/pull/78)
|
|
26
|
+
- Strip parent path from `walk_dir()` results by @2bndy5 in [#83](https://github.com/2bndy5/git-bot-feedback/pull/83)
|
|
27
|
+
- Add python bindings by @2bndy5 in [#90](https://github.com/2bndy5/git-bot-feedback/pull/90)
|
|
28
|
+
|
|
29
|
+
### <!-- 10 --> 💥 Breaking Changes
|
|
30
|
+
|
|
31
|
+
- Rename `FileFilter::is_not_ignored()` to `is_qualified()` by @2bndy5 in [#57](https://github.com/2bndy5/git-bot-feedback/pull/57)
|
|
32
|
+
|
|
33
|
+
### <!-- 4 --> 🛠️ Fixed
|
|
34
|
+
|
|
35
|
+
- Use synchronous `std::{fs, process::Command}` by @2bndy5 in [#29](https://github.com/2bndy5/git-bot-feedback/pull/29)
|
|
36
|
+
- Make `RestApiClient` a dyn-compatible async trait by @2bndy5 in [#36](https://github.com/2bndy5/git-bot-feedback/pull/36)
|
|
37
|
+
- Remove `async` from non-async functions by @2bndy5 in [#58](https://github.com/2bndy5/git-bot-feedback/pull/58)
|
|
38
|
+
- Use stricter linting rules by @2bndy5 in [#63](https://github.com/2bndy5/git-bot-feedback/pull/63)
|
|
39
|
+
- Write only 1 LF for GH output vars by @2bndy5 in [`7add27b`](https://github.com/2bndy5/git-bot-feedback/commit/7add27b0637d65e2741e05eb55e3e3e712f46236)
|
|
40
|
+
- Honor `ignore_index` when asserted by @2bndy5 in [#75](https://github.com/2bndy5/git-bot-feedback/pull/75)
|
|
41
|
+
- Strip relative path from `FileFilter::walk_dir()` results by @2bndy5 in [#84](https://github.com/2bndy5/git-bot-feedback/pull/84)
|
|
42
|
+
- Use correct name of PR review state that is "COMMENTED" by @2bndy5 in [#89](https://github.com/2bndy5/git-bot-feedback/pull/89)
|
|
43
|
+
|
|
44
|
+
### <!-- 9 --> 🗨️ Changed
|
|
45
|
+
|
|
46
|
+
- Revise `FileAnnotations` impl by @2bndy5 in [#64](https://github.com/2bndy5/git-bot-feedback/pull/64)
|
|
47
|
+
|
|
48
|
+
[git-bot-feedback/v0.7.0]: https://github.com/2bndy5/git-bot-feedback/compare/git-bot-feedback/v0.6.1...git-bot-feedback/v0.7.0
|
|
49
|
+
|
|
50
|
+
Full commit diff: [`git-bot-feedback/v0.6.1...git-bot-feedback/v0.7.0`][git-bot-feedback/v0.7.0]
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
<!-- generated by git-cliff -->
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
<!-- markdownlint-disable MD033 -->
|
|
2
|
+
|
|
3
|
+
# Contribution guidelines
|
|
4
|
+
|
|
5
|
+
First, thank you for considering a contribution to this project!
|
|
6
|
+
|
|
7
|
+
This document should help detail the project's expectations about contributions.
|
|
8
|
+
|
|
9
|
+
## Development tools
|
|
10
|
+
|
|
11
|
+
This project uses the following tools for development:
|
|
12
|
+
|
|
13
|
+
- [cargo-llvm-cov] for measuring code coverage.
|
|
14
|
+
- [cargo-nextest] as a testing harness.
|
|
15
|
+
- [nur] for running common tasks in the development workflow.
|
|
16
|
+
|
|
17
|
+
### Optional tools
|
|
18
|
+
|
|
19
|
+
- [committed] for verifying commit messages conform to [conventional commits]
|
|
20
|
+
standards.
|
|
21
|
+
- [git-cliff] for generating a [Changelog](CHANGELOG.md) and release notes.
|
|
22
|
+
- [pre-commit] for sanitizing project files.
|
|
23
|
+
|
|
24
|
+
[cargo-llvm-cov]: https://crates.io/crates/cargo-llvm-cov
|
|
25
|
+
[cargo-nextest]: https://crates.io/crates/cargo-nextest
|
|
26
|
+
[nur]: https://crates.io/crates/nur
|
|
27
|
+
[committed]: https://crates.io/crates/committed
|
|
28
|
+
[conventional commits]: https://www.conventionalcommits.org
|
|
29
|
+
[git-cliff]: https://crates.io/crates/git-cliff
|
|
30
|
+
[pre-commit]: https://pre-commit.com
|
|
31
|
+
|
|
32
|
+
## Submitting patches
|
|
33
|
+
|
|
34
|
+
Please, please, please open an issue to discuss possible solutions before
|
|
35
|
+
submitting a Pull Request. If it is a small patch (ie 1 or 2 lines), then a
|
|
36
|
+
preemptive issue may not be warranted. Although, it still helps to first discuss
|
|
37
|
+
the reason of the small patch in some manor.
|
|
38
|
+
|
|
39
|
+
Pull Request titles should conform to [conventional commits] standard. Upon
|
|
40
|
+
merging the Pull Request, all commits on the feature branch are squashed into a
|
|
41
|
+
single commit pushed to the default (main) branch. This is done so [git-cliff]
|
|
42
|
+
can adequately generate a list of changes when processing a release.
|
|
43
|
+
|
|
44
|
+
## Code style
|
|
45
|
+
|
|
46
|
+
[uv]: https://docs.astral.sh/uv
|
|
47
|
+
[pipx]: https://pipx.pypa.io/stable
|
|
48
|
+
|
|
49
|
+
This project's CI leverages [pre-commit] to ensure
|
|
50
|
+
|
|
51
|
+
- [x] line ending all use LF (not CRLF)
|
|
52
|
+
- [x] lines have no trailing whitespace
|
|
53
|
+
- [x] files end with a blank line
|
|
54
|
+
- [x] valid syntax is used in all yaml and toml files
|
|
55
|
+
- [x] no large files (greater than 500 kB) are added
|
|
56
|
+
- [x] no unknown or misspelled words are present
|
|
57
|
+
|
|
58
|
+
Normally, [pre-commit] is typically run from a Python virtual environment. This
|
|
59
|
+
project has no other practical need for a Python virtual environment. Instead,
|
|
60
|
+
[pre-commit] can be run as with a one-line command using [uv], [pipx], or [nur]
|
|
61
|
+
|
|
62
|
+
```shell
|
|
63
|
+
pipx run pre-commit run --all-files
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
```shell
|
|
67
|
+
uvx pre-commit run --all-files
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
```shell
|
|
71
|
+
nur pre-commit
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
By default, the [nur] `pre-commit` task uses the [uv] command stated above.
|
|
75
|
+
Optional arguments are documented and shown in `nur pre-commit -h`.
|
|
76
|
+
|
|
77
|
+
### Static analysis
|
|
78
|
+
|
|
79
|
+
Code format and linting is done by using `cargo clippy` and `cargo fmt`. Both
|
|
80
|
+
commands are performed using a [nur] task as well:
|
|
81
|
+
|
|
82
|
+
```shell
|
|
83
|
+
nur lint
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Testing
|
|
87
|
+
|
|
88
|
+
> [!WARNING]
|
|
89
|
+
> Do not use `cargo test` to run this project's tests. This project's tests
|
|
90
|
+
> heavy rely on manipulating environment variables. Instead, this project
|
|
91
|
+
> leverages [cargo-nextest] to isolate each test with it's own environment
|
|
92
|
+
> context. See
|
|
93
|
+
> [cargo-nextest documentation about altering environment variables][cargo-nextest-env-docs].
|
|
94
|
+
|
|
95
|
+
[cargo-nextest-env-docs]: https://nexte.st/docs/configuration/env-vars/#altering-the-environment-within-tests
|
|
96
|
+
|
|
97
|
+
To collect code coverage, this project uses [cargo-llvm-cov] which natively
|
|
98
|
+
supports [cargo-nextest]. However, the commands to run [cargo-llvm-cov] and
|
|
99
|
+
[cargo-nextest] tools in tandem can be lengthy. We use [nur] to parametrize the
|
|
100
|
+
various test options (applicable to this project) into tasks.
|
|
101
|
+
|
|
102
|
+
### Running tests
|
|
103
|
+
|
|
104
|
+
Unit tests are performed using [cargo-nextest] while coverage is measured by
|
|
105
|
+
[cargo-llvm-cov].
|
|
106
|
+
|
|
107
|
+
#### Run the tests
|
|
108
|
+
|
|
109
|
+
```shell
|
|
110
|
+
nur test
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Optional arguments are documented and shown in `nur test -h`.
|
|
114
|
+
|
|
115
|
+
<details><summary>Mimicking CI test runs</summary>
|
|
116
|
+
|
|
117
|
+
The `default` test profile skips tests that are known to run longer than 10
|
|
118
|
+
seconds and only shows verbose output for tests that fail. The `ci` test profile
|
|
119
|
+
includes slow tests and enables more verbose output. To enable the `ci` test
|
|
120
|
+
profile, simply pass `--profile ci` (or `-p ci`) to the `nur test` command:
|
|
121
|
+
|
|
122
|
+
```shell
|
|
123
|
+
nur test -p ci
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
</details>
|
|
127
|
+
|
|
128
|
+
#### Generate coverage report
|
|
129
|
+
|
|
130
|
+
```shell
|
|
131
|
+
nut test llvm-cov
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
> [!TIP]
|
|
135
|
+
> Additional arguments (except `-h` and `--help`) passed to `nur test llvm-cov`
|
|
136
|
+
> are passed onto [cargo-llvm-cov].
|
|
137
|
+
>
|
|
138
|
+
> Pass `--open` to automatically open the built coverage report in your default
|
|
139
|
+
> browser.
|
|
140
|
+
|
|
141
|
+
<details><summary>Generating lcov.info</summary>
|
|
142
|
+
|
|
143
|
+
A "lcov.info" file is uploaded to codecov. Some developer tooling might also
|
|
144
|
+
make use of the lcov format (eg. the VS Code ext named "Coverage Gutters"). This
|
|
145
|
+
lcov.info file can be created with our [nur] task:
|
|
146
|
+
|
|
147
|
+
```shell
|
|
148
|
+
nur test lcov
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
</details>
|
|
152
|
+
|
|
153
|
+
## API documentation
|
|
154
|
+
|
|
155
|
+
Documentation is hosted at docs.rs automatically upon release. To verify any
|
|
156
|
+
documentation changes locally, we can use [nur] for that too:
|
|
157
|
+
|
|
158
|
+
```shell
|
|
159
|
+
nur docs
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
> [!TIP]
|
|
163
|
+
> Optional arguments are documented and shown in `nur docs -h`.
|
|
164
|
+
>
|
|
165
|
+
> Pass `--open` (or `-o`) to automatically open the built documentation in your
|
|
166
|
+
> default browser.
|