From 79f902eb09842cbecdf082f5ded99f2252c149ac Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Wed, 9 Aug 2023 21:57:47 +0200 Subject: [PATCH] Add .pylintrc to globally suppress warnings we don't really care about Also, drop the respective disable directives from existing files. --- .pylintrc | 23 +++++++++++++++++++++ src/kernel-install/60-ukify.install.in | 5 +---- src/ukify/test/test_ukify.py | 3 +-- src/ukify/ukify.py | 8 ++----- test/test-exec-deserialization.py | 3 --- test/test-network/systemd-networkd-tests.py | 3 --- test/test-shutdown.py | 2 +- test/test-udev.py | 6 ++---- tools/elf2efi.py | 2 +- 9 files changed, 31 insertions(+), 24 deletions(-) create mode 100644 .pylintrc diff --git a/.pylintrc b/.pylintrc new file mode 100644 index 00000000000..afd811a1548 --- /dev/null +++ b/.pylintrc @@ -0,0 +1,23 @@ +[MAIN] +extension-pkg-allow-list=lxml + +[MESSAGES CONTROL] +disable=fixme, + invalid-name, + line-too-long, + missing-class-docstring, + missing-docstring, + missing-function-docstring, + missing-module-docstring, + too-few-public-methods, + too-many-arguments, + too-many-boolean-expressions, + too-many-branches, + too-many-instance-attributes, + too-many-instance-attributes, + too-many-lines, + too-many-locals, + too-many-public-methods, + too-many-return-statements, + too-many-statements, + unspecified-encoding, diff --git a/src/kernel-install/60-ukify.install.in b/src/kernel-install/60-ukify.install.in index ecef36b3249..e5d68f37c0a 100755 --- a/src/kernel-install/60-ukify.install.in +++ b/src/kernel-install/60-ukify.install.in @@ -17,10 +17,7 @@ # You should have received a copy of the GNU Lesser General Public License # along with systemd; If not, see . -# pylint: disable=missing-docstring,invalid-name,import-outside-toplevel -# pylint: disable=consider-using-with,unspecified-encoding,line-too-long -# pylint: disable=too-many-locals,too-many-statements,too-many-return-statements -# pylint: disable=too-many-branches,redefined-builtin,fixme +# pylint: disable=import-outside-toplevel,consider-using-with,disable=redefined-builtin import argparse import os diff --git a/src/ukify/test/test_ukify.py b/src/ukify/test/test_ukify.py index 9a07f3397c4..c83435ec184 100755 --- a/src/ukify/test/test_ukify.py +++ b/src/ukify/test/test_ukify.py @@ -1,10 +1,9 @@ #!/usr/bin/env python3 # SPDX-License-Identifier: LGPL-2.1-or-later -# pylint: disable=missing-docstring,redefined-outer-name,invalid-name # pylint: disable=unused-import,import-outside-toplevel,useless-else-on-loop # pylint: disable=consider-using-with,wrong-import-position,unspecified-encoding -# pylint: disable=protected-access +# pylint: disable=protected-access,redefined-outer-name import base64 import json diff --git a/src/ukify/ukify.py b/src/ukify/ukify.py index cf7db49bdd1..0ddf56ae5e2 100755 --- a/src/ukify/ukify.py +++ b/src/ukify/ukify.py @@ -16,12 +16,8 @@ # You should have received a copy of the GNU Lesser General Public License # along with systemd; If not, see . -# pylint: disable=missing-docstring,invalid-name,import-outside-toplevel -# pylint: disable=consider-using-with,unspecified-encoding,line-too-long -# pylint: disable=too-many-locals,too-many-statements,too-many-return-statements -# pylint: disable=too-many-branches,too-many-lines,too-many-instance-attributes -# pylint: disable=too-many-arguments,unnecessary-lambda-assignment,fixme -# pylint: disable=unused-argument +# pylint: disable=import-outside-toplevel,consider-using-with,unused-argument +# pylint: disable=unnecessary-lambda-assignment import argparse import configparser diff --git a/test/test-exec-deserialization.py b/test/test-exec-deserialization.py index 7fbf9a4d171..f8f3a6d272a 100755 --- a/test/test-exec-deserialization.py +++ b/test/test-exec-deserialization.py @@ -1,8 +1,5 @@ #!/usr/bin/env python3 # SPDX-License-Identifier: LGPL-2.1-or-later -# pylint: disable=line-too-long,too-many-lines,too-many-branches,too-many-statements,too-many-arguments -# pylint: disable=too-many-public-methods,too-many-boolean-expressions,invalid-name,no-self-use -# pylint: disable=missing-function-docstring,missing-class-docstring,missing-module-docstring # # Copyright © 2017 Michal Sekletar diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py index 7f922b46f6c..07afe354f79 100755 --- a/test/test-network/systemd-networkd-tests.py +++ b/test/test-network/systemd-networkd-tests.py @@ -1,8 +1,5 @@ #!/usr/bin/env python3 # SPDX-License-Identifier: LGPL-2.1-or-later -# pylint: disable=line-too-long,too-many-lines,too-many-branches,too-many-statements,too-many-arguments -# pylint: disable=too-many-public-methods,too-many-boolean-expressions,invalid-name -# pylint: disable=missing-function-docstring,missing-class-docstring,missing-module-docstring # systemd-networkd tests # These tests can be executed in the systemd mkosi image when booted in QEMU. After booting the QEMU VM, diff --git a/test/test-shutdown.py b/test/test-shutdown.py index 700e77a15db..5339afcdd09 100755 --- a/test/test-shutdown.py +++ b/test/test-shutdown.py @@ -1,6 +1,6 @@ #!/usr/bin/python3 # SPDX-License-Identifier: LGPL-2.1-or-later -# pylint: disable=line-too-long,invalid-name,missing-module-docstring,missing-function-docstring,too-many-statements,broad-except +# pylint: disable=broad-except import argparse import logging diff --git a/test/test-udev.py b/test/test-udev.py index 02383ce4e9b..5a95b9c5213 100755 --- a/test/test-udev.py +++ b/test/test-udev.py @@ -1,10 +1,8 @@ #!/usr/bin/env python3 # SPDX-License-Identifier: LGPL-2.1-or-later -# pylint: disable=missing-docstring,redefined-outer-name,invalid-name -# pylint: disable=unspecified-encoding,no-else-return,line-too-long,too-many-lines -# pylint: disable=multiple-imports,too-many-instance-attributes,consider-using-with -# pylint: disable=global-statement +# pylint: disable=redefined-outer-name,no-else-return,multiple-imports +# pylint: disable=consider-using-with,global-statement # udev test # diff --git a/tools/elf2efi.py b/tools/elf2efi.py index 2e478940f5c..c683c120762 100755 --- a/tools/elf2efi.py +++ b/tools/elf2efi.py @@ -19,7 +19,7 @@ # the resulting binary useless. gnu-efi relies on this method and contains a stub that performs the # ELF dynamic relocations at runtime. -# pylint: disable=missing-docstring,invalid-name,attribute-defined-outside-init +# pylint: disable=attribute-defined-outside-init import argparse import hashlib