๐ [BUG] - Linting tests fail with Pylint 2.16+
lvaylet opened this issue ยท 0 comments
lvaylet commented
SLO Generator Version
v2.3.3
Python Version
3.9+
What happened?
Linting tests fail with a lot of W0719: Raising too general exception: Exception (broad-exception-raised)
. See log output below.
Upon investigating, Pylint 2.16 indeed introduces a new checker for too broad raise Exception()
statements.
For more details, see:
- https://pylint.pycqa.org/en/latest/whatsnew/2/2.16/index.html (
Ctrl+F
onbroad
) - https://pylint.pycqa.org/en/latest/user_guide/messages/warning/broad-exception-raised.html
- pylint-dev/pylint#7494
What did you expect?
Linting tests pass.
Screenshots
![DESCRIPTION](LINK.png)
Relevant log output
From: https://github.com/google/slo-generator/actions/runs/4264329098/jobs/7422259595
Run make lint
black . --check
All done! โจ ๐ฐ โจ
46 files would be left unchanged.
isort . --check-only
Skipped 1 files
flake8 slo_generator/
flake8 tests/
find ./slo_generator ./tests -type f -name "*.py" | xargs pylint
************* Module slo_generator.backends.cloud_monitoring
slo_generator/backends/cloud_monitoring.py:91:12: W0719: Raising too general exception: Exception (broad-exception-raised)
************* Module slo_generator.backends.cloud_monitoring_mql
slo_generator/backends/cloud_monitoring_mql.py:92:12: W0719: Raising too general exception: Exception (broad-exception-raised)
************* Module slo_generator.backends.cloud_service_monitoring
slo_generator/backends/cloud_service_monitoring.py:259:16: W0719: Raising too general exception: Exception (broad-exception-raised)
slo_generator/backends/cloud_service_monitoring.py:337:20: W0719: Raising too general exception: Exception (broad-exception-raised)
slo_generator/backends/cloud_service_monitoring.py:481:12: W0719: Raising too general exception: Exception (broad-exception-raised)
slo_generator/backends/cloud_service_monitoring.py:599:12: W0719: Raising too general exception: Exception (broad-exception-raised)
************* Module slo_generator.backends.prometheus
slo_generator/backends/prometheus.py:94:12: W0719: Raising too general exception: Exception (broad-exception-raised)
************* Module slo_generator.backends.elasticsearch
slo_generator/backends/elasticsearch.py:99:12: W0719: Raising too general exception: Exception (broad-exception-raised)
-----------------------------------
Your code has been rated at 9.96/10
make: *** [Makefile:91: pylint] Error 123
Error: Process completed with exit code 2.
Code of Conduct
- I agree to follow this project's Code of Conduct