From 71117e730c4f62458b30af820f51890487b458e4 Mon Sep 17 00:00:00 2001 From: Oliver Newman <15459200+orn688@users.noreply.github.com> Date: Wed, 27 Jan 2021 12:36:21 -0500 Subject: [PATCH 1/1] Update example exclude to match only files in root (#1861) * Update example exclude to match only files in root The `exclude` section of the example `pyproject.toml` file didn't work as expected. It claimed to exclude matched files only in the project root, but it actually excluded matched files at any directory level within the project. We can address this by prepending `^/` to the regex to ensure that it only matches files in the project root. See https://github.com/psf/black/issues/1473#issuecomment-740008873 for explanation. * Mention excluding directories as well --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f1ec769..83ecb89 100644 --- a/README.md +++ b/README.md @@ -313,9 +313,10 @@ line-length = 88 target-version = ['py37'] include = '\.pyi?$' exclude = ''' - -( - /( +# A regex preceded with ^/ will apply only to files and directories +# in the root of the project. +^/( + ( \.eggs # exclude a few common directories in the | \.git # root of the project | \.hg -- 2.39.5