PyCQA / flake8-bugbear

A plugin for Flake8 finding likely bugs and design problems in your program. Contains warnings that don't belong in pyflakes and pycodestyle.
MIT License
1.05k stars 103 forks source link

add flake8 python version check script and CI check #431

Closed r-downing closed 7 months ago

r-downing commented 7 months ago

from https://github.com/PyCQA/flake8-bugbear/issues/365

Made a quick standalone python script. Uses curl (so no need to pip install requests or anything else) to get pypy json info for flake8. Grabs the requires-python = ... line from pyproject.toml and compares the two, will throw an error if they don't match.

Note - chose to get bugbear version from pyproject.toml rather than fetching bugbear json because then the test would fail until a bugbear update was uploaded to pypi.

Not sure about naming or folder placement - just stuck it in a scripts folder.

Testing:

Made it run on push, and changed the python version in pyproject.toml to see it fail. Sample error output

error output: ``` Run python scripts/flake8_py_version_check.py Traceback (most recent call last): File "/home/runner/work/flake8-bugbear/flake8-bugbear/scripts/flake8_py_version_check.py", line 3[4](https://github.com/r-downing/flake8-bugbear/actions/runs/7041812391/job/19164955564#step:3:5), in main() File "/home/runner/work/flake[8](https://github.com/r-downing/flake8-bugbear/actions/runs/7041812391/job/19164955564#step:3:9)-bugbear/flake8-bugbear/scripts/flake8_py_version_check.py", line 2[9](https://github.com/r-downing/flake8-bugbear/actions/runs/7041812391/job/19164955564#step:3:10), in main flake8_requires == flake8_bugbear_requires AssertionError: python version requirements don't match: (flake8_requires='>=3.8.1' != flake8_bugbear_requires='>=3.8.0') ```

Fixes #365