Skip to content

Tool doesn't honor black preferences #62

@jaraco

Description

@jaraco

I've adopted blacken-docs as a pre-commit hook on my projects, but today blacken-docs gave me trouble by performing string normalization where I prefer it not be:

pip-run master $ git clone gh://jaraco/pip-run
Cloning into 'pip-run'...
remote: Enumerating objects: 466, done.
remote: Counting objects: 100% (466/466), done.
remote: Compressing objects: 100% (265/265), done.
remote: Total 1785 (delta 278), reused 369 (delta 193), pack-reused 1319
Receiving objects: 100% (1785/1785), 290.69 KiB | 4.21 MiB/s, done.
Resolving deltas: 100% (1050/1050), done.
pip-run master $ cd pip-run
pip-run master $ git checkout d17b4e8
Note: switching to 'd17b4e8'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at d17b4e8 Improve syntax in readme
pip-run HEAD $ pre-commit install
pre-commit installed at .git/hooks/pre-commit
pip-run HEAD $ pre-commit run
black................................................(no files to check)Skipped
blacken-docs.........................................(no files to check)Skipped
pip-run HEAD $ pre-commit run --all
black....................................................................Passed
blacken-docs.............................................................Failed
- hook id: blacken-docs
- exit code: 1
- files were modified by this hook

README.rst: Rewriting...

pip-run HEAD $ git diff
diff --git a/README.rst b/README.rst
index 87c34d9..6fa9b2e 100644
--- a/README.rst
+++ b/README.rst
@@ -177,11 +177,11 @@ First, add a ``__requires__`` directive at the head of the script:
 
     #!/usr/bin/env python
 
-    __requires__ = ['requests']
+    __requires__ = ["requests"]
 
     import requests
 
-    req = requests.get('https://pypi.org/project/pip-run')
+    req = requests.get("https://pypi.org/project/pip-run")
     print(req.status_code)
 
 Then, simply invoke that script with pip-run::
@@ -199,10 +199,11 @@ allowing a script to specify a custom package index:
 
     #!/usr/bin/env python
 
-    __requires__ = ['my_private_package']
-    __index_url__ = 'https://my.private.index/'
+    __requires__ = ["my_private_package"]
+    __index_url__ = "https://my.private.index/"
 
     import my_private_package
+
     ...
 
 Supplying parameters to Pip

pip-run HEAD $ head -n 6 pyproject.toml | tail -n 2
[tool.black]
skip-string-normalization = true

Is it by design that the configuration for black is different than that for blacken-docs? Is there a way that blacken-docs could be configured to honor the black config?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions