Skip to content
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

use black to format python code #382

Merged
merged 1 commit into from
Apr 29, 2020
Merged

use black to format python code #382

merged 1 commit into from
Apr 29, 2020

Conversation

li-wu
Copy link
Contributor

@li-wu li-wu commented Apr 24, 2020

  1. Introduce black as code format tool;
  • Format all python code using black
    make format-all
  • Format changed or newly added python codes using black before commit:
    make format

And you can still use flake8 to lint the code:

  • Lint all python code using flake8
    make lint-all
  • Format changed or newly added python codes using black before commit:
    make lint
  1. All changed python files are formatted using black

  2. Fix some issues reported by flake8

  • unused imports
  • unused variables
  • ambiguous variables

endif

lint-all:
@flake8 .

format-all:
@isort -rc .
@yapf -r -i .
@black .
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Use black instead of yapf here.

@@ -0,0 +1,12 @@
[tool.black]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the configuration file for black.

@li-wu li-wu merged commit f30b25e into develop Apr 29, 2020
@li-wu li-wu deleted the feature/black branch May 7, 2020 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants