-
Notifications
You must be signed in to change notification settings - Fork 10.6k
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 pre-commit hook for 'blacken-docs' #5816
Conversation
We need to run it as well as part of the task, so that the pre-commit CI job passes. I think running |
Codecov Report
@@ Coverage Diff @@
## master #5816 +/- ##
==========================================
+ Coverage 84.82% 88.94% +4.11%
==========================================
Files 162 162
Lines 10995 11002 +7
Branches 1626 1798 +172
==========================================
+ Hits 9327 9786 +459
+ Misses 1399 937 -462
- Partials 269 279 +10
|
Alright, let me try! |
@Gallaecio I have run the pre-commit. Please check. |
I see that it did not modify much. I think it is because it does not affect code snippets preceded with Once you do that, please check the output, and see if there is any non-Python code block affected by the change. If so, we could change such blocks to use |
I have re-run blacken-docs with |
I changed all python snippets to use |
Change python code snippets to begin with '.. code-block:: python' to be recognized by the hook for formatting. All snippets under '::' (rst literal blocks) are ignored.
That would be awesome ❤️ |
Prepend '.. code-block:: pycon' to make python console blocks detectable by blacken-docs
@Gallaecio I have formatted all python console blocks. Please verify 😅 |
Moreover, I think it's a good idea to specify somewhere in the documentation guidelines to use |
You could extend https://docs.scrapy.org/en/latest/contributing.html#documentation-policies to cover that, but you have already done a lot here. I’ll have a proper look at the new changes as soon as I get a chance. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing work!
Thanks 😅 Will make the suggested changes soon! |
Done 👍 |
Looks like merging this before waiting for tests to finish (which I did accidentally but I thought it was fine) was a mistake, as tests actually don't finish, and the docs tests fail. I'll create a new issue about it. |
blacken-docs
has been added as a pre-commit hook in.pre-commit-config.yaml
, however, it has not been run under this task.Fixes #5813