From 351737fe12b499cafb48beb52bc63b8e5ca77399 Mon Sep 17 00:00:00 2001 From: Pavel Raiskup Date: Thu, 12 Sep 2024 16:29:07 +0200 Subject: [PATCH] Fix-up PyLint and Ruff warnings For a long time we have all python files installed in standard locations, no need to apply sys.path hacks, and irritate linters with a wrong import order. Bumping the max lines/file limit, as (I personally think) these limits only irritate contributing people (who often do not have time or the mandate for major refactoring). --- mock/py/mock.py | 22 +++++++++------------- mock/pylintrc | 2 +- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/mock/py/mock.py b/mock/py/mock.py index 8d154f120..01008406f 100755 --- a/mock/py/mock.py +++ b/mock/py/mock.py @@ -61,23 +61,13 @@ # pylint: disable=import-error from functools import partial + +# our imports from mockbuild import config from mockbuild import util -from mockbuild.constants import MOCKCONFDIR, PYTHONDIR, VERSION +from mockbuild.constants import MOCKCONFDIR, VERSION from mockbuild.file_downloader import FileDownloader from mockbuild.mounts import BindMountPoint, FileSystemMountPoint - -# import all mockbuild.* modules after this. -sys.path.insert(0, PYTHONDIR) - -# set up basic logging until config file can be read -FORMAT = "%(levelname)s: %(message)s" -logging.basicConfig(format=FORMAT, level=logging.WARNING) -log = logging.getLogger() - -# our imports -# pylint: disable=wrong-import-position - import mockbuild.backend from mockbuild.backend import Commands from mockbuild.buildroot import Buildroot @@ -89,6 +79,12 @@ import mockbuild.uid from mockbuild.scrub_all import scrub_all_chroots +# set up basic logging until config file can be read +FORMAT = "%(levelname)s: %(message)s" +logging.basicConfig(format=FORMAT, level=logging.WARNING) +log = logging.getLogger() + + signal_names = {1: "SIGHUP", 13: "SIGPIPE", 15: "SIGTERM" diff --git a/mock/pylintrc b/mock/pylintrc index d4601412d..2ef8a288a 100644 --- a/mock/pylintrc +++ b/mock/pylintrc @@ -133,7 +133,7 @@ max-public-methods=20 max-line-length=120 # Maximum number of lines in a module -max-module-lines=1000 +max-module-lines=2000 # String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 # tab).