docs: add flake8 config and linting policy; add changelog entry

This commit is contained in:
sh4un
2026-01-22 21:22:00 -05:00
parent e9ebb338b4
commit b30461b056
3 changed files with 30 additions and 1 deletions

11
.flake8 Normal file
View File

@@ -0,0 +1,11 @@
[flake8]
max-line-length = 79
exclude =
.venv,
.git,
__pycache__,
build,
dist,
.eggs,
*.egg-info
ignore = E203,W503

View File

@@ -1,6 +1,15 @@
# Changelog - Major Enhancements # Changelog - Major Enhancements
**Last Updated: December 31, 2025** **Last Updated: January 22, 2026**
## Unreleased
### Maintenance
- **Added** `.flake8` configuration to exclude `.venv` from linting to avoid third-party noise in CI and local runs.
- **Documented** project linting policy (79-char E501 limit, prefer wrapping and parameterized logging, and do not edit third-party site-packages).
- **Fixed** project E501 and other flake8 issues in `ammb/` and `examples/`; tests and `mypy` were run and verified clean.
---
## Version 2.0.0 - Comprehensive Code Review and Enhancements (December 31, 2025) ## Version 2.0.0 - Comprehensive Code Review and Enhancements (December 31, 2025)

View File

@@ -114,6 +114,15 @@ We use `flake8` for checking code style against PEP 8 guidelines and common erro
flake8 ammb/bridge.py flake8 ammb/bridge.py
``` ```
### Project linting policy ✅
- **Max line length:** 79 characters (flake8 E501). When long lines are found, prefer **targeted wrapping or splitting** (for example: split long strings, break complex expressions, or use short helper variables) rather than increasing the line length limit.
- **Third-party packages:** Do **not** edit files under `.venv` or other external package directories to satisfy linter rules. Instead, exclude those directories from lint runs (we include `.venv` in the project's `.flake8` file).
- **Logging:** Prefer parameterized logging calls (e.g., `logger.info("Connected to %s", port)`) instead of long f-strings to keep messages shorter and avoid unnecessary formatting overhead.
- **Fix process:** When addressing E501 issues in project files, make conservative, behavior-preserving edits (wrap strings, reflow docstrings, or adjust logging). Re-run tests and `mypy` after each change to ensure no regressions.
Example: In this revision we fixed several E501 cases in `ammb/` and `examples/` by wrapping long strings and using parameterized logging; tests and `mypy` were re-run to confirm the project remains correct.
## Static Type Checking ## Static Type Checking
We use `mypy` for static type checking to catch potential type-related errors before runtime. We use `mypy` for static type checking to catch potential type-related errors before runtime.