Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PymodeLint does not run on saving file #1103

Open
billthelizard opened this issue Sep 6, 2020 · 2 comments
Open

PymodeLint does not run on saving file #1103

billthelizard opened this issue Sep 6, 2020 · 2 comments

Comments

@billthelizard
Copy link

@billthelizard billthelizard commented Sep 6, 2020

Although I set g:pymode_lint_on_write, PymodeLint not run on save.

I installed pymode by vim-plug:

Plug 'python-mode/python-mode', { 'for': 'python', 'branch': 'develop' }

.vimrc config:

let g:pymode_run_bind = '<leader>x' " avoid conflict to jedi's replace
let g:pymode_lint_on_write = 1
let g:pymode_rope = 0 " avoid conflict to jedi's auto-completion

I tried:

  • clearing all caches by find . -type f -name '*.pyc' -delete; find . -type d -name '__pycache__' -delete
  • executing :PymodeLint on vim's command mode, it works
  • starting with option -u -u <path_to_pymode>/debugvimrc.vim`, it works (curiously)

System Information

  • OS: mac OSX Catalina 10.15.6

vim --version

VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Sep  6 2020 02:22:52)
macOS 版
適用済パッチ: 1-1600
Compiled by Homebrew
Huge 版 without GUI.  機能の一覧 有効(+)/無効(-)
+acl               -farsi             +mouse_sgr         +tag_binary
+arabic            +file_in_path      -mouse_sysmouse    -tag_old_static
+autocmd           +find_in_path      +mouse_urxvt       -tag_any_white
+autochdir         +float             +mouse_xterm       -tcl
-autoservername    +folding           +multi_byte        +termguicolors
-balloon_eval      -footer            +multi_lang        +terminal
+balloon_eval_term +fork()            -mzscheme          +terminfo
-browse            +gettext           +netbeans_intg     +termresponse
++builtin_terms    -hangul_input      +num64             +textobjects
+byte_offset       +iconv             +packages          +textprop
+channel           +insert_expand     +path_extra        +timers
+cindent           +ipv6              +perl              +title
-clientserver      +job               +persistent_undo   -toolbar
+clipboard         +jumplist          +popupwin          +user_commands
+cmdline_compl     +keymap            +postscript        +vartabs
+cmdline_hist      +lambda            +printer           +vertsplit
+cmdline_info      +langmap           +profile           +virtualedit
+comments          +libcall           -python            +visual
+conceal           +linebreak         +python3           +visualextra
+cryptv            +lispindent        +quickfix          +viminfo
+cscope            +listcmds          +reltime           +vreplace
+cursorbind        +localmap          +rightleft         +wildignore
+cursorshape       +lua               +ruby              +wildmenu
+dialog_con        +menu              +scrollbind        +windows
+diff              +mksession         +signs             +writebackup
+digraphs          +modify_fname      +smartindent       -X11
-dnd               +mouse             -sound             -xfontset
-ebcdic            -mouseshape        +spell             -xim
+emacs_tags        +mouse_dec         +startuptime       -xpm
+eval              -mouse_gpm         +statusline        -xsmp
+ex_extra          -mouse_jsbterm     -sun_workshop      -xterm_clipboard
+extra_search      +mouse_netterm     +syntax            -xterm_save
      システム vimrc: "$VIM/vimrc"
      ユーザー vimrc: "$HOME/.vimrc"
   第2ユーザー vimrc: "~/.vim/vimrc"
       ユーザー exrc: "$HOME/.exrc"
  デフォルトファイル: "$VIMRUNTIME/defaults.vim"
       省略時の $VIM: "/usr/local/share/vim"
コンパイル: clang -c -I. -Iproto -DHAVE_CONFIG_H   -DMACOS_X -DMACOS_X_DARWIN  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1       
リンク: clang   -L. -fstack-protector-strong -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl@1.1/lib -L/usr/local/opt/readline/lib  -L/usr/local/lib -o vim        -lncurses -liconv -lintl -framework AppKit  -L/usr/local/opt/lua/lib -llua5.3 -mmacosx-version-min=10.15 -fstack-protector-strong -L/usr/local/lib  -L/usr/local/Cellar/perl/5.32.0/lib/perl5/5.32.0/darwin-thread-multi-2level/CORE -lperl -lm -lutil -lc  -L/usr/local/opt/python@3.8/Frameworks/Python.framework/Versions/3.8/lib/python3.8/config-3.8-darwin -lpython3.8 -framework CoreFoundation  -lruby.2.7     

python --version:

Python 3.8.3

result of :PymodePython import sys; print(sys.version_info):

sys.version_info(major=3, minor=8, micro=5, releaselevel='final', serial=0)

git status on python-mode direcgory:

On branch develop
Your branch is up to date with 'origin/develop'.

nothing to commit, working tree clean

debug message by vi -i NOTE -u ~/.vim/plugged/python-mode/debugvimrc.vim hoge.py:

-------------------------------------------------------------------------------
pymode debug msg 1: Starting debug on: 2020-09-06 14:32:32 with file /var/folders/3n/zrw31l650cnbf68syjpl85k00000gn/T/pymode_debug_file.txt
-------------------------------------------------------------------------------
pymode debug msg 2: Operating system: Darwin
-------------------------------------------------------------------------------
pymode debug msg 3: Scriptnames:
  1: ~/.vim/plugged/python-mode/debugvimrc.vim
  2: /usr/local/Cellar/vim/8.2.1600/share/vim/vim82/plugin/getscriptPlugin.vim
  3: /usr/local/Cellar/vim/8.2.1600/share/vim/vim82/plugin/gzip.vim
  4: /usr/local/Cellar/vim/8.2.1600/share/vim/vim82/plugin/logiPat.vim
  5: /usr/local/Cellar/vim/8.2.1600/share/vim/vim82/plugin/manpager.vim
  6: /usr/local/Cellar/vim/8.2.1600/share/vim/vim82/plugin/matchparen.vim
  7: /usr/local/Cellar/vim/8.2.1600/share/vim/vim82/plugin/netrwPlugin.vim
  8: /usr/local/Cellar/vim/8.2.1600/share/vim/vim82/plugin/rrhelper.vim
  9: /usr/local/Cellar/vim/8.2.1600/share/vim/vim82/plugin/spellfile.vim
 10: /usr/local/Cellar/vim/8.2.1600/share/vim/vim82/plugin/tarPlugin.vim
 11: /usr/local/Cellar/vim/8.2.1600/share/vim/vim82/plugin/tohtml.vim
 12: /usr/local/Cellar/vim/8.2.1600/share/vim/vim82/plugin/vimballPlugin.vim
 13: /usr/local/Cellar/vim/8.2.1600/share/vim/vim82/plugin/zipPlugin.vim
 14: ~/.vim/plugged/python-mode/plugin/pymode.vim
 15: ~/.vim/plugged/python-mode/autoload/pymode.vim
 16: /usr/local/Cellar/vim/8.2.1600/share/vim/vim82/filetype.vim
 17: /usr/local/Cellar/vim/8.2.1600/share/vim/vim82/ftplugin.vim
 18: /usr/local/Cellar/vim/8.2.1600/share/vim/vim82/ftplugin/python.vim
 19: ~/.vim/plugged/python-mode/ftplugin/python/pymode.vim
 20: ~/.vim/plugged/python-mode/autoload/pymode/virtualenv.vim
 21: ~/.vim/plugged/python-mode/autoload/pymode/breakpoint.vim
 22: ~/.vim/plugged/python-mode/autoload/pymode/debug.vim
-------------------------------------------------------------------------------
pymode debug msg 4: Pymode variables:
pymode                #1
pymode_breakpoint     #1
pymode_breakpoint_bind  <leader>b
pymode_breakpoint_cmd  breakpoint()
pymode_debug          #1
pymode_debug_counter  #3
pymode_debug_tempfile  /var/folders/3n/zrw31l650cnbf68syjpl85k00000gn/T/pymode_debug_file.txt
pymode_doc            #1
pymode_doc_bind        K
pymode_doc_vertical   #0
pymode_folding        #0
pymode_folding_nest_limit #1000
pymode_folding_regex   ^\s*\%(class\|def\|async\s\+def\) .\+\(:\s\+\w\)\@!
pymode_indent         #1
pymode_init           #1
pymode_lint           #1
pymode_lint_async     #1
pymode_lint_async_updatetime #1000
pymode_lint_checkers  ['pyflakes', 'pep8', 'mccabe']
pymode_lint_comment_symbol  CC
pymode_lint_cwindow   #1
pymode_lint_docs_symbol  DD
pymode_lint_error_symbol  EE
pymode_lint_ignore    []
pymode_lint_info_symbol  II
pymode_lint_message   #1
pymode_lint_on_fly    #0
pymode_lint_on_write  #1
pymode_lint_options_mccabe {'complexity': 12}
pymode_lint_options_pep257 {}
pymode_lint_options_pep8 {'max_line_length': 79}
pymode_lint_options_pyflakes {'builtins': '_'}
pymode_lint_options_pylint {'max-line-length': 79}
pymode_lint_pyflakes_symbol  FF
pymode_lint_select    []
pymode_lint_signs     #1
pymode_lint_sort      []
pymode_lint_todo_symbol  WW
pymode_lint_unmodified #0
pymode_lint_visual_symbol  RR
pymode_motion         #1
pymode_options        #1
pymode_options_colorcolumn #1
pymode_options_max_line_length #79
pymode_paths          []
pymode_preview_height #12
pymode_preview_position  botright
pymode_python          python3
pymode_quickfix_maxheight #6
pymode_quickfix_minheight #3
pymode_rope           #0
pymode_run            #1
pymode_run_bind        <leader>r
pymode_trim_whitespaces #1
pymode_version         0.11.0
pymode_virtualenv     #1
pymode_virtualenv_enabled  
pymode_virtualenv_path  
pymode_warning        #1
-------------------------------------------------------------------------------
pymode debug msg 5: Git commit: 
295e84d9dd7f4887f8a5635e9dfe88dfeabaf00c
-------------------------------------------------------------------------------
pymode debug msg 6: Git submodule status:
 a672051f4406da0beb01e88767e8e46488eb71eb submodules/astroid (a672051)
 84cb34cad9b3e6fe520cb5b355eb52e6b6dd5758 submodules/autopep8 (84cb34c)
BufRead Autocommands for "*.py"..FileType Autocommands for "*"..function <SNR>17_LoadFTPlugin[17]..script /Users/nakamine/.vim/plugged/python-mode/ftplugin/python/pymode.vim の処理中にエラーが検出されました:
行  249:
割込まれました-- 挿入 --


E13: ファイルが存在します (! を追加で上書)

"hoge.py" 
"hoge.py" 27L, 331B 書込み
-------------------------------------------------------------------------------
pymode debug msg 7: check code
[Pymode] Code checking is running ...
1599370362 ['pyflakes', 'pep8', 'mccabe'] []
1599370362 Namespace(abspath=False, concurrent=False, file_params={}, force=True, format='pycodestyle', hook=False, ignore=[], linters=[('pyflakes', <pylama.lint.pylama_pyflakes.Linter object at 0x10eac1c70>), ('pep8', <pylama.lint.pylama_pycodestyle.Linter object at 0x10eac1880>), ('mccabe', <pylama.lint.pylama_mccabe.Linter object at 0x10eac1d60>)], linters_params={}, options=None, paths=['/Users/nakamine/learn/smart_python'], report=None, select=[], skip=[], sort=[], verbose=False) []
1599370362 Start code check:  [hoge.py]
Checking params: {'skip': False, 'ignore': set(), 'select': set(), 'linters': []}
Run pyflakes {'builtins': '_'}
Run pep8 {'max_line_length': '79'}
Run mccabe {'complexity': '12'}
1599370362 Find errors:  [1]
[Pymode] Found 0 error(s) and 1 warning(s)




-------------------------------------------------------------------------------
pymode debug msg 1: Starting debug on: 2020-09-06 14:32:57 with file /var/folders/3n/zrw31l650cnbf68syjpl85k00000gn/T/pymode_debug_file.txt
-------------------------------------------------------------------------------
pymode debug msg 2: Operating system: Darwin
-------------------------------------------------------------------------------
pymode debug msg 3: Scriptnames:
  1: ~/.vim/plugged/python-mode/debugvimrc.vim
  2: /usr/local/Cellar/vim/8.2.1600/share/vim/vim82/plugin/getscriptPlugin.vim
  3: /usr/local/Cellar/vim/8.2.1600/share/vim/vim82/plugin/gzip.vim
  4: /usr/local/Cellar/vim/8.2.1600/share/vim/vim82/plugin/logiPat.vim
  5: /usr/local/Cellar/vim/8.2.1600/share/vim/vim82/plugin/manpager.vim
  6: /usr/local/Cellar/vim/8.2.1600/share/vim/vim82/plugin/matchparen.vim
  7: /usr/local/Cellar/vim/8.2.1600/share/vim/vim82/plugin/netrwPlugin.vim
  8: /usr/local/Cellar/vim/8.2.1600/share/vim/vim82/plugin/rrhelper.vim
  9: /usr/local/Cellar/vim/8.2.1600/share/vim/vim82/plugin/spellfile.vim
 10: /usr/local/Cellar/vim/8.2.1600/share/vim/vim82/plugin/tarPlugin.vim
 11: /usr/local/Cellar/vim/8.2.1600/share/vim/vim82/plugin/tohtml.vim
 12: /usr/local/Cellar/vim/8.2.1600/share/vim/vim82/plugin/vimballPlugin.vim
 13: /usr/local/Cellar/vim/8.2.1600/share/vim/vim82/plugin/zipPlugin.vim
 14: ~/.vim/plugged/python-mode/plugin/pymode.vim
 15: ~/.vim/plugged/python-mode/autoload/pymode.vim
 16: /usr/local/Cellar/vim/8.2.1600/share/vim/vim82/filetype.vim
 17: /usr/local/Cellar/vim/8.2.1600/share/vim/vim82/ftplugin.vim
 18: /usr/local/Cellar/vim/8.2.1600/share/vim/vim82/ftplugin/python.vim
 19: ~/.vim/plugged/python-mode/ftplugin/python/pymode.vim
 20: ~/.vim/plugged/python-mode/autoload/pymode/virtualenv.vim
 21: ~/.vim/plugged/python-mode/autoload/pymode/breakpoint.vim
 22: ~/.vim/plugged/python-mode/autoload/pymode/debug.vim
-------------------------------------------------------------------------------
pymode debug msg 4: Pymode variables:
pymode                #1
pymode_breakpoint     #1
pymode_breakpoint_bind  <leader>b
pymode_breakpoint_cmd  breakpoint()
pymode_debug          #1
pymode_debug_counter  #3
pymode_debug_tempfile  /var/folders/3n/zrw31l650cnbf68syjpl85k00000gn/T/pymode_debug_file.txt
pymode_doc            #1
pymode_doc_bind        K
pymode_doc_vertical   #0
pymode_folding        #0
pymode_folding_nest_limit #1000
pymode_folding_regex   ^\s*\%(class\|def\|async\s\+def\) .\+\(:\s\+\w\)\@!
pymode_indent         #1
pymode_init           #1
pymode_lint           #1
pymode_lint_async     #1
pymode_lint_async_updatetime #1000
pymode_lint_checkers  ['pyflakes', 'pep8', 'mccabe']
pymode_lint_comment_symbol  CC
pymode_lint_cwindow   #1
pymode_lint_docs_symbol  DD
pymode_lint_error_symbol  EE
pymode_lint_ignore    []
pymode_lint_info_symbol  II
pymode_lint_message   #1
pymode_lint_on_fly    #0
pymode_lint_on_write  #1
pymode_lint_options_mccabe {'complexity': 12}
pymode_lint_options_pep257 {}
pymode_lint_options_pep8 {'max_line_length': 79}
pymode_lint_options_pyflakes {'builtins': '_'}
pymode_lint_options_pylint {'max-line-length': 79}
pymode_lint_pyflakes_symbol  FF
pymode_lint_select    []
pymode_lint_signs     #1
pymode_lint_sort      []
pymode_lint_todo_symbol  WW
pymode_lint_unmodified #0
pymode_lint_visual_symbol  RR
pymode_motion         #1
pymode_options        #1
pymode_options_colorcolumn #1
pymode_options_max_line_length #79
pymode_paths          []
pymode_preview_height #12
pymode_preview_position  botright
pymode_python          python3
pymode_quickfix_maxheight #6
pymode_quickfix_minheight #3
BufRead Autocommands for "*.py"..FileType Autocommands for "*"..function <SNR>17_LoadFTPlugin[17]..script /Users/nakamine/.vim/plugged/python-mode/ftplugin/python/pymode.vim の処理中にエラーが検出されました:
行  249:
割込まれました

E13: ファイルが存在します (! を追加で上書)

"hoge.py" 
"hoge.py" 26L, 330B 書込み
-------------------------------------------------------------------------------
pymode debug msg 5: check code
[Pymode] Code checking is running ...
1599370396 ['pyflakes', 'pep8', 'mccabe'] []
1599370396 Namespace(abspath=False, concurrent=False, file_params={}, force=True, format='pycodestyle', hook=False, ignore=[], linters=[('pyflakes', <pylama.lint.pylama_pyflakes.Linter object at 0x1015bac70>), ('pep8', <pylama.lint.pylama_pycodestyle.Linter object at 0x1015ba880>), ('mccabe', <pylama.lint.pylama_mccabe.Linter object at 0x1015bad60>)], linters_params={}, options=None, paths=['/Users/nakamine/learn/smart_python'], report=None, select=[], skip=[], sort=[], verbose=False) []
1599370396 Start code check:  [hoge.py]
Checking params: {'skip': False, 'ignore': set(), 'select': set(), 'linters': []}
Run pyflakes {'builtins': '_'}
Run pep8 {'max_line_length': '79'}
Run mccabe {'complexity': '12'}
1599370396 Find errors:  [2]
[Pymode] Found 0 error(s) and 2 warning(s)
[Pymode] E302 expected 2 blank lines, found 1 [pep8]
[Pymode] E302 expected 2 blank lines, found 1 [pep8]
[Pymode] W0611 'os' imported but unused [pyflakes]-- 挿入 --


"hoge.py" 
"hoge.py" 27L, 331B 書込み
-------------------------------------------------------------------------------
pymode debug msg 6: check code
[Pymode] Code checking is running ...
1599370403 ['pyflakes', 'pep8', 'mccabe'] []
1599370403 Namespace(abspath=False, concurrent=False, file_params={}, force=True, format='pycodestyle', hook=False, ignore=[], linters=[('pyflakes', <pylama.lint.pylama_pyflakes.Linter object at 0x1015bac70>), ('pep8', <pylama.lint.pylama_pycodestyle.Linter object at 0x1015ba880>), ('mccabe', <pylama.lint.pylama_mccabe.Linter object at 0x1015bad60>)], linters_params={}, options=None, paths=['/Users/nakamine/learn/smart_python'], report=None, select=[], skip=[], sort=[], verbose=False) []
1599370403 Start code check:  [hoge.py]
Checking params: {'skip': False, 'ignore': set(), 'select': set(), 'linters': []}
Run pyflakes {'builtins': '_'}
Run pep8 {'max_line_length': '79'}
Run mccabe {'complexity': '12'}
1599370403 Find errors:  [1]
[Pymode] Found 0 error(s) and 1 warning(s)

sample file hoge.py:

#!/usr/bin/env python

import os


class MyClass(object):

    def __int__(self):
        self._n = 0

    @property
    def n(self):
        return self._n

    @n.setter
    def n(self, value):
        self._n = value * 2


def main():
    obj = MyClass()
    obj.n = 100
    print(obj.n)


if __name__ == '__main__':
    main()
@billthelizard
Copy link
Author

@billthelizard billthelizard commented Sep 6, 2020

I checked value in code:
https://github.com/python-mode/python-mode/blob/develop/autoload/pymode.vim#L114

then I found b:pymode_modified is set to 0. (even if the file is modified)

@billthelizard
Copy link
Author

@billthelizard billthelizard commented Sep 6, 2020

currently I avoid this issue setting g:pymode_lint_unmodified.

" let g:pymode_lint_on_write = 1
let g:pymode_lint_unmodified = 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.