diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2020-09-14 12:01:34 -0700 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2020-09-18 14:49:58 -0700 |
commit | cb0265a6b28e74e0a20fe247cad7e82c68f9412b (patch) | |
tree | 72ee86e72e64fdf45270c7d28af42034ea880660 | |
parent | 35a5a69355552be744dc7e1e21fee7182bafa99c (diff) | |
download | meson-cb0265a6b28e74e0a20fe247cad7e82c68f9412b.zip meson-cb0265a6b28e74e0a20fe247cad7e82c68f9412b.tar.gz meson-cb0265a6b28e74e0a20fe247cad7e82c68f9412b.tar.bz2 |
pylint: Catch cases of `if len(container)` which should be replaced by `if container`
Unfortunately this doesn't catch other abuses of len(continauer) like,
`len(container) <comparator> 0`, see: https://github.com/PyCQA/pylint/issues/3751
-rw-r--r-- | .pylintrc | 4 | ||||
-rw-r--r-- | mesonbuild/backend/ninjabackend.py | 2 | ||||
-rw-r--r-- | mesonbuild/build.py | 2 |
3 files changed, 5 insertions, 3 deletions
@@ -6,4 +6,6 @@ score=no [MESSAGES CONTROL] disable=all -enable=unreachable
\ No newline at end of file +enable= + len-as-condition, + unreachable diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index e21da29..66fc464 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -2587,7 +2587,7 @@ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47485''')) def get_link_whole_args(self, linker, target): target_args = self.build_target_link_arguments(linker, target.link_whole_targets) - return linker.get_link_whole_for(target_args) if len(target_args) else [] + return linker.get_link_whole_for(target_args) if target_args else [] @lru_cache(maxsize=None) def guess_library_absolute_path(self, linker, libname, search_dirs, patterns): diff --git a/mesonbuild/build.py b/mesonbuild/build.py index f56e484..30fa77a 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -2232,7 +2232,7 @@ class CustomTarget(Target): def get_dep_outname(self, infilenames): if self.depfile is None: raise InvalidArguments('Tried to get depfile name for custom_target that does not have depfile defined.') - if len(infilenames): + if infilenames: plainname = os.path.basename(infilenames[0]) basename = os.path.splitext(plainname)[0] return self.depfile.replace('@BASENAME@', basename).replace('@PLAINNAME@', plainname) |