Skip to content

Commit

Permalink
Fix pycodestyle iterable options (#220)
Browse files Browse the repository at this point in the history
* Fix pycodestyle iterable options

* Typo

* Typo
  • Loading branch information
gatesn authored Jan 14, 2018
1 parent 85907d6 commit 166967b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pyls/language_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def initialize(self, root_uri, init_opts, process_id):
pass

def m_initialize(self, **kwargs):
log.debug("Language server intialized with %s", kwargs)
log.debug("Language server initialized with %s", kwargs)
if 'rootUri' in kwargs:
self.root_uri = kwargs['rootUri']
elif 'rootPath' in kwargs:
Expand Down
9 changes: 5 additions & 4 deletions pyls/plugins/pycodestyle_lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ def pyls_lint(config, document):
log.debug("Got pycodestyle settings: %s", settings)

opts = {
'exclude': settings.get('exclude'),
'filename': settings.get('filename'),
'exclude': ','.join(settings.get('exclude') or []),
'filename': ','.join(settings.get('filename') or []),
'hang_closing': settings.get('hangClosing'),
'ignore': settings.get('ignore'),
'ignore': ','.join(settings.get('ignore') or []),
'max_line_length': settings.get('maxLineLength'),
'select': settings.get('select'),
'select': ','.join(settings.get('select') or []),
}

styleguide = pycodestyle.StyleGuide({k: v for k, v in opts.items() if v is not None})
Expand All @@ -27,6 +27,7 @@ def pyls_lint(config, document):
)
c.check_all()
diagnostics = c.report.diagnostics

return diagnostics


Expand Down
7 changes: 6 additions & 1 deletion test/plugins/test_pycodestyle_lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,9 @@ def test_pycodestyle_config(workspace):
# And make sure we only get one warning
diags = pycodestyle_lint.pyls_lint(config, doc)
assert not [d for d in diags if d['code'] == 'W191']
assert [d for d in diags if d['code'] == 'W391']

# Ignore both warnings
config.update({'plugins': {'pycodestyle': {'ignore': ['W191', 'W391']}}})
# And make sure we get neither
assert not [d for d in diags if d['code'] == 'W191']
assert not [d for d in diags if d['code'] == 'W391']

0 comments on commit 166967b

Please sign in to comment.