-
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
applying black to all the code #5734
Conversation
4cd38c5
to
eae3c66
Compare
Codecov Report
@@ Coverage Diff @@
## master #5734 +/- ##
=======================================
Coverage 88.93% 88.93%
=======================================
Files 162 162
Lines 10988 10988
Branches 1797 1797
=======================================
Hits 9772 9772
Misses 937 937
Partials 279 279
|
Thanks! Several points I want to mention:
|
No, we can add it here, and we probably should, we just need to make sure not to squash-and-merge (or rebase-and-merge) the changes, and instead go for a good-old, regular merge commit that does not change the hashes of these commits. |
That is a very good point 😞 |
Hey! Based on experience working with https://github.com/scrapy/parsel, it's a bit annoying to have black CI checks, but no easy documented way to configure black, setup the environment. What do you think about setting up pre-commit and adding instrutions to the docs as a part of this PR? See e.g. https://github.com/scrapinghub/web-poet#developing |
The pathlib one is merged and the pylint one is close to be merged so work on this can be restarted quite soon (and in the meantime things that are not related to actually changing the code can be worked on). |
@@ -12,7 +15,7 @@ def _indentation_error(*args, **kwargs): | |||
|
|||
def top_level_return_something(): | |||
""" | |||
docstring | |||
docstring |
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.
We need to disable this in some way, because these tests are for testing such code.
Merged now. |
eae3c66
to
4416055
Compare
tests/test_request_cb_kwargs.py
Outdated
elif response.url.endswith("/general_without"): | ||
self.checks.append( | ||
kwargs == {} | ||
) # pylint: disable=use-implicit-booleaness-not-comparison |
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.
This comment needs to be moved to the previous line to work properly.
The changes that remove flake8 errors will most likely be rolled back when you run |
ignoring implicit-str-concat pylint error fixing pylint comment on test_request_cb_kwargs.py
cb92df0
to
1a3db81
Compare
Great! The next steps are:
|
a2451f4
to
09dc4cf
Compare
We also need to add the tox-powered black check to https://github.com/scrapy/scrapy/blob/master/.github/workflows/checks.yml, to have the CI fail when black formatting is not used (e.g. if contributors do not install pre-commit). |
OK, I think the only thing missing is… re-run black now that you removed back the line length setting. Unless you are comfortable with re-applying everything from scratch as you did in the past, you could alternatively re-run black on a new commit, and add a follow-up commit that marks that second black commit to be ignored by git blame. |
Hmm, the black job is still failing in CI, can you take a look? |
hey! I think we should explain pre-commit in https://docs.scrapy.org/en/master/contributing.html. |
fe7e3cc
to
2888e55
Compare
2888e55
to
23e8b55
Compare
ffbebde
to
f2c22aa
Compare
|
||
[testenv:black] | ||
deps = | ||
black==22.12.0 |
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.
We don't need to do it in this PR, but we have black version pinned in 2 places: tox.ini and pre-commit config. It probably makes sense to just fail the CI if pre-commit run --all-files
changes anything, instead of running these tools in tox manually.
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.
Awesome, thanks @emarondan!
Applying black formatter to all scrapy code as part of an internal task.
Closes #4658 and closes #4654.