summaryrefslogtreecommitdiff
path: root/.pylintrc
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2021-08-31 09:37:14 -0700
committerEli Schwartz <eschwartz93@gmail.com>2021-08-31 16:28:54 -0400
commit278942a44703aff6b643426b09a9012460719622 (patch)
tree5019a9ba34a83ad5cef34efc8325955f05b9cef3 /.pylintrc
parent1fc3d8608d9d278c9faf8ccf6aecf33cc7e92c26 (diff)
downloadmeson-278942a44703aff6b643426b09a9012460719622.tar.gz
pylint: enable consider-iterating-dictionary
This didn't actually catch what it's supposed to, which is cases of: ```python for x in dict.keys(): y = dict[x] ``` But it did catch one unnecessary use of keys(), and one case where we were doing something in an inefficient way. I've rewritten: ```python if name.value in [x.value for x in self.kwargs.keys() if isinstance(x, IdNode)]: ``` as ``python if any((isinstance(x, IdNode) and name.value == x.value) for x in self.kwargs): ``` Which avoids doing two iterations, one to build the list, and a second to do a search for name.value in said list, which does a single short circuiting walk, as any returns as soon as one check returns True.
Diffstat (limited to '.pylintrc')
-rw-r--r--.pylintrc1
1 files changed, 1 insertions, 0 deletions
diff --git a/.pylintrc b/.pylintrc
index 31ac9259b..423066a38 100644
--- a/.pylintrc
+++ b/.pylintrc
@@ -12,6 +12,7 @@ enable=
bad-indentation,
bare-except,
compare-to-zero,
+ consider-iterating-dictionary,
dangerous-default-value,
deprecated-lambda,
len-as-condition,