def get_style_guide(argv=None): # this is a fork of flake8.api.legacy.get_style_guide # to allow passing command line argument application = Application() if hasattr(application, 'parse_preliminary_options'): prelim_opts, remaining_args = application.parse_preliminary_options( argv) from flake8 import configure_logging configure_logging(prelim_opts.verbose, prelim_opts.output_file) from flake8.options import config config_finder = config.ConfigFileFinder( application.program, prelim_opts.append_config, config_file=prelim_opts.config, ignore_config_files=prelim_opts.isolated) application.find_plugins(config_finder) application.register_plugin_options() application.parse_configuration_and_cli(config_finder, remaining_args) else: application.parse_preliminary_options_and_args([]) application.make_config_finder() application.find_plugins() application.register_plugin_options() application.parse_configuration_and_cli(argv) application.make_formatter() application.make_guide() application.make_file_checker_manager() return StyleGuide(application)
def get_style_guide(argv=None): # this is a fork of flake8.api.legacy.get_style_guide # to allow passing command line argument application = Application() application.find_plugins() application.register_plugin_options() application.parse_configuration_and_cli(argv) application.make_formatter() application.make_notifier() application.make_guide() application.make_file_checker_manager() return StyleGuide(application)
def get_style_guide(argv=None): # this is a fork of flake8.api.legacy.get_style_guide # to allow passing command line argument application = Application() application.parse_preliminary_options_and_args(argv) configure_logging(application.prelim_opts.verbose, application.prelim_opts.output_file) application.make_config_finder() application.find_plugins() application.register_plugin_options() application.parse_configuration_and_cli(argv) application.make_formatter() application.make_guide() application.make_file_checker_manager() return StyleGuide(application)
def get_flake8_style_guide(argv): # This is a modified version of flake8.legacy.get_style_guide() in which we pass argv through # to parse_configuration_and_cli(), as opposed to a dict of flake8 options. # Since we are using config files and a mix plugins, it is not trivial to determine the # appropriate options to pass into the standard flake8.legacy.get_style_guide(); # passing argv gets it to determine the options for us. application = flake8_app.Application() application.parse_preliminary_options_and_args([]) flake8.configure_logging(application.prelim_opts.verbose, application.prelim_opts.output_file) application.make_config_finder() application.find_plugins() application.register_plugin_options() application.parse_configuration_and_cli(argv) application.make_formatter() application.make_guide() application.make_file_checker_manager() return StyleGuide(application)
def get_flake8_style_guide(argv): # This is a modified version of flake8.legacy.get_style_guide() in which we pass argv through # to parse_configuration_and_cli(), as opposed to a dict of flake8 options. # Since we are using config files and a mix plugins, it is not trivial to determine the # appropriate options to pass into the standard flake8.legacy.get_style_guide(); # passing argv gets it to determine the options for us. application = flake8_app.Application() if hasattr(application, 'parse_preliminary_options'): prelim_opts, remaining_args = application.parse_preliminary_options( argv) flake8.configure_logging(prelim_opts.verbose, prelim_opts.output_file) from flake8.options import config config_finder = config.ConfigFileFinder( application.program, prelim_opts.append_config, config_file=prelim_opts.config, ignore_config_files=prelim_opts.isolated) application.find_plugins(config_finder) application.register_plugin_options() application.parse_configuration_and_cli(config_finder, remaining_args) else: application.parse_preliminary_options_and_args([]) flake8.configure_logging(application.prelim_opts.verbose, application.prelim_opts.output_file) application.make_config_finder() application.find_plugins() application.register_plugin_options() application.parse_configuration_and_cli(argv) application.make_formatter() try: # needed in older flake8 versions to populate the listener application.make_notifier() except AttributeError: pass application.make_guide() application.make_file_checker_manager() return StyleGuide(application)