diff options
author | Daniƫl van Noord <13665637+DanielNoord@users.noreply.github.com> | 2021-07-28 20:18:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-28 20:18:44 +0200 |
commit | a8b7dd7bffe343f00bcd6409534edcab530a4fc4 (patch) | |
tree | 5f1d6b315ca95634a9328eed70603cfcfbac4e1c /tests/functional/w | |
parent | c04f92ef68e5ea779a60bfddb91dc677c5470fd0 (diff) | |
download | pylint-git-a8b7dd7bffe343f00bcd6409534edcab530a4fc4.tar.gz |
Add unspecified-encoding checker #3826 (#4753)
* Add unspecified-encoding checker #3826
This adds an unspecified-encoding checker that adds a warning
whenever open() is called without an explicit encoding argument.
This closes #3826
* Update tests to conform to unspecified-encoding
With addition of the unspecified-encoding checker calls of open()
need an encoding argument.
Where necessary this argument has been added, or the message has been
disabled.
This also includes small linting changes to a small number
of tests. Their test-data has been updated to reflect new line numbers.
* Update scripts to conform to unspecified-encoding
With addition of the unspecified-encoding checker calls of open()
need an encoding argument.
Where necessary this argument has been added.
* Update pylint to conform to unspecified-encoding
With addition of the unspecified-encoding checker calls of open()
need an encoding argument.
Where necessary this argument has been added.
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Diffstat (limited to 'tests/functional/w')
-rw-r--r-- | tests/functional/w/with_used_before_assign.py | 7 | ||||
-rw-r--r-- | tests/functional/w/with_used_before_assign.txt | 4 |
2 files changed, 6 insertions, 5 deletions
diff --git a/tests/functional/w/with_used_before_assign.py b/tests/functional/w/with_used_before_assign.py index 64a475af1..ebe7d3093 100644 --- a/tests/functional/w/with_used_before_assign.py +++ b/tests/functional/w/with_used_before_assign.py @@ -1,11 +1,12 @@ -''' +""" Regression test for https://bitbucket.org/logilab/pylint/issue/128/attributeerror-when-parsing -''' +""" from __future__ import with_statement + def do_nothing(): """ empty """ - with open("") as ctx.obj: # [undefined-variable] + with open("", encoding="utf-8") as ctx.obj: # [undefined-variable] context.do() # [used-before-assignment] context = None diff --git a/tests/functional/w/with_used_before_assign.txt b/tests/functional/w/with_used_before_assign.txt index 4a98cec60..8e1fe1be8 100644 --- a/tests/functional/w/with_used_before_assign.txt +++ b/tests/functional/w/with_used_before_assign.txt @@ -1,2 +1,2 @@ -undefined-variable:9:21:do_nothing:Undefined variable 'ctx' -used-before-assignment:10:8:do_nothing:Using variable 'context' before assignment +undefined-variable:10:39:do_nothing:Undefined variable 'ctx' +used-before-assignment:11:8:do_nothing:Using variable 'context' before assignment |