google / slo-generator

SLO Generator computes SLIs, SLOs, Error Budgets and Burn Rates from supported backends, then exports an SLO report to supported targets.
Apache License 2.0
489 stars 78 forks source link

🐛 [BUG] - Linting tests fail with Pylint 2.16+ #332

Closed lvaylet closed 1 year ago

lvaylet commented 1 year ago

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:

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