How to use the flake8.configure_logging function in flake8

To help you get started, we’ve selected a few flake8 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dirk-thomas / vcstool / test / test_flake8.py View on Github external
def test_flake8():
    configure_logging(1)
    argv = [
        '--extend-ignore=' + ','.join([
            'A003', 'D100', 'D101', 'D102', 'D103', 'D104', 'D105', 'D107']),
        '--exclude', 'vcstool/compat/shutil.py',
        '--import-order-style=google']
    style_guide = get_style_guide(argv)
    base_path = os.path.join(os.path.dirname(__file__), '..')
    paths = [
        os.path.join(base_path, 'setup.py'),
        os.path.join(base_path, 'test'),
        os.path.join(base_path, 'vcstool'),
    ]
    scripts_path = os.path.join(base_path, 'scripts')
    for script in os.listdir(scripts_path):
        if script.startswith('.'):
            continue
github ros-infrastructure / ros_buildfarm / test / test_flake8.py View on Github external
# to allow passing command line argument
    application = Application()
    if not hasattr(application, 'parse_preliminary_options_and_args'):  # flake8 >= 3.8
        prelim_opts, remaining_args = application.parse_preliminary_options(argv)
        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(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)
github zrzka / blackmamba / blackmamba / lib / flake8 / main / application.py View on Github external
def initialize(self, argv):
        # type: () -> NoneType
        """Initialize the application to be run.

        This finds the plugins, registers their options, and parses the
        command-line arguments.
        """
        # NOTE(sigmavirus24): When updating this, make sure you also update
        # our legacy API calls to these same methods.
        self.parse_preliminary_options_and_args(argv)
        flake8.configure_logging(
            self.prelim_opts.verbose, self.prelim_opts.output_file)
        self.make_config_finder()
        self.find_plugins()
        self.register_plugin_options()
        self.parse_configuration_and_cli(argv)
        self.make_formatter()
        self.make_notifier()
        self.make_guide()
        self.make_file_checker_manager()
github PyCQA / flake8 / src / flake8 / main / application.py View on Github external
def initialize(self, argv):
        # type: (List[str]) -> None
        """Initialize the application to be run.

        This finds the plugins, registers their options, and parses the
        command-line arguments.
        """
        # NOTE(sigmavirus24): When updating this, make sure you also update
        # our legacy API calls to these same methods.
        self.parse_preliminary_options_and_args(argv)
        flake8.configure_logging(
            self.prelim_opts.verbose, self.prelim_opts.output_file
        )
        self.make_config_finder()
        self.find_plugins()
        self.register_plugin_options()
        self.parse_configuration_and_cli(argv)
        self.make_formatter()
        self.make_guide()
        self.make_file_checker_manager()
github PyCQA / flake8 / src / flake8 / api / legacy.py View on Github external
def get_style_guide(**kwargs):
    r"""Provision a StyleGuide for use.

    :param \*\*kwargs:
        Keyword arguments that provide some options for the StyleGuide.
    :returns:
        An initialized StyleGuide
    :rtype:
        :class:`StyleGuide`
    """
    application = app.Application()
    prelim_opts, remaining_args = application.parse_preliminary_options([])
    flake8.configure_logging(prelim_opts.verbose, prelim_opts.output_file)
    config_finder = config.ConfigFileFinder(
        application.program, prelim_opts.append_config
    )

    application.find_plugins(
        config_finder, prelim_opts.config, prelim_opts.isolated
    )
    application.register_plugin_options()
    application.parse_configuration_and_cli(config_finder, remaining_args)
    # 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:
            getattr(options, key)
github PyCQA / flake8 / src / flake8 / main / application.py View on Github external
def initialize(self, argv):
        # type: (List[str]) -> None
        """Initialize the application to be run.

        This finds the plugins, registers their options, and parses the
        command-line arguments.
        """
        # NOTE(sigmavirus24): When updating this, make sure you also update
        # our legacy API calls to these same methods.
        prelim_opts, remaining_args = self.parse_preliminary_options(argv)
        flake8.configure_logging(prelim_opts.verbose, prelim_opts.output_file)
        config_finder = config.ConfigFileFinder(
            self.program, prelim_opts.append_config
        )
        self.find_plugins(
            config_finder, prelim_opts.config, prelim_opts.isolated
        )
        self.register_plugin_options()
        self.parse_configuration_and_cli(config_finder, remaining_args)
        self.make_formatter()
        self.make_guide()
        self.make_file_checker_manager()