Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit147846c

Browse files
committed
Fix lint
1 parent22d9288 commit147846c

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

‎pymode/lint.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ def code_check():
1616
frompylama.mainimportparse_options
1717
frompylama.tasksimportcheck_path
1818

19+
ifnotenv.curbuf.name:
20+
env.stop()
21+
returnFalse
22+
1923
options=parse_options(
2024
ignore=env.var('g:pymode_lint_ignore'),
2125
select=env.var('g:pymode_lint_select'),
@@ -36,7 +40,7 @@ def code_check():
3640
LOGGER.setLevel(logging.DEBUG)
3741

3842
withsilence_stderr():
39-
errors=check_path(path,options=options,code=env.source)
43+
errors=check_path(path,options=options,code='\n'.join(env.curbuf))
4044

4145
env.debug("Find errors: ",len(errors))
4246
sort_rules=env.var('g:pymode_lint_sort')

‎t/lint.vim

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,17 @@ describe 'pymode check code'
1414
Expectg:pymode_lint==1
1515
end
1616

17+
it'lint code'
18+
put=['# coding: utf-8','call_unknown_function()']
19+
PymodeLint
20+
Expectgetloclist(0)== []
21+
end
22+
23+
it'lint code'
24+
et/test.py
25+
PymodeLint
26+
Expectgetloclist(0)== [{'lnum':6,'bufnr':1,'col':0,'valid':1,'vcol':0,'nr':0,'type':'E','pattern':'','text':'W0612 local variable "unused" is assigned to but never used [pyflakes]'}, {'lnum':8,'bufnr':1,'col':0,'valid':1,'vcol':0,'nr':0,'type':'E','pattern':'','text':'E0602 undefined name "unknown" [pyflakes]'}]
27+
end
28+
1729
end
1830

‎t/test.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env python
2+
# coding: utf-8
3+
4+
5+
defmain():
6+
unused=1
7+
8+
unknown()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp