summaryrefslogtreecommitdiff
path: root/src/flake8/api
diff options
context:
space:
mode:
authorIan Cordasco <graffatcolmingov@gmail.com>2016-07-14 07:45:03 -0500
committerIan Cordasco <graffatcolmingov@gmail.com>2016-07-14 07:45:08 -0500
commitdc05fce516e7de8153e69a8c3e648c1ce03b890a (patch)
tree78d3b655bf9d660c6d5d997bf77f8e1b5e8180c2 /src/flake8/api
parent4d6929c8ab45ca8116e36ad63d3fb6a55b1177b5 (diff)
downloadflake8-dc05fce516e7de8153e69a8c3e648c1ce03b890a.tar.gz
Run the individual methods in Application#initialize
We need to initialize part of the Application so we can set options passed by the user, but we also want to delay making things, e.g., - Formatter - Style Guide - etc. Until we have the options solidified so we don't have to do annoying things.
Diffstat (limited to 'src/flake8/api')
-rw-r--r--src/flake8/api/legacy.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/flake8/api/legacy.py b/src/flake8/api/legacy.py
index 9fc05bb..883f0f6 100644
--- a/src/flake8/api/legacy.py
+++ b/src/flake8/api/legacy.py
@@ -11,7 +11,12 @@ 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([])
+ application.find_plugins()
+ application.register_plugin_options()
+ application.parse_configuration_and_cli([])
+ # We basically want application.initialize to be called but with these
+ # options set instead before we make our formatter, notifier, internal
+ # style guide and file checker manager.
options = application.options
for key, value in kwargs.items():
try:
@@ -19,6 +24,10 @@ def get_style_guide(**kwargs):
setattr(options, key, value)
except AttributeError:
LOG.error('Could not update option "%s"', key)
+ application.make_formatter()
+ application.make_notifier()
+ application.make_guide()
+ application.make_file_checker_manager()
return StyleGuide(application)