flake8-ado
Flake8 plugin that validates inline comments against Azure DevOps work items.
Use it when you want every TODO / ADO reference in code to actually point to a real work item — and to fail CI when someone leaves a sloppy comment without a ticket.
What it does
flake8-ado scans comments and enforces a few rules:
- Every comment with an ADO reference (
AB#12345) must match an actual work item. - ADO references must follow a consistent format, e.g.
ADO: AB#12345. TODOcomments that mention ADO must include a work item:TODO: AB#12345.
Example:
# foo.py
class Foo:
def foo(self) -> None: # TODO: AB#12345
pass # ADO: AB#999999
Running:
flake8 \
--ado-access-token=<PERSONAL_ACCESS_TOKEN> \
--ado_organization_url=https://dev.azure.com/<ORG>
may produce:
./foo.py:2:36: ADO001 Missing ADO item
./foo.py:3:12: ADO002 Malformed or invalid ADO reference
Installation
pip install flake8-ado
Ensure flake8 and flake8-ado are installed in the same Python environment used locally or in CI.
Usage
The plugin activates automatically when installed. Provide two extra flags:
flake8 \
--ado-access-token=<PERSONAL_ACCESS_TOKEN> \
--ado_organization_url=https://dev.azure.com/<ORG> \
path/to/your/code
Options
--ado-access-token— Azure DevOps Personal Access Token with read access to work items.--ado_organization_url— Azure DevOps organization URL, e.g.https://dev.azure.com/your-org.
Recognized patterns
The plugin detects ADO references inside comments.
Plain ADO reference:
# ADO: AB#12345
TODO with ADO reference:
# TODO: AB#12345
Bare reference (discouraged but validated):
# AB#12345
Malformed or invalid references produce errors.
Error codes
ADO001— missing or non-existing ADO itemADO002— malformed ADO referenceADO003— invalid format or capitalizationADO004— TODO without an ADO item reference
You can ignore codes like any other Flake8 rule:
flake8 --ignore=ADO004 ...
CI integration
Typical steps:
- Store your ADO PAT as a secret (e.g.
ADO_PAT). - Install
flake8andflake8-ado. - Run Flake8 with the ADO flags.
Example:
pip install flake8-ado
flake8 \
--ado-access-token="$ADO_PAT" \
--ado_organization_url="https://dev.azure.com/your-org" \
src/
If a reference is invalid, CI fails.
Development
git clone https://github.com/DanielKusyDev/flake8-ado.git
cd flake8-ado
python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
pytest
Run locally against test code:
flake8 \
--ado-access-token=<TOKEN> \
--ado_organization_url=<URL> \
tests/example_project
Why
Teams often try to enforce "every TODO must link to a work item" as a soft rule. It lasts a week.
flake8-ado automates it: if the ticket doesn’t exist or the reference is malformed, the build fails.
License
MIT
Release files for flake8-ado 1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| flake8_ado-1.1.tar.gz | 55.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| flake8_ado-1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 63.0 kB
Release files / flake8_ado-1.1.tar.gz
| Download URL | flake8_ado-1.1.tar.gz |
|---|---|
| Size | 55.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cd3cbefedf8203234d9bf7a306cee21aacc149b283c6b160127216317f3400c8
|
|
BLAKE2b-256 checksum How to use checksums |
390102cd4b43dd9e02bda9b654ae69c40254ec666a052483e2600c2f7b9609e3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.13 {"installer":{"name":"uv","version":"0.9.13"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / flake8_ado-1.1-py3-none-any.whl
| Download URL | flake8_ado-1.1-py3-none-any.whl |
|---|---|
| Size | 8.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d8ae655f07e199a8d34ccdc7e1a426281ae0cf34563d0c3de182ff6fd3a769ce
|
|
BLAKE2b-256 checksum How to use checksums |
97446ac7ef26c9b2a95c1e19c8223c9154e6e7f33c8489b375e27ac1a0ec9623
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.13 {"installer":{"name":"uv","version":"0.9.13"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|