aboutsummaryrefslogtreecommitdiff
path: root/.pylintrc
AgeCommit message (Collapse)AuthorFilesLines
2024-05-19pylint: ignore possibly/used-before-assignment as it is prone to FPEli Schwartz1-0/+3
It does no control flow analysis, and upgrading to pylint 3.2.0 produced many incorrect warnings. Also ignore contextmanager-generator-missing-cleanup for now. It has FP when there is no code after a yield (and thus no cleanup needs to be handled), which is what we do. Currently under discussion upstream: https://github.com/pylint-dev/pylint/issues/9625
2022-11-30pylint: enable the set_membership pluginDylan Baker1-0/+1
Which adds the `use-set-for-membership` check. It's generally faster in python to use a set with the `in` keyword, because it's a hash check instead of a linear walk, this is especially true with strings, where it's actually O(n^2), one loop over the container, and an inner loop of the strings (as string comparison works by checking that `a[n] == b[n]`, in a loop). Also, I'm tired of complaining about this in reviews, let the tools do it for me :)
2022-11-30pylint: enable simplifiable-if-statementDylan Baker1-1/+0
2022-11-30pylint: enable use-implicit-booleaness-not-comparisonDylan Baker1-1/+0
2022-11-29pylint: enable the bad_builtin checkerDylan Baker1-0/+2
This finds uses of deny-listed functions, which defaults to map and filter. These functions should be replaced by comprehensions in idiomatic python because: 1. comprehensions are more heavily optimized and are often faster 2. They avoid the need for lambdas in some cases, which make them faster 3. you can do the equivalent in one statement rather than two, which is faster 4. They're easier to read 5. if you need a concrete instance (ie, a list) then you don't have to convert the iterator to a list afterwards
2022-11-29pylint: enable useless-returnDylan Baker1-1/+0
2022-11-29pylint: enable used-before-assignmentDylan Baker1-1/+0
The one case of this was a false-positive, but what we were doing (checking locals()) is not idiomatic. I've replaced the call to `locals()` with the obvious `var: T.Optional[str] = None` with check instead.
2022-11-29pylint: enable implicit-str-concatDylan Baker1-1/+0
Which catches a very real bug. The zlib system dependency failed to work on MSVC since initial implementation in commit c1a3b37ab7e4ccf3a946ee4ba6da81a4c230ecc4 -- it looked for the wrong name.
2022-10-04pylint: enable consider-merging-isinstanceDylan Baker1-1/+0
2022-10-04pylint: enable use-a-generatorDylan Baker1-1/+0
This catches some optimization problems, mostly in the use of `all()` and `any()`. Basically writing `any([x == 5 for x in f])` vs `any(x == 5 for x in f)` reduces the performance because the entire concrete list must first be created, then iterated over, while in the second f is iterated and checked element by element.
2022-10-03pylint: enable unnecessary-lambdaDylan Baker1-1/+0
2022-10-03pylint: enable unnecessary-comprehensionDylan Baker1-1/+0
2022-10-03pylint: enable consider-using-(min|max)-builtinDylan Baker1-2/+0
There's only one case of each, in the same function, so I've handled both in the same commit.
2022-10-03pylint: enable unspecified-encodingDylan Baker1-1/+0
2022-10-03pylint: enable unnecessary-dunder-callDylan Baker1-1/+0
2022-09-22pylint: enable global-statementDylan Baker1-1/+0
This does force a number of uses of `# pylint: disable` comments, but it also finds a couple of useless global uses and one place (in the previous commit) that an easy refactor removes the use of global. Global is a code smell, so forcing adding a comment to disable helps force developers to really consider if what they're doing is a good idea.
2022-09-22pylint: enable global-variable-not-assignedDylan Baker1-1/+0
The `global` statement is only needed to assign to global variables, not read or mutate them. So calling `global.mutate()` is fine, but not `var = foo`, which would otherwise shadow `var`.
2022-09-19pylint: enable use-dict-literalDylan Baker1-1/+0
2022-09-19pylint: enable use-list-literalDylan Baker1-1/+0
2022-09-19pylint: enable consider-using-inDylan Baker1-1/+0
2022-09-19pylint: enable use-sequence-for-iterationDylan Baker1-1/+0
This found a couple of places where we *don't* want to use set(), and want to use list() instead.
2022-09-19pylint: enable use-maxsplit-argDylan Baker1-1/+0
This finds a bunch of places where we can do more efficient string splitting.
2022-09-19pylint: enable consider-using-dict-itemsDylan Baker1-1/+0
Which found a couple of places where we could write better code.
2022-09-19pylint: move from allow-list to deny-listDylan Baker1-25/+91
This makes it much easier to see what we're ignoring, as well as allowing pylint to enforce any lints that currently pass but aren't in the allow list automatically.
2021-09-24pylintrc: add function-redefinedDylan Baker1-0/+1
2021-09-24pylint: check for duplicate importsDylan Baker1-0/+1
I ran into one of these from LGTM, and it would be nice if pylint could warn me as part of my local development process instead of waiting for the CI to tell me.
2021-08-31pyllint: enable consider-user-enumerateDylan Baker1-0/+1
This caught a couple of cases of us doing: ```python for i in range(len(x)): v = x[i] ``` which are places to use enumerate instead. It also caught a couple of cases of: ```python assert len(x) == len(y) for i in range(len(x)): xv = x[i] yv = y[i] ``` Which should instead be using zip() ```python for xv, yv in zip(x, y): ... ```
2021-08-31pylint: turn on superfluous parens warningDylan Baker1-0/+1
Which is really useful for catching parens used with keywords like assert. Don't use parens with assert, it's bad.
2021-08-31pylint: enable consider-iterating-dictionaryDylan Baker1-0/+1
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.
2021-08-31pylint: enable unnecessary-not checkDylan Baker1-2/+3
This finds things like ```python if not x == 1: ``` which should be ```python if x != 1: ```
2020-11-04Bare exceptions are no longer allowed [NFC]Luke Drummond1-1/+2
The last instances of try: ... except: ... were removed in bf98ffca. The sideci.yml file was updated, but the flake8 config still allows this. Ensure that flake8 tests fail if this questionable construct appears again.
2020-09-22pylint: turn on a few more errorsDylan Baker1-0/+3
2020-09-22pylint: turn on bad-indentation errorDylan Baker1-0/+1
and fix all of the bad indentation
2020-09-22pylint: turn on warnings for abstract classesDylan Baker1-0/+1
We're using these now, so having some error checking to make sure we don't have paths were we're trying to instantiate an abstract class would be good.
2020-09-22pylint: Turn on warnings for incorrect number of argsDylan Baker1-1/+6
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.
2020-09-18pylint: Turn on a few more good warningsDylan Baker1-0/+4
2020-09-18pylint: Catch cases of `if len(container)` which should be replaced by `if ↵Dylan Baker1-1/+3
container` Unfortunately this doesn't catch other abuses of len(continauer) like, `len(container) <comparator> 0`, see: https://github.com/PyCQA/pylint/issues/3751
2019-08-02add pylint config file. update Sider CI nameMichael Hirsch, Ph.D1-0/+9