diff --git a/.flake8 b/.flake8 index 2738f04..8447245 100644 --- a/.flake8 +++ b/.flake8 @@ -2,3 +2,4 @@ exclude = .git,__pycache__,.venv,test/data per-file-ignores = test/*:E501 + refurb/main.py:E501 diff --git a/README.md b/README.md index 760b995..1534562 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,13 @@ y = list() # noqa Here, `noqa: FURB123` specifically ignores the FURB123 error for that line, and `noqa` ignores all errors on that line. +## Enabling Checks + +Certain checks are disabled by default, and need to be enabled first. You can do this using the +`--enable ERR` flag, where `ERR` is the error code of the check you want to enable. A disabled +check differs from an ignored check in that a disabled check will never be loaded, whereas an +ignored check will be loaded, an error will be emitted, and the error will be suppressed. + ## Configuring Refurb In addition to the command line arguments, you can also add your settings in the `pyproject.toml` file. diff --git a/pyproject.toml b/pyproject.toml index 900351d..1f73978 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "refurb" -version = "1.2.0" +version = "1.3.0" description = "A tool for refurbish and modernize Python codebases" authors = ["dosisod"] license = "GPL-3.0-only" diff --git a/refurb/main.py b/refurb/main.py index 4ee437d..743ad5d 100644 --- a/refurb/main.py +++ b/refurb/main.py @@ -20,7 +20,7 @@ def usage() -> None: print( """\ -usage: refurb [--ignore err] [--load path] [--debug] [--quiet] src [srcs...] +usage: refurb [--ignore err] [--load path] [--debug] [--quiet] [--enable] src [srcs...] refurb [--help | -h] refurb [--version | -v] refurb --explain err @@ -35,6 +35,8 @@ def usage() -> None: for checks. Can be repeated. --debug Print the AST representation of all files that where checked. --quiet Suppress default "--explain" suggestion when an error occurs. +--enable Load a check which is disabled. +--explain Print the explaination/documentation from a given error code. src A file or folder. @@ -138,7 +140,7 @@ def format_errors(errors: Sequence[Error | str], quiet: bool) -> str: done = "\n".join((str(error) for error in errors)) if not quiet and any(isinstance(error, Error) for error in errors): - done += "\n\nRun `refurb --explain ERR` to further explain an error. Use `--quiet` to silence this message" # noqa: E501 + done += "\n\nRun `refurb --explain ERR` to further explain an error. Use `--quiet` to silence this message" return done