AdGuardian Term uses Cargo’s built-inDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/lissy93/adguardian-term/llms.txt
Use this file to discover all available pages before exploring further.
test, clippy, and fmt tools for quality assurance. Tests are co-located with the source code in #[cfg(test)] modules — there is no separate test directory. Every quality check also runs automatically in CI on each pull request and push.
Running Tests
make test target also ensures the project is compiled first (make build is listed as a prerequisite). The --all-features flag is used in CI to ensure feature-gated code paths are also exercised.
What Is Tested
The current test suite focuses on deserialization robustness — verifying that the application handles incomplete or unexpected API responses gracefully rather than panicking.tests::empty_and_partial_json_decode_to_defaults
Location: src/fetch/fetch_query_log.rs
This test verifies several important properties of the serde deserialization layer:
- Empty JSON objects —
QueryResponse,StatsResponse, andStatusResponseall derive#[serde(default)], so deserializing{}produces a fully populated struct with zero/false/empty defaults rather than a parse error. - Partial JSON — a
StatsResponsewith only some fields present (e.g.{"num_dns_queries": 5}) deserializes successfully, leaving all other fields at their defaults. - Blocked queries without an upstream field — when AdGuard Home blocks a query it does not include an
upstreamfield in the query log entry. The test confirms that theQuerystruct deserializes this correctly to an empty string via#[serde(default)], rather than failing with a missing-field error.
Linting
Clippy is configured to treat all warnings as errors (-D warnings), ensuring no latent issues accumulate in the codebase.
Formatting
The project enforces a consistent code style usingrustfmt. The --check flag makes the command exit with a non-zero code if any file would be reformatted, without actually modifying files — suitable for both local checks and CI.
cargo fmt without the -- --check flag.
Compilation Check
cargo check performs a fast compilation pass that resolves types and reports errors without producing a final binary. It is significantly faster than a full build and is useful for a quick feedback loop during development.
--all-features --locked to catch any feature-gated compilation issues.
Benchmarks
Benchmark tests can be executed with:make bench target depends on make build, so the project is compiled before benchmarks run.
Generating Rust API Docs
Documentation is generated from Rustdoc comments using:--no-deps flag limits output to the project’s own crates, skipping dependency documentation. The generated HTML is written to target/doc/.
The published version of the API docs is automatically built and deployed to GitHub Pages on each release:
lissy93.github.io/AdGuardian-Term/adguardian
In CI, docs are built with RUSTDOCFLAGS=-D warnings to catch broken intra-doc links and missing documentation.
CI Integration
All quality checks run automatically via GitHub Actions on every push and pull request, defined in.github/workflows/ci.yml. The workflow includes:
| Job | Command | When it runs |
|---|---|---|
| Format | cargo fmt --all --check | On any Rust source change |
| Clippy | cargo clippy --all-targets --all-features --locked -- -D warnings | On any Rust source change |
| Test | cargo test --all-features --locked | On any Rust source change |
| Build | cargo build --release --locked | On any Rust source change |
| Docs | cargo doc --no-deps --all-features --locked | On any Rust source change |
| Workflow lint | actionlint + zizmor | On any workflow file change |
| Secret scan | TruffleHog | On pull requests |
| Dependency review | GitHub dependency-review-action | On PRs with dependency changes |
The CI workflow uses path filtering to skip jobs that are unaffected by a given change. For example, Rust checks are skipped if only workflow files are modified, and vice versa. This keeps CI fast on documentation-only or tooling-only changes.