Handle kwargs passed to get_style_guide

This commit is contained in:
Ian Cordasco 2016-07-07 17:39:02 -05:00
parent a4ce229fb6
commit 1372d0dd1c
No known key found for this signature in database
GPG key ID: 656D3395E4A9791A

View file

@ -1,14 +1,24 @@
"""Module containing shims around Flake8 2.0 behaviour.""" """Module containing shims around Flake8 2.0 behaviour."""
import logging
import os.path import os.path
from flake8.formatting import base as formatter from flake8.formatting import base as formatter
from flake8.main import application as app from flake8.main import application as app
LOG = logging.getLogger(__name__)
def get_style_guide(**kwargs): def get_style_guide(**kwargs):
"""Stub out the only function I'm aware of people using.""" """Stub out the only function I'm aware of people using."""
application = app.Application() application = app.Application()
application.initialize([]) application.initialize([])
options = application.options
for key, value in kwargs.items():
try:
getattr(options, key)
setattr(options, key, value)
except AttributeError:
LOG.error('Could not update option "%s"', key)
return StyleGuide(application) return StyleGuide(application)