From dfad3c5064fdbc171ac64a0d11083c8edb83f815 Mon Sep 17 00:00:00 2001 From: Jan Pazdziora Date: Thu, 18 Apr 2019 15:04:44 +0200 Subject: [PATCH] Fix pylint errors. Addressing ************* Module swidtags lib/dnf-plugins/swidtags.py:166:4: E1200: Unsupported logging format character 'p' (0x70) at index 33 (logging-unsupported-format) lib/dnf-plugins/swidtags.py:249:50: E0602: Undefined variable 'file' (undefined-variable) ************* Module swidq lib/swidq/__init__.py:34:1: E0101: Explicit return in __init__ (return-in-init) --- MANIFEST.in | 2 +- Makefile | 3 +++ bdist_rpm/install_script | 2 +- lib/dnf-plugins/swidtags.py | 4 ++-- lib/swidq/__init__.py | 2 +- setup.cfg | 2 +- 6 files changed, 9 insertions(+), 6 deletions(-) diff --git a/MANIFEST.in b/MANIFEST.in index 6ce35db..f64a89b 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,2 +1,2 @@ -include test.sh LICENSE +include test.sh LICENSE Makefile recursive-include tests * diff --git a/Makefile b/Makefile index 240ee58..638ec52 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,9 @@ spec: test: ./test.sh +test-pylint: + pylint-3 -E lib/*/*.py setup.py + clean: rm -rf $(shell cat .gitignore) diff --git a/bdist_rpm/install_script b/bdist_rpm/install_script index 57b3eed..4ee64cf 100644 --- a/bdist_rpm/install_script +++ b/bdist_rpm/install_script @@ -3,7 +3,7 @@ python3 setup.py install --single-version-externally-managed -O1 --root=$RPM_BUI sed -i 's#^/etc#%config(noreplace) /etc#' INSTALLED_FILES %check -./test.sh +make test-pylint test %post diff --git a/lib/dnf-plugins/swidtags.py b/lib/dnf-plugins/swidtags.py index 6d735f3..38bc5b1 100644 --- a/lib/dnf-plugins/swidtags.py +++ b/lib/dnf-plugins/swidtags.py @@ -163,7 +163,7 @@ def transaction(self): remove_packages = {} for p in self.remove_set: if p not in self.remove_set_checksum: - logger.warning("Could not identify checksum for %p, potential SWID tag will not be removed", p) + logger.warning("Could not identify checksum for %s, potential SWID tag will not be removed", p) continue remove_packages[self.remove_set_checksum[p]] = True if len(remove_packages) > 0: @@ -246,7 +246,7 @@ def purge_generated_dir(self): unlink(path.join(self.dir_generated, f)) count += 1 except OSError as e: - logger.warning("Failed to remove [%s]: %s" % (file, e)) + logger.warning("Failed to remove [%s]: %s" % (f, e)) try: rmdir(self.dir_generated) except OSError: diff --git a/lib/swidq/__init__.py b/lib/swidq/__init__.py index ebb1c93..fcc16c9 100644 --- a/lib/swidq/__init__.py +++ b/lib/swidq/__init__.py @@ -35,7 +35,7 @@ def __init__(self, file=None, copy_from=None): if copy_from: self.__dict__ = deepcopy(copy_from.__dict__) else: - return self._load_from_file( file) + self._load_from_file( file) def _load_from_file(self, file): self.path = file diff --git a/setup.cfg b/setup.cfg index 261f832..c158232 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [bdist_rpm] requires = python3-rpm python3-lxml dnf-plugins-core xmlsec1-openssl -build_requires = python3 python3-setuptools python3-rpm python3-lxml openssl xmlsec1-openssl createrepo_c fakechroot fakeroot dnf dnf-plugins-core gzip gnupg2 +build_requires = python3 python3-setuptools python3-rpm python3-lxml openssl xmlsec1-openssl createrepo_c fakechroot fakeroot dnf dnf-plugins-core gzip gnupg2 python3-pylint release = 1%%{dist} obsoletes = dnf-plugin-swidtags swid-tools