diff options
author | Yilei "Dolee" Yang <yileiyang@google.com> | 2022-09-15 03:36:41 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-15 12:36:41 +0200 |
commit | a57edea63fa7a1edfcb63074f9e2a373ebabb7cd (patch) | |
tree | d7a18bd93116036518ddeed2a2253e72a2a7f5fc /pylint/lint | |
parent | 27925396c85ffc443243589a0c03e430de9d7fa5 (diff) | |
download | pylint-git-a57edea63fa7a1edfcb63074f9e2a373ebabb7cd.tar.gz |
Use stacklevel=2 in warnings.warn calls to DeprecationWarning where makes sense. (#7465)
Co-authored-by: Daniƫl van Noord <13665637+DanielNoord@users.noreply.github.com>
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
Diffstat (limited to 'pylint/lint')
-rw-r--r-- | pylint/lint/pylinter.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/pylint/lint/pylinter.py b/pylint/lint/pylinter.py index 121d0d7f8..f6385fa08 100644 --- a/pylint/lint/pylinter.py +++ b/pylint/lint/pylinter.py @@ -346,6 +346,7 @@ class PyLinter( warnings.warn( "The option_groups attribute has been deprecated and will be removed in pylint 3.0", DeprecationWarning, + stacklevel=2, ) return self._option_groups @@ -354,6 +355,7 @@ class PyLinter( warnings.warn( "The option_groups attribute has been deprecated and will be removed in pylint 3.0", DeprecationWarning, + stacklevel=2, ) self._option_groups = value @@ -650,6 +652,7 @@ class PyLinter( warnings.warn( "In pylint 3.0, the checkers check function will only accept sequence of string", DeprecationWarning, + stacklevel=2, ) files_or_modules = (files_or_modules,) # type: ignore[assignment] if self.config.recursive: @@ -721,6 +724,7 @@ class PyLinter( "In pylint 3.0, the checkers check_single_file function will be removed. " "Use check_single_file_item instead.", DeprecationWarning, + stacklevel=2, ) self.check_single_file_item(FileItem(name, filepath, modname)) @@ -903,6 +907,7 @@ class PyLinter( "If unknown it should be initialized as an empty string." ), DeprecationWarning, + stacklevel=2, ) self.current_name = modname self.current_file = filepath or modname |