| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
List comprehensions in python 2 do not have scope. If the local scope is
skipped, then generated variables values will raise a false-positive.
Close #1897
|
|
|
|
| |
Close #1824
|
|
|
|
|
| |
`__doc__` can be used to specify a docstring for a module without
passing it as a first-statement string.
|
| |
|
| |
|
| |
|
|
|
|
|
| |
methods. (#1641)
Close #1267
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
longer.
If a name of an external object was being redefined in another scope, as in the following example, then pylint would have complained about the external object not being used any longer.
from a import b # this gets an unused variable warning.
class A:
b = b[0]
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
If a name is locally assigned and there is another global name with the same variable, this can result in an UnboundLocalError, as seen in the following example:
x = 24
def test(a):
if x == a:
for x in [1, 2, 3]:
print(x)
test(24)
In this case, we should emit an ``used-before-assignment`` message. Closes #1081
|
|
|
|
|
|
|
|
|
| |
If a single statement function has a particular variable and the statement
is on the same line as the function definition, then we were going to emit
used-before-assignment for that particular value. This was wrong, since
the variable was used after the definition.
Part of #1135
|
|
|
|
|
| |
This check is emitted when pylint encounters constructs which were used to emulate ternary statement before it was introduced in Python 2.5.
Close #1204
|
|
|
|
|
| |
Closes #1177
|
|
|
| |
Close #1190
|
|
|
|
| |
Closes #919
|
| |
|
|
|
|
|
|
| |
implementations
Closes #1032 and #1034
|
|
|
|
|
|
| |
unused-argument check
Close #1086
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
except branch with NameError as a handler
Until now, we weren't emitting a warning in the case of a variable being
referenced before actual definition, with the variable access being placed
inside a TryExcept, with an except handler that caught NameError, Exception and BaseException.
While for NameError it makes sense, since it is explicit that the user is expecting
a variable to not be defined, it does not make that much sense for the rest of
the exceptions, even if they are supertypes of NameError anyway. This is because
it is not explicit and we cannot infer what the user intended to do anyway.
We are now only handling NameError.
Close #1080
|
|
|
|
|
|
|
|
|
| |
Allow underscores in unused-variables
Pylint should ignore dummy variables that contain underscores. This test
demonstrates that the default value for dummy-variables-rgx fails in
this regard.
Closes #1058
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
This was changed automatically in #894, but apparently
we need to have the copyright notice somewhere.
|
|
|
|
| |
Closes #999
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
unused-variable check.
This option was used for ignoring arguments when computing the correct number of arguments
a function should have, but for handling the arguments with regard
to unused-variable check, dummy-variables-rgx was used instead. Now, ignored-argument-names
is used for its original purpose and also for ignoring the matched arguments for
the unused-variable check. This offers a better control of what should be ignored
and how.
Also, the same option was moved from the design checker to the variables checker,
which means that the option now appears under the ``[VARIABLES]`` section inside
the configuration file.
Close #862.
|
| |
|
| |
|
|
|
|
| |
updated dummy-variables-rgx. Close #899
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
variable.
The problem originates from the fact that we do not have fully qualified name
of the imports in scope locals, but only the top most one. As such, we retrieve
the full name from the node itself or the alias if there is any.
There could be a possibility of this change to emit the message about a wrong
variable when multiple imports from the same package are on the same line,
but this isn't a concern, since according to best practices, the imports
should be on different lines (so accessing the first item of the node
is by design)
Close #923.
|
|
|
|
| |
behaviour before changing it to a function per stmt).
|
| |
|
|
|
|
| |
it into another smaller function
|
|
|
|
|
|
|
|
|
| |
model changes
One change was to check for BaseInstance instead of Instance when looking if an instance
supports a given protocol. The latter is used for class instances, while the first one
can be used for builtins as well.
Also the global-variable-not-assigned code was simplified.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
default.
Until now, we warned with these errors when a fallback import block (a TryExcept block
that contained imports for Python 2 and 3) was found, but this gets cumbersome when
trying to write compatible code. As such, we don't check these blocks by default,
but the analysis can be enforced by using the new ``--analyse-fallback-block`` flag.
Close #769.
|
|
|
|
|
|
|
|
| |
* Split words that were inadvertently glued together
* Fix typos in the documentation
* Fix typos in message descriptions
|
|
|
|
|
|
|
| |
The option can be used for controlling the modules
which can redefine builtins, such as six.moves and future.builtins.
Close #464.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
There used to be a bug which involved astroid and extension modules,
where the elements of the __all__ declaration didn't have a parent set.
This problem was fixed though in astroid 2.0 and we can infer properly
these declarations with the parent being set. Unfortunately, we can't
rely on astroid 2.0 right now, so the solution for not having crashes
is to skip these elements in the undefined-all-variable pattern.
Close #846
|
| |
|
|
|
|
|
|
|
|
|
| |
When support for Python 3.5 was added, AsyncFunctionDef
wasn't handled properly in terms of FunctionDef, which meant
that most of the checks which involved a function were never
called for AsyncFunctionDef. This led to spurious false positives
which occurred when AsyncFunctionDef were analyzed.
Closes #767
|