Skip to content

Commit b848f62

Browse files
committed
updated pymode/pyfiles files according to 2082d0b (various improvements)
1 parent c9f1c3e commit b848f62

File tree

2 files changed

+34
-24
lines changed

2 files changed

+34
-24
lines changed

pymode/__init__.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
""" Pymode support functions. """
1+
"""Pymode support functions."""
22

33
from __future__ import absolute_import
44

@@ -7,14 +7,18 @@
77

88

99
def auto():
10-
""" Fix PEP8 erorrs in current buffer. """
10+
"""Fix PEP8 erorrs in current buffer.
11+
12+
pymode: uses it in command PymodeLintAuto with pymode#lint#auto()
13+
14+
"""
1115
from .autopep8 import fix_file
1216

1317
class Options(object):
14-
aggressive = 2
18+
aggressive = 1
1519
diff = False
1620
experimental = True
17-
ignore = vim.eval('g:pymode_lint_ignore')
21+
ignore = vim.eval('g:pymode_lint_ignore').split(',')
1822
in_place = True
1923
indent_size = int(vim.eval('&tabstop'))
2024
line_range = None
@@ -28,7 +32,7 @@ class Options(object):
2832

2933

3034
def get_documentation():
31-
""" Search documentation and append to current buffer. """
35+
"""Search documentation and append to current buffer."""
3236
from ._compat import StringIO
3337

3438
sys.stdout, _ = StringIO(), sys.stdout

pymode/lint.py

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
pass
1616

1717

18-
def code_check(): # noqa
18+
def code_check():
1919
"""Run pylama and check current file.
2020
2121
:return bool:
@@ -24,32 +24,38 @@ def code_check(): # noqa
2424
with silence_stderr():
2525

2626
from pylama.core import run
27-
from pylama.main import parse_options
28-
from pylama.config import _override_options
27+
from pylama.config import parse_options
2928

3029
if not env.curbuf.name:
3130
return env.stop()
3231

32+
linters = env.var('g:pymode_lint_checkers')
33+
env.debug(linters)
34+
35+
# Fixed in v0.9.3: these two parameters may be passed as strings.
36+
# DEPRECATE: v:0.10.0: need to be set as lists.
37+
if isinstance(env.var('g:pymode_lint_ignore'), str):
38+
ignore = env.var('g:pymode_lint_ignore').split(',')
39+
else:
40+
ignore = env.var('g:pymode_lint_ignore')
41+
if isinstance(env.var('g:pymode_lint_select'), str):
42+
select = env.var('g:pymode_lint_select').split(',')
43+
else:
44+
select = env.var('g:pymode_lint_select')
3345
options = parse_options(
34-
force=1,
35-
ignore=env.var('g:pymode_lint_ignore'),
36-
select=env.var('g:pymode_lint_select'),
46+
linters=linters, force=1,
47+
ignore=ignore,
48+
select=select,
3749
)
38-
39-
linters = env.var('g:pymode_lint_checkers', default=[])
40-
if linters:
41-
_override_options(options, linters=",".join(linters))
42-
43-
for linter in dict(options.linters):
44-
opts = env.var('g:pymode_lint_options_%s' % linter, silence=True)
45-
if opts:
46-
options.linters_params[linter] = options.linters_params.get(linter, {})
47-
options.linters_params[linter].update(opts)
48-
49-
if 'pylint' in options.linters_params:
50-
options.linters_params['pylint']['clear_cache'] = True
5150
env.debug(options)
5251

52+
for linter in linters:
53+
opts = env.var('g:pymode_lint_options_%s' % linter, silence=True)
54+
if opts:
55+
options.linters_params[linter] = options.linters_params.get(
56+
linter, {})
57+
options.linters_params[linter].update(opts)
58+
5359
path = os.path.relpath(env.curbuf.name, env.curdir)
5460
env.debug("Start code check: ", path)
5561

0 commit comments

Comments
 (0)