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

Add Python linting and reformatting #26

Merged
merged 6 commits into from
Oct 26, 2018
Merged

Conversation

pbugnion
Copy link
Member

@pbugnion pbugnion commented Oct 24, 2018

This PR adds flake8 and black to the build pipeline. Black enforces a consistent code style, and flake8 catches common errors like unused imports or unused variables.

I have used the same black configuration as sherlockml for consistency across ASI.

The only complexity is that flake8 needs to ignore specific components files in the documentation: the ones that require app to be injected when the code is executed. For now, this is just collapse.

This also adds a very basic check for syntax errors in the source code for all the versions of Python which I presume we want to target. Since Dash supports Python 2, the cost to supporting it seems minimal.

Copy link
Collaborator

@tcbegley tcbegley left a comment

Choose a reason for hiding this comment

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

This looks good @pbugnion!

I made a couple of comments about getting black and flake8 to work together nicely. Let me know what you think.

.travis.yml Show resolved Hide resolved
.travis.yml Show resolved Hide resolved
Black and Flake8 diverge on what PEP 8 compliance means. This is
detailed in the Black readme: https://github.com/ambv/black

To allow the two to work together, we have to silence some Flake8 errors.
@pbugnion
Copy link
Member Author

I've fixed the flake8 incompatibilities.

setup.cfg Show resolved Hide resolved
Copy link
Collaborator

@tcbegley tcbegley left a comment

Choose a reason for hiding this comment

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

I'm happy with this if you are @pbugnion

@pbugnion pbugnion merged commit dc32261 into master Oct 26, 2018
@pbugnion pbugnion deleted the python-linting-reformatting branch October 26, 2018 10:30
tcbegley pushed a commit that referenced this pull request Nov 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants