]> git.madduck.net Git - etc/vim.git/commitdiff

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Add special config verbose log case when black is using user-level config (#2861)
authorShivansh-007 <shivansh-007@outlook.com>
Mon, 21 Feb 2022 01:59:36 +0000 (07:29 +0530)
committerGitHub <noreply@github.com>
Mon, 21 Feb 2022 01:59:36 +0000 (17:59 -0800)
CHANGES.md
src/black/__init__.py

index e94b345e92a09de209cdc190353354ae19f34133..de85bd8a02dcb7ae73d35b8b8067d02a4b68e0a7 100644 (file)
@@ -35,6 +35,8 @@
 
 <!-- Changes to Black's terminal output and error messages -->
 
+- In verbose, mode, log when _Black_ is using user-level config (#2861)
+
 ### Packaging
 
 <!-- Changes to how Black is packaged, such as dependency requirements -->
index 8c28b6ba18b9dfa82e2a985297d13287bd9e2779..b7bf822ed089456cc756d474374ea8f5449eec95 100644 (file)
@@ -49,7 +49,12 @@ from black.cache import read_cache, write_cache, get_cache_info, filter_cached,
 from black.concurrency import cancel, shutdown, maybe_install_uvloop
 from black.output import dump_to_file, ipynb_diff, diff, color_diff, out, err
 from black.report import Report, Changed, NothingChanged
-from black.files import find_project_root, find_pyproject_toml, parse_pyproject_toml
+from black.files import (
+    find_project_root,
+    find_pyproject_toml,
+    parse_pyproject_toml,
+    find_user_pyproject_toml,
+)
 from black.files import gen_python_files, get_gitignore, normalize_path_maybe_ignore
 from black.files import wrap_stream_for_windows
 from black.parsing import InvalidInput  # noqa F401
@@ -402,7 +407,7 @@ def validate_regex(
     help="Read configuration from FILE path.",
 )
 @click.pass_context
-def main(
+def main(  # noqa: C901
     ctx: click.Context,
     code: Optional[str],
     line_length: int,
@@ -469,7 +474,17 @@ def main(
 
         if config:
             config_source = ctx.get_parameter_source("config")
-            if config_source in (ParameterSource.DEFAULT, ParameterSource.DEFAULT_MAP):
+            user_level_config = str(find_user_pyproject_toml())
+            if config == user_level_config:
+                out(
+                    f"Using configuration from user-level config at "
+                    f"'{user_level_config}'.",
+                    fg="blue",
+                )
+            elif config_source in (
+                ParameterSource.DEFAULT,
+                ParameterSource.DEFAULT_MAP,
+            ):
                 out("Using configuration from project root.", fg="blue")
             else:
                 out(f"Using configuration in '{config}'.", fg="blue")