Flake8 plugin to check comments against AzureDevOps ticket references.
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file flake8_ado-1.1.tar.gz.
File metadata
- Download URL: flake8_ado-1.1.tar.gz
- Upload date:
- Size: 55.0 kB
- Tags: Source
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cd3cbefedf8203234d9bf7a306cee21aacc149b283c6b160127216317f3400c8
|
|
| MD5 |
c5b429bb1d7d44494dbe193485c4fb7e
|
|
| BLAKE2b-256 |
390102cd4b43dd9e02bda9b654ae69c40254ec666a052483e2600c2f7b9609e3
|
File details
Details for the file flake8_ado-1.1-py3-none-any.whl.
File metadata
- Download URL: flake8_ado-1.1-py3-none-any.whl
- Upload date:
- Size: 8.1 kB
- Tags: Python 3
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d8ae655f07e199a8d34ccdc7e1a426281ae0cf34563d0c3de182ff6fd3a769ce
|
|
| MD5 |
531ee34585871217ae8d6588eb7f06d6
|
|
| BLAKE2b-256 |
97446ac7ef26c9b2a95c1e19c8223c9154e6e7f33c8489b375e27ac1a0ec9623
|