diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1759910b..b0e49bec 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,12 +40,10 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install dependencies run: python -m pip install --upgrade pip setuptools tox - - name: Run tests with flake8_6 - run: python -m tox -e flake8_6 - - name: Run tests with flake8_7+ - run: python -m tox -e flake8_7 + - name: Run tests with flake8 + run: python -m tox -e flake8 - name: Run tests without flake8 - run: python -m tox -e noflake8 -- --no-cov + run: python -m tox -e "" -- --no-cov slow_tests: runs-on: ubuntu-latest @@ -60,9 +58,9 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip setuptools tox - python -m tox --notest --recreate -e flake8_7 + python -m tox --notest --recreate -e flake8 - name: Run tests - run: python -m tox -e flake8_7 -- --onlyfuzz --no-cov -n auto + run: python -m tox -e flake8 -- --onlyfuzz --no-cov -n auto check_release: runs-on: ubuntu-latest diff --git a/tox.ini b/tox.ini index f9578884..dce35389 100644 --- a/tox.ini +++ b/tox.ini @@ -1,15 +1,15 @@ # The test environment and commands [tox] # default environments to run without `-e` -envlist = py{39,310,311,312,313}-{flake8_6,flake8_7},noflake8 +# trailing comma gives the empty environ - i.e. no flake8 default python +envlist = py{39,310,311,312,313}-{flake8}, # create a default testenv, whose behaviour will depend on the name it's called with. # for CI you can call with `-e flake8_6,flake8_7` and let the CI handle python version [testenv] description = Runs pytest, optionally with posargs deps = - flake8_7: flake8>=7.0 - flake8_6: flake8>=6.0, <7.0 + flake8: flake8 pytest pytest-cov # to make it easy to pass --no-cov coverage diff --git a/typings/flake8/__init__.pyi b/typings/flake8/__init__.pyi deleted file mode 100644 index 746705b8..00000000 --- a/typings/flake8/__init__.pyi +++ /dev/null @@ -1,37 +0,0 @@ -""" -This type stub file was generated by pyright. -""" - -import logging - -"""Top-level module for Flake8. - -This module - -- initializes logging for the command-line tool -- tracks the version of the package -- provides a way to configure logging for the command-line tool - -.. autofunction:: flake8.configure_logging - -""" -LOG: logging.Logger = ... -__version__: str = ... -__version_info__: tuple[int, ...] = ... -_VERBOSITY_TO_LOG_LEVEL: dict[int, int] = ... -LOG_FORMAT: str = ... - -def configure_logging( - verbosity: int, filename: str | None = ..., logformat: str = ... -) -> None: - """Configure logging for flake8. - - :param verbosity: - How verbose to be in logging information. - :param filename: - Name of the file to append log information to. - If ``None`` this will log to ``sys.stderr``. - If the name is "stdout" or "stderr" this will log to the appropriate - stream. - """ - ... diff --git a/typings/flake8/main/application.pyi b/typings/flake8/main/application.pyi deleted file mode 100644 index 3551a770..00000000 --- a/typings/flake8/main/application.pyi +++ /dev/null @@ -1,77 +0,0 @@ -""" -This type stub file was generated by pyright. -""" - -from collections.abc import Sequence - -"""Module containing the application logic for Flake8.""" -LOG = ... - -class Application: - """Abstract our application into a class.""" - - def __init__(self) -> None: - """Initialize our application.""" - ... - - def exit_code(self) -> int: - """Return the program exit code.""" - ... - - def make_formatter(self) -> None: - """Initialize a formatter based on the parsed options.""" - ... - - def make_guide(self) -> None: - """Initialize our StyleGuide.""" - ... - - def make_file_checker_manager(self, argv: Sequence[str]) -> None: - """Initialize our FileChecker Manager.""" - ... - - def run_checks(self) -> None: - """Run the actual checks with the FileChecker Manager. - - This method encapsulates the logic to make a - :class:`~flake8.checker.Manager` instance run the checks it is - managing. - """ - ... - - def report_benchmarks(self) -> None: - """Aggregate, calculate, and report benchmarks for this run.""" - ... - - def report_errors(self) -> None: - """Report all the errors found by flake8 3.0. - - This also updates the :attr:`result_count` attribute with the total - number of errors, warnings, and other messages found. - """ - ... - - def report_statistics(self) -> None: - """Aggregate and report statistics from this run.""" - ... - - def initialize(self, argv: Sequence[str]) -> None: - """Initialize the application to be run. - - This finds the plugins, registers their options, and parses the - command-line arguments. - """ - ... - - def report(self) -> None: - """Report errors, statistics, and benchmarks.""" - ... - - def run(self, argv: Sequence[str]) -> None: - """Run our application. - - This method will also handle KeyboardInterrupt exceptions for the - entirety of the flake8 application. If it sees a KeyboardInterrupt it - will forcibly clean up the :class:`~flake8.checker.Manager`. - """ - ... diff --git a/typings/flake8/main/cli.pyi b/typings/flake8/main/cli.pyi deleted file mode 100644 index f454868e..00000000 --- a/typings/flake8/main/cli.pyi +++ /dev/null @@ -1,18 +0,0 @@ -""" -This type stub file was generated by pyright. -""" - -from collections.abc import Sequence - -"""Command-line implementation of flake8.""" - -def main(argv: Sequence[str] | None = ...) -> int: - """Execute the main bit of the application. - - This handles the creation of an instance of :class:`Application`, runs it, - and then exits the application. - - :param argv: - The arguments to be passed to the application for parsing. - """ - ... diff --git a/typings/flake8/options/manager.pyi b/typings/flake8/options/manager.pyi deleted file mode 100644 index 3d68eb86..00000000 --- a/typings/flake8/options/manager.pyi +++ /dev/null @@ -1,205 +0,0 @@ -""" -This type stub file was generated by pyright. - -Generated for flake8 5, so OptionManager signature is incorrect for flake8 6 -""" - -import argparse -import enum -from collections.abc import Callable, Mapping, Sequence -from typing import Any - -from flake8.plugins.finder import Plugins - -"""Option handling and Option management logic.""" -LOG = ... - -class _ARG(enum.Enum): ... - -_optparse_callable_map: dict[str, type[Any] | _ARG] = ... - -class _CallbackAction(argparse.Action): - """Shim for optparse-style callback actions.""" - - def __init__( - self, - *args: Any, - callback: Callable[..., Any], - callback_args: Sequence[Any] = ..., - callback_kwargs: dict[str, Any] | None = ..., - **kwargs: Any, - ) -> None: ... - def __call__( - self, - parser: argparse.ArgumentParser, - namespace: argparse.Namespace, - values: Sequence[str] | str | None, - option_string: str | None = ..., - ) -> None: ... - -class Option: - """Our wrapper around an argparse argument parsers to add features.""" - - def __init__( - self, - short_option_name: str | _ARG = ..., - long_option_name: str | _ARG = ..., - action: str | type[argparse.Action] | _ARG = ..., - default: Any | _ARG = ..., - type: str | Callable[..., Any] | _ARG = ..., # noqa: A002 - dest: str | _ARG = ..., - nargs: int | str | _ARG = ..., - const: Any | _ARG = ..., - choices: Sequence[Any] | _ARG = ..., - help: str | _ARG = ..., # noqa: A002 - metavar: str | _ARG = ..., - callback: Callable[..., Any] | _ARG = ..., - callback_args: Sequence[Any] | _ARG = ..., - callback_kwargs: Mapping[str, Any] | _ARG = ..., - required: bool | _ARG = ..., - parse_from_config: bool = ..., - comma_separated_list: bool = ..., - normalize_paths: bool = ..., - ) -> None: - """Initialize an Option instance. - - The following are all passed directly through to argparse. - - :param short_option_name: - The short name of the option (e.g., ``-x``). This will be the - first argument passed to ``ArgumentParser.add_argument`` - :param long_option_name: - The long name of the option (e.g., ``--xtra-long-option``). This - will be the second argument passed to - ``ArgumentParser.add_argument`` - :param default: - Default value of the option. - :param dest: - Attribute name to store parsed option value as. - :param nargs: - Number of arguments to parse for this option. - :param const: - Constant value to store on a common destination. Usually used in - conjunction with ``action="store_const"``. - :param choices: - Possible values for the option. - :param help: - Help text displayed in the usage information. - :param metavar: - Name to use instead of the long option name for help text. - :param required: - Whether this option is required or not. - - The following options may be passed directly through to :mod:`argparse` - but may need some massaging. - - :param type: - A callable to normalize the type (as is the case in - :mod:`argparse`). Deprecated: you can also pass through type - strings such as ``'int'`` which are handled by :mod:`optparse`. - :param action: - Any action allowed by :mod:`argparse`. Deprecated: this also - understands the ``action='callback'`` action from :mod:`optparse`. - :param callback: - Callback used if the action is ``"callback"``. Deprecated: please - use ``action=`` instead. - :param callback_args: - Additional positional arguments to the callback callable. - Deprecated: please use ``action=`` instead (probably with - ``functools.partial``). - :param callback_kwargs: - Keyword arguments to the callback callable. Deprecated: please - use ``action=`` instead (probably with ``functools.partial``). - - The following parameters are for Flake8's option handling alone. - - :param parse_from_config: - Whether or not this option should be parsed out of config files. - :param comma_separated_list: - Whether the option is a comma separated list when parsing from a - config file. - :param normalize_paths: - Whether the option is expecting a path or list of paths and should - attempt to normalize the paths to absolute paths. - """ - ... - - @property - def filtered_option_kwargs(self) -> dict[str, Any]: - """Return any actually-specified arguments.""" - ... - - def normalize(self, value: Any, *normalize_args: str) -> Any: - """Normalize the value based on the option configuration.""" - ... - - def to_argparse(self) -> tuple[list[str], dict[str, Any]]: - """Convert a Flake8 Option to argparse ``add_argument`` arguments.""" - ... - -class OptionManager: - """Manage Options and OptionParser while adding post-processing.""" - - def __init__( - self, - *, - version: str, - plugin_versions: str, - parents: list[argparse.ArgumentParser], - ) -> None: - """Initialize an instance of an OptionManager. - - :param prog: - Name of the actual program (e.g., flake8). - :param version: - Version string for the program. - :param usage: - Basic usage string used by the OptionParser. - :param parents: - A list of ArgumentParser objects whose arguments should also be - included. - """ - ... - - def register_plugins(self, plugins: Plugins) -> None: - """Register the plugin options (if needed).""" - ... - - def add_option(self, *args: Any, **kwargs: Any) -> None: - """Create and register a new option. - - See parameters for :class:`~flake8.options.manager.Option` for - acceptable arguments to this method. - - .. note:: - - ``short_option_name`` and ``long_option_name`` may be specified - positionally as they are with argparse normally. - """ - ... - - def extend_default_ignore(self, error_codes: Sequence[str]) -> None: - """Extend the default ignore list with the error codes provided. - - :param error_codes: - List of strings that are the error/warning codes with which to - extend the default ignore list. - """ - ... - - def extend_default_select(self, error_codes: Sequence[str]) -> None: - """Extend the default select list with the error codes provided. - - :param error_codes: - List of strings that are the error/warning codes with which - to extend the default select list. - """ - ... - - def parse_args( - self, - args: Sequence[str] | None = ..., - values: argparse.Namespace | None = ..., - ) -> argparse.Namespace: - """Proxy to calling the OptionParser's parse_args method.""" - ...