diff options
author | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2021-12-19 18:29:43 +0100 |
---|---|---|
committer | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2021-12-19 20:25:14 +0100 |
commit | 1aca7a949182a276ddf094e29f5c2ba7a96a519f (patch) | |
tree | af8aa891b6678580d8bc4c3ef309bb4bad456b57 | |
parent | f15c9203015148df16c1e5af6cbeb81545dd6b0f (diff) | |
download | pylint-git-1aca7a949182a276ddf094e29f5c2ba7a96a519f.tar.gz |
Ignore file that starts like emacs's file lock
Closes #367
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | doc/whatsnew/2.13.rst | 7 | ||||
-rw-r--r-- | pylint/lint/expand_modules.py | 3 | ||||
-rw-r--r-- | tests/functional/e/.#emacs_file_lock.py | 4 |
4 files changed, 19 insertions, 1 deletions
@@ -30,6 +30,12 @@ Release date: TBA Closes #5499 +* pylint do not take into account files starting with ``.#`` anymore. Those are + considered `emacs file lock`. See + https://www.gnu.org/software/emacs/manual/html_node/elisp/File-Locks.html. + + Closes #367 + * ``used-before-assignment`` now assumes that assignments in except blocks may not have occurred and warns accordingly. diff --git a/doc/whatsnew/2.13.rst b/doc/whatsnew/2.13.rst index 357f78b59..18e417ce0 100644 --- a/doc/whatsnew/2.13.rst +++ b/doc/whatsnew/2.13.rst @@ -32,6 +32,13 @@ Extensions Other Changes ============= +* pylint do not take into account files starting with ``.#`` anymore. Those are + considered `emacs file lock`_. + + Closes #367 + +.. _`emacs file lock`: https://www.gnu.org/software/emacs/manual/html_node/elisp/File-Locks.html + * Fixed extremely long processing of long lines with comma's. Closes #5483 diff --git a/pylint/lint/expand_modules.py b/pylint/lint/expand_modules.py index 7a0dc7004..e0395704e 100644 --- a/pylint/lint/expand_modules.py +++ b/pylint/lint/expand_modules.py @@ -48,11 +48,12 @@ def expand_modules( result: List[ModuleDescriptionDict] = [] errors: List[ErrorDescriptionDict] = [] path = sys.path.copy() - for something in files_or_modules: basename = os.path.basename(something) if ( basename in ignore_list + # Emacs file locks see #367 + or basename.startswith(".#") or _is_in_ignore_list_re(os.path.basename(something), ignore_list_re) or _is_in_ignore_list_re(something, ignore_list_paths_re) ): diff --git a/tests/functional/e/.#emacs_file_lock.py b/tests/functional/e/.#emacs_file_lock.py new file mode 100644 index 000000000..ff23907a9 --- /dev/null +++ b/tests/functional/e/.#emacs_file_lock.py @@ -0,0 +1,4 @@ +# There is no module docstring, but we should not analyse this file +# Because it starts like an emacs file lock +# https://www.gnu.org/software/emacs/manual/html_node/elisp/File-Locks.html +# See #367 |