-
Notifications
You must be signed in to change notification settings - Fork 24
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
Support auto-formatting #539
Comments
➤ Automation for Jira commented: The link to the corresponding Jira issue is https://ably.atlassian.net/browse/SDK-3897 |
I personally have mixed feelings about this - I use black locally for development but I'm not a fan of some of the behaviour, for example: # before black
rename_classes = [
"AblyRest",
"Push",
"PushAdmin",
"Channel",
"Channels",
"Auth",
"Http",
"PaginatedResult",
"HttpPaginatedResponse"
]
# after black, much less readable
rename_classes = [ "AblyRest", "Push", "PushAdmin", "Channel", "Channels",
"Auth", "Http", "PaginatedResult", "HttpPaginatedResponse" ] Personally my recommendation is to just use range formatting locally when you need it, but not to automatically format every single file. For dummy commits, i don't think i've ever pushed a 'fix formatting' commit to this repo, it's very easy to amend previous commits using |
I think we should be able to configure some of those stylings using |
Also, I am sure when we will have new devs onboarded to work on |
@owenpearson it seems the issue you mentioned has already been raised psf/black#601 |
Also, it seems we can disable behavior for the short list using -> psf/black#650 (comment). It should work fine for a long list without disabling, like the one you mentioned. |
Ah fair enough, i didn't realise you could configure that behaviour with I do certainly see the value in having consistent formatting, I just think there are tradeoffs because auto formatters are never perfect. I'm not saying we shouldn't add one at all, just that personally I'm happy without it 🤷 As for force pushing, I would definitely recommend using force push to fix linting/formatting issues rather than pushing separate commits - ideally each commit on the main branch should represent a valid state of the project (ie all CI checks passing). I do this all the time and it's never caused any issues, the worst that can happen is that someone else has the branch checked out and they have to |
That's why most people use pre-commit hook to run formatting/linting process. |
https://pypi.org/project/pre-commit-hooks/ seems like a good option |
i dunno if "most people" is correct, personally i don't like them. and like before, even if we add all of this tooling there will still be occasions where you push a commit which leaves the repo in an invalid state so it's not a comprehensive alternative to rebase + force push |
I know. I am not a fan of git hooks either : ( |
black
tool available in the market to support autoformatting.auto-indenting
after source code is generated usingunasync.py
.unasync.py
still, properly linted code is not guaranteed.
┆Issue is synchronized with this Jira Task by Unito
The text was updated successfully, but these errors were encountered: