From 6afb53dd7d9157b73181f5505905d853f43c9816 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sun, 27 Mar 2022 22:34:22 +0300 Subject: [PATCH] PyLint fixes --- platformio/builder/main.py | 1 + platformio/commands/check/tools/clangtidy.py | 4 ++-- platformio/commands/check/tools/cppcheck.py | 4 ++-- platformio/commands/check/tools/pvsstudio.py | 2 +- platformio/package/lockfile.py | 4 +++- platformio/package/unpack.py | 4 ++-- 6 files changed, 11 insertions(+), 8 deletions(-) diff --git a/platformio/builder/main.py b/platformio/builder/main.py index 6384b08d..84d6ba9f 100644 --- a/platformio/builder/main.py +++ b/platformio/builder/main.py @@ -223,6 +223,7 @@ if "envdump" in COMMAND_LINE_TARGETS: env.Exit(0) if set(["_idedata", "idedata"]) & set(COMMAND_LINE_TARGETS): + projenv = None try: Import("projenv") except: # pylint: disable=bare-except diff --git a/platformio/commands/check/tools/clangtidy.py b/platformio/commands/check/tools/clangtidy.py index d6f99058..23ec3c57 100644 --- a/platformio/commands/check/tools/clangtidy.py +++ b/platformio/commands/check/tools/clangtidy.py @@ -21,7 +21,7 @@ from platformio.package.manager.core import get_core_package_dir class ClangtidyCheckTool(CheckToolBase): - def tool_output_filter(self, line): + def tool_output_filter(self, line): # pylint: disable=arguments-differ if not self.options.get("verbose") and "[clang-diagnostic-error]" in line: return "" @@ -34,7 +34,7 @@ class ClangtidyCheckTool(CheckToolBase): return "" - def parse_defect(self, raw_line): + def parse_defect(self, raw_line): # pylint: disable=arguments-differ match = re.match(r"^(.*):(\d+):(\d+):\s+([^:]+):\s(.+)\[([^]]+)\]$", raw_line) if not match: return raw_line diff --git a/platformio/commands/check/tools/cppcheck.py b/platformio/commands/check/tools/cppcheck.py index 99512d52..ec50d144 100644 --- a/platformio/commands/check/tools/cppcheck.py +++ b/platformio/commands/check/tools/cppcheck.py @@ -38,7 +38,7 @@ class CppcheckCheckTool(CheckToolBase): ] super(CppcheckCheckTool, self).__init__(*args, **kwargs) - def tool_output_filter(self, line): + def tool_output_filter(self, line): # pylint: disable=arguments-differ if ( not self.options.get("verbose") and "--suppress=unmatchedSuppression:" in line @@ -56,7 +56,7 @@ class CppcheckCheckTool(CheckToolBase): return line - def parse_defect(self, raw_line): + def parse_defect(self, raw_line): # pylint: disable=arguments-differ if self._field_delimiter not in raw_line: return None diff --git a/platformio/commands/check/tools/pvsstudio.py b/platformio/commands/check/tools/pvsstudio.py index a872c0af..4f5e0440 100644 --- a/platformio/commands/check/tools/pvsstudio.py +++ b/platformio/commands/check/tools/pvsstudio.py @@ -53,7 +53,7 @@ class PvsStudioCheckTool(CheckToolBase): # pylint: disable=too-many-instance-at ) ) - def tool_output_filter(self, line): + def tool_output_filter(self, line): # pylint: disable=arguments-differ if "license was not entered" in line.lower(): self._bad_input = True return line diff --git a/platformio/package/lockfile.py b/platformio/package/lockfile.py index 576cd0f5..296036aa 100644 --- a/platformio/package/lockfile.py +++ b/platformio/package/lockfile.py @@ -69,7 +69,9 @@ class LockFile(object): if LOCKFILE_CURRENT_INTERFACE == LOCKFILE_INTERFACE_FCNTL: fcntl.flock(self._fp.fileno(), fcntl.LOCK_EX | fcntl.LOCK_NB) elif LOCKFILE_CURRENT_INTERFACE == LOCKFILE_INTERFACE_MSVCRT: - msvcrt.locking(self._fp.fileno(), msvcrt.LK_NBLCK, 1) + msvcrt.locking( # pylint: disable=used-before-assignment + self._fp.fileno(), msvcrt.LK_NBLCK, 1 + ) except (BlockingIOError, IOError): self._fp.close() self._fp = None diff --git a/platformio/package/unpack.py b/platformio/package/unpack.py index f9e68ff8..ede07589 100644 --- a/platformio/package/unpack.py +++ b/platformio/package/unpack.py @@ -68,7 +68,7 @@ class TARArchiver(BaseArchiver): return item.name @staticmethod - def is_link(item): + def is_link(item): # pylint: disable=arguments-differ return item.islnk() or item.issym() @staticmethod @@ -119,7 +119,7 @@ class ZIPArchiver(BaseArchiver): ) @staticmethod - def is_link(_): + def is_link(_): # pylint: disable=arguments-differ return False def get_items(self):