Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add example config files #280

Merged
merged 1 commit into from
Aug 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ You can use the `--config-file` flag to tell Refurb to use a different config fi
default `pyproject.toml` file. Note that it still must be in the same form as the normal
`pyproject.toml` file.

Click [here](./docs/configs/README.md) to see some example config files.

### Ignore Checks Per File/Folder

If you have a large codebase you might want to ignore errors for certain files or folders,
Expand Down
6 changes: 6 additions & 0 deletions docs/configs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Config File Examples

This folder contains 2 example files:

* `default.toml`: Config file representing the default settings used in Refurb
* `reference.toml`: All of the available config file settings in Refurb
11 changes: 11 additions & 0 deletions docs/configs/default.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# This is a config file that emulates the default settings used by Refurb.

ignore = []
load = []
disable = ["FURB106", "FURB120", "FURB137", "FURB147", "FURB151", "FURB166", "FURB172"]
quiet = false
enable_all = false
disable_all = false
python_version = "" # uses current python version
format = "text"
sort_by = "filename"
37 changes: 37 additions & 0 deletions docs/configs/reference.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# This is an example config file that shows all the available configuration
# options in Refurb. You probably won't need most of them, but are here for
# completion. Some of these configurations conflict with one another, so only
# use this file as a reference!

# The following error codes are identical
ignore = ["FURB100", 100]

# Enable FURB100
enable = ["FURB100"]

# Disable FURB100
disable = ["FURB100"]

# Enable all checks (good for new codebases)
enable_all = true

# Disable all checks (good for incrementally adopting Refurb)
disable_all = true

# Disable "use --explain" error message
quiet = true

# Specify a specific Python version to use
python_version = "3.10"

format = "github" # or "text"
sort_by = "filename" # or "error"

# Add custom path to look for potential Refurb plugins
load = ["custom_module"]


# Ignore certain checks for specific folders
[[tool.refurb.amend]]
path = "src"
ignore = ["FURB123", "FURB120"]
2 changes: 1 addition & 1 deletion refurb/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Settings:
config_file: str | None = None
python_version: tuple[int, int] | None = None
mypy_args: list[str] = field(default_factory=list)
format: Literal["text", "github", None] | None = None
format: Literal["text", "github"] | None = None
sort_by: Literal["filename", "error"] | None = None
verbose: bool = False
timing_stats: Path | None = None
Expand Down
Loading