-
Notifications
You must be signed in to change notification settings - Fork 8
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
Formatting experiment #109
Conversation
Based off the wrong branch but it's just for discussion so w/e |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #109 +/- ##
==========================================
- Coverage 71.85% 71.64% -0.22%
==========================================
Files 152 152
Lines 20066 20173 +107
Branches 3263 3334 +71
==========================================
+ Hits 14418 14452 +34
- Misses 4852 4891 +39
- Partials 796 830 +34
☔ View full report in Codecov by Sentry. |
I'm pro this- I don't have gigantically strong opinions on any specific formatting rules, and generally think having a consistent coding style throughout the code is very valuable for ease of reading. |
I am definitely pro this. Logical errors are much easier to spot with consistently well-formatted code. |
@obackhouse Would I be OK to resurrect this branch a bit? I'd be happy with the parameters you've chosen, so would just rebase those on master and rerun? |
Yep - just force merge and then run |
OK, I've updated the black configuration slightly to avoid some errors I was getting. There are two other things I think we should do before merging
|
.git-blame-ignore-revs
Outdated
# git config blame.ignoreRevsFile .git-blame-ignore-revs | ||
|
||
# Formatted entire existing codebase with black | ||
fb04486be252768cc7b9d74c0b362dc0d5b2a1ee |
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.
😄
Good idea with the git blame. I'm usually against pre-commit hooks, but I see the pros too. The dependency is fine because there are also development dependencies like |
OK, I've added a test configuration for a pre-commit into this branch; to set it up you just need to install If you haven't used it before (as I hadn't) I would recommend trying it out to see how easy it is to fit into existing workflows! I should also say that I've extended this to include formatting on everything, not just the source code. This was initially because getting the pre-commit to respect those limitations was non-trivial, but then also because I realised enforcing a consistent code style everywhere except for the public-facing examples was a bit ridiculous. Obviously revertible if anyone disagrees! |
(apologies for the force-pushing; just ensuring we only have a single mega-formatting commit) |
Can the two configuration files in the root directory go in |
The file of revisions to ignore has to be in the root directory to be
detected by github afaik, which we do probably want; that's going off
description here though:
https://docs.github.com/en/repositories/working-with-files/using-files/viewing-a-file#ignore-commits-in-the-blame-view
If we don't care about GitHub detection it has to be set as a personal
config anyways, so could be anywhere.
As for the pre-commit, I can't find anything and from this it seem like the
developers weren't enthusiastic about pyproject.toml (possibly with good reason, I
don't know): pre-commit/pre-commit#1165
|
Formats the source code using
black
. Mostly just wanted to gauge opinions on this. Is anyone actually against it, and if so why? I think it makes things much tidier?