-
Notifications
You must be signed in to change notification settings - Fork 358
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 precommit in workflow to standardize code style #755
Comments
Basically I'd prefer to have a source code formatter to standardize the code style. I'm wondering whether the pre-commit hook can format only the updated codes since it's possibly difficult to review so many code changes in a PR for enabling the formatter. If it can, we will eventually have fully formatted codes after a while. If we won't have so many changes in the PR, then it'd be no problem. Also, do you know other formatters? We might want to compare formatters if any. |
Thanks for your comment! @ueshin
Indeed, most of files I believe will need to be reformatted, and it's difficult to review at once. What I plan to do is to have a WIP PR to implement the pre-commit hook, and then create PRs for each or several files using a selected formatter to avoid huge amount of changes at the same time, once all files or most of files are reformatted, then we merge the pre-cmmit hook PR and then afterwards, all new changes have to follow the new formatting (actually users can just do
Sorry about this, I only have experience in |
Sounds great. I agree that the formatter is nice for a project. Let me try the |
Oh, almost all files changed. We definitely shouldn't do in one PR. haha |
yeah, i tried locally as well, since some warnings already showed in pycharm for me, so I would expect almost all files have to be changed. I am submitting a PR for Does this sound good to you? @ueshin @HyukjinKwon |
How many files and lines should it be changed? I think it might be fine since we don't currently backport and maintain minor or maintenance releases unless it changes everything with some thousands changes. |
almost all |
@ueshin @HyukjinKwon @charlesdong1991 Is standardized formatting using
Overall a big fan of Black—and the fact that it eliminates time spent formatting Python/code style discussions altogether—and happy to pick this back up if you all agree! |
Please open a PR. I am interested in taking a look! |
Great! I'll try and pick this up in the next week. |
@HyukjinKwon Sorry for the delay in getting to this. #1284 is ready for review, to see (1) if this is something you all want to purse and (2) what the next steps would be in terms of cleaning it up, or (potentially) customizing it to fit the project needs. |
FWIW, just noticed Pandas also uses Black now ( |
Hm, does pandas also apply the change to the whole code base? |
yeah, pandas started using black quite a while ago, and it was the initial reason to propose this here @deepyaman @HyukjinKwon FYI, I recall that pandas first applied black for batches of files first (so several PRs for reformatting), and then in the meantime add black as part of linting check in CI, so CI won't pass if users do not black their PR or if the current codebase have codes incompatible with black, and then merge it and black the rest of code alongside (so need to keep rebasing). It is pretty much alike the PR @deepyaman has, but maybe with several pre-cursor PRs for reformatting first could make this one smaller and easier to review. |
This is not a function but more like coding/contributing related.
I know now quite many open source projects add
black
for instance in their pre-commit pipeline to kind of standardize the code style. I tried toblack
several files and found some look more 'pretty'. Not sure if it is something Koalas wants to have as well.If you like it, I would be happy to work on this.
The text was updated successfully, but these errors were encountered: