From 1372d0dd1c103077c53eb1977090c3065cac1992 Mon Sep 17 00:00:00 2001 From: Ian Cordasco Date: Thu, 7 Jul 2016 17:39:02 -0500 Subject: [PATCH] Handle kwargs passed to get_style_guide --- src/flake8/api/legacy.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/flake8/api/legacy.py b/src/flake8/api/legacy.py index 42e83c3..35c7101 100644 --- a/src/flake8/api/legacy.py +++ b/src/flake8/api/legacy.py @@ -1,14 +1,24 @@ """Module containing shims around Flake8 2.0 behaviour.""" +import logging import os.path from flake8.formatting import base as formatter from flake8.main import application as app +LOG = logging.getLogger(__name__) + def get_style_guide(**kwargs): """Stub out the only function I'm aware of people using.""" application = app.Application() 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)