Contributing¶
Thank you for considering contributing to Nadzoring! This page covers the development workflow, code style rules, and submission process.
Setting Up the Development Environment¶
git clone https://github.com/alexeev-prog/nadzoring.git
cd nadzoring
pip install -e ".[dev]"
Code Style¶
Nadzoring uses ruff for linting and formatting. Run the full check before committing:
ruff check src/
ruff format src/
Key conventions enforced by the ruff config:
Double quotes for strings
Google-style docstrings (
Drules) with examples where relevantisort import ordering (
Irules)PEP 8 naming:
snake_casefor functions/variables,PascalCasefor classes,UPPER_CASEfor module-level constantsNo
print()in library code — use thenadzoring.loggermoduleBoolean keyword-only arguments via
*separator (FBTrules)BLE001(broad exception catch) may be suppressed with a comment where intentional — document why the broad catch is needed
Design Principles¶
Before adding a feature, read Architecture. The short version:
SRP — one module, one concern.
DRY — extract repeated patterns into helpers or the
utils/package.KISS — prefer simple, readable code over clever one-liners.
Error handling — never raise on expected network/DNS/SSL failures; return structured error data instead.
Type hints — all public functions must have complete type annotations; use
TypedDictfor structured return values.No comments — use Google-style docstrings with
Args,Returns, andExamplessections instead of inline comments.Timeout support — all network-bound functions must accept an optional
timeout_config: TimeoutConfig | None = Noneparameter and respect phase-specific timeouts (connect/read) as well as the overall lifetime timeout.
Adding a Security Check¶
The security/ package follows the same conventions as other domain
packages. When adding a new security check:
Create
src/nadzoring/security/mycheck.pywith a single public function (SRP).Return a structured dict with an
"error"key set toNoneon success or a human-readable string on failure. Never raise.Accept an optional
timeout_config: TimeoutConfig | None = Noneparameter and pass it down to any network-bound calls.Export the function from
src/nadzoring/security/__init__.py.Add a CLI command in
src/nadzoring/commands/security_commands.pyusing@common_cli_options(include_timeout=True).Add the result shape to
utils/formatters.pyif a new formatter is needed.Document the command in
docs/commands/security.rstincluding the timeout options.
Writing Tests¶
Tests live in tests/. Run them with:
pytest tests/
New features require at least:
A happy-path test
An error/edge-case test (e.g. domain not found, timeout, SSL error)
A test verifying timeout configuration is respected (if applicable)
Submitting a Pull Request¶
Fork the repository.
Create a feature branch:
git checkout -b feat/my-feature.Make your changes and add tests.
Run
ruff checkandpytest— both must pass.Update the relevant
.rstdocumentation file (commands/security.rstfor new security commands,commands/network.rstfor new network commands, etc.).Open a PR with a clear description of what changed and why.
Areas We’d Love Help With¶
Additional DNS record type support
New health check validation rules
CDN network database expansion
Performance optimisations
Additional output formats
ARP detection heuristics
New network diagnostic commands
Extended security auditing: HSTS preload check, certificate transparency monitoring, CAA record validation, TLSA/DANE record inspection
Reporting Issues¶
Open an issue on GitHub at https://github.com/alexeev-prog/nadzoring/issues. Please include:
Nadzoring version (
pip show nadzoring)Python version and OS
The full command or code snippet that triggered the issue
The full error output
If the issue is timeout-related, include the timeout values used