From b034f8cf610d7c3d71fa536f2ec1669e7f2f3c7c Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Tue, 22 Sep 2020 09:35:17 -0700 Subject: [PATCH] pylint: Turn on warnings for incorrect number of args This catches some very real errors. The one in scalapack is pretty silly actually, it's failing to figure out that the exploded list is at least two arguments. However, the code is actually clearer by not using a list and exploding it, so I've done that and pylint is happy too. --- .pylintrc | 7 ++++++- mesonbuild/dependencies/scalapack.py | 8 ++++---- mesonbuild/minstall.py | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.pylintrc b/.pylintrc index c79b83ce7..560968ef0 100644 --- a/.pylintrc +++ b/.pylintrc @@ -8,8 +8,13 @@ score=no disable=all enable= assert-on-tuple, + compare-to-zero, dangerous-default-value, deprecated-lambda, - compare-to-zero, len-as-condition, + missing-kwoa, + no-value-for-parameter, + redundant-keyword-arg, + too-many-function-args, + unexpected-keyword-arg, unreachable diff --git a/mesonbuild/dependencies/scalapack.py b/mesonbuild/dependencies/scalapack.py index 8774746fc..0147e0b62 100644 --- a/mesonbuild/dependencies/scalapack.py +++ b/mesonbuild/dependencies/scalapack.py @@ -109,10 +109,10 @@ class MKLPkgConfigDependency(PkgConfigDependency): if self.clib_compiler.id == 'gcc': for i, a in enumerate(self.link_args): # only replace in filename, not in directory names - parts = list(os.path.split(a)) - if 'mkl_intel_lp64' in parts[-1]: - parts[-1] = parts[-1].replace('intel', 'gf') - self.link_args[i] = '/' + os.path.join(*parts) + dirname, basename = os.path.split(a) + if 'mkl_intel_lp64' in basename: + basename = basename.replace('intel', 'gf') + self.link_args[i] = '/' + os.path.join(dirname, basename) # MKL pkg-config omits scalapack # be sure "-L" and "-Wl" are first if present i = 0 diff --git a/mesonbuild/minstall.py b/mesonbuild/minstall.py index 7a562757f..0eaa54f96 100644 --- a/mesonbuild/minstall.py +++ b/mesonbuild/minstall.py @@ -483,7 +483,7 @@ class Installer: set_mode(outname, install_mode, d.install_umask) if should_strip and d.strip_bin is not None: if fname.endswith('.jar'): - self.log('Not stripping jar target:', os.path.basename(fname)) + self.log('Not stripping jar target: {}'.format(os.path.basename(fname))) continue self.log('Stripping target {!r} using {}.'.format(fname, d.strip_bin[0])) ps, stdo, stde = Popen_safe(d.strip_bin + [outname])