Skip to content

Run black on .py files (with git-blame-ignore-revs) #575

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

Merged
merged 3 commits into from
Dec 15, 2022

Conversation

rgommers
Copy link
Member

This makes black happy, and git blame won't be cluttered by the commit with black changes. This works in the GitHub UI out of the box, and locally after running git config blame.ignoreRevsFile .git-blame-ignore-revs once.

This PR also fixes some minor issues identified by pydocstyle. There is no good automated formatter for docstrings (black doesn't touch them, and docformatter touches only summary lines and descriptions, which is a small fraction of content). So in anticipation of adding CI in the future, this makes the following check pass:

pydocstyle . --ignore=D401,D212,D413,D100 --match='(?!_types.py).*\.py'

This is all that can be done with automated tooling. xref gh-533 for context.

The check to run is:
```
pydocstyle . --ignore=D401,D212,D413,D100 --match='(?!_types.py).*\.py'
```

`_types.py` is excluded because it's a private file, and it's too fiddly
and not necessary to add docstrings to the classes in that file.
@rgommers rgommers added the Document Formatting Document formatting or styling. label Dec 15, 2022
@rgommers rgommers added this to the v2022 milestone Dec 15, 2022
@rgommers
Copy link
Member Author

One comment: this PR should be merged with a merge commit, rather than squash-merged, in order for the commit hash in the .git-blame-ignore-revs file to be correct.

Copy link
Contributor

@kgryte kgryte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@kgryte kgryte merged commit 6d07556 into data-apis:main Dec 15, 2022
@rgommers rgommers deleted the run-black branch December 15, 2022 20:05
@leofang
Copy link
Contributor

leofang commented Dec 20, 2022

It'd be nice to collect all these nice tool usage guide in one place 👍

@rgommers
Copy link
Member Author

@leofang I assume you mean black, not the git blame twiddling? One of the remaining TODO tasks is to have a single CI job that runs all these tools. We can also add it to CONTRIBUTING.md if that's helpful.

@leofang
Copy link
Contributor

leofang commented Dec 21, 2022

CONTRIBUTING.md sounds like the right place. I meant all of these, even if it's one-time only:

  • git config blame.ignoreRevsFile .git-blame-ignore-revs
  • pydocstyle . --ignore=D401,D212,D413,D100 --match='(?!_types.py).*\.py'
  • ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Document Formatting Document formatting or styling.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants