From ca965299c31a87c6341e79a7bfb2503e6e3bdefd Mon Sep 17 00:00:00 2001 From: YustinaKvr Date: Tue, 4 Jun 2024 14:44:40 +0200 Subject: [PATCH] tune pylint --- ecosystem_issues.py | 10 +++++++--- failed_zuul.py | 10 +++++++--- gitea_info.py | 8 ++++++-- github_info.py | 8 ++++++-- last_commit_info.py | 15 ++++++++++----- open_issues.py | 11 ++++++++--- otc_services_dict.py | 9 +++++++-- scheduler.py | 8 ++++++-- tox.ini | 2 +- 9 files changed, 58 insertions(+), 23 deletions(-) diff --git a/ecosystem_issues.py b/ecosystem_issues.py index 361178f..17923d0 100644 --- a/ecosystem_issues.py +++ b/ecosystem_issues.py @@ -1,9 +1,13 @@ -import os -import psycopg2 -from github import Github +""" +This script gathers info about github issues in infra repos, for ecosystem squad +""" + import time import logging from datetime import datetime, timedelta +import os +import psycopg2 +from github import Github logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') diff --git a/failed_zuul.py b/failed_zuul.py index fca4799..0c95fe5 100644 --- a/failed_zuul.py +++ b/failed_zuul.py @@ -1,11 +1,15 @@ +""" +This script gathers info regarding PRs, which check jobs in zuul has been failed +""" + +from datetime import datetime +import time +import logging import os import requests import json import re import psycopg2 -from datetime import datetime -import time -import logging logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') diff --git a/gitea_info.py b/gitea_info.py index 0339259..c513778 100644 --- a/gitea_info.py +++ b/gitea_info.py @@ -1,3 +1,9 @@ +""" +This script gather and process info about dependent PRs, its parents and store it in postgres table +""" + +import time +import logging import os import requests import json @@ -6,8 +12,6 @@ import pathlib import psycopg2 from github import Github -import time -import logging logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') diff --git a/github_info.py b/github_info.py index de350e6..5be5b50 100644 --- a/github_info.py +++ b/github_info.py @@ -1,10 +1,14 @@ +""" +This script retrieves info about parent PRs on Github +""" + +import time +import logging import os import requests import re import psycopg2 from github import Github -import time -import logging logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') diff --git a/last_commit_info.py b/last_commit_info.py index adbc402..04c8571 100644 --- a/last_commit_info.py +++ b/last_commit_info.py @@ -1,11 +1,16 @@ +""" +This script provides logic to retrieve info about last date when document was updated +""" + +from datetime import datetime +import time +import logging import os import shutil import tempfile import psycopg2 from github import Github -from datetime import datetime -import time -import logging + logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') @@ -30,7 +35,7 @@ def check_env_variables(): ] for var in required_env_vars: if os.getenv(var) is None: - raise Exception(f"Missing environment variable: {var}") + raise Exception("Missing environment variable: %s", var) def connect_to_db(db_name): @@ -44,7 +49,7 @@ def connect_to_db(db_name): password=db_password ) except psycopg2.Error as e: - logging.error(f"Connecting to Postgres: an error occurred while trying to connect to the database: {e}") + logging.error("Connecting to Postgres: an error occurred while trying to connect to the database: %s", e) return None diff --git a/open_issues.py b/open_issues.py index d38cf46..cd649d9 100644 --- a/open_issues.py +++ b/open_issues.py @@ -1,12 +1,17 @@ +""" +This script gather info regarding open issues in Gitea and Github +""" + +import requests +import time +import logging import json import re import os import psycopg2 from datetime import datetime from github import Github -import requests -import time -import logging + logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') diff --git a/otc_services_dict.py b/otc_services_dict.py index fcbec91..fe1f297 100644 --- a/otc_services_dict.py +++ b/otc_services_dict.py @@ -1,10 +1,15 @@ +""" +This script gather and process info about all services in OTC, both public and hybrid, process it and store in +service postgres tables, to match repo names, service full names and its squads +""" + +import time +import logging import os import requests import yaml import base64 import psycopg2 -import time -import logging logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') diff --git a/scheduler.py b/scheduler.py index 798dbf4..53a1c55 100644 --- a/scheduler.py +++ b/scheduler.py @@ -1,11 +1,15 @@ +""" +This script sends Zulip messages to a corresponding squads via Zulip bot, based on info taken from postgres tables +""" + +from datetime import datetime +from urllib.parse import quote import os import psycopg2 import time import logging from psycopg2.extras import DictCursor import zulip -from datetime import datetime -from urllib.parse import quote logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') diff --git a/tox.ini b/tox.ini index 383192e..79b8b7b 100644 --- a/tox.ini +++ b/tox.ini @@ -10,6 +10,6 @@ deps = isort commands = flake8 . --max-line-length=120 - pylint --max-line-length=120 *.py + pylint --max-line-length=120 --fail-under=8 *.py mypy . isort . --check-only --line-length 120