-
Notifications
You must be signed in to change notification settings - Fork 139
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 and run precommit on all files #26
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ | |
/build/ | ||
|
||
/dist/ | ||
/venv/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
- repo: https://github.com/pre-commit/pre-commit-hooks.git | ||
sha: v0.7.1 | ||
hooks: | ||
- id: autopep8-wrapper | ||
- id: check-added-large-files | ||
- id: check-ast | ||
- id: check-byte-order-marker | ||
- id: check-case-conflict | ||
- id: check-docstring-first | ||
- id: check-json | ||
- id: check-merge-conflict | ||
- id: check-yaml | ||
- id: debug-statements | ||
- id: double-quote-string-fixer | ||
- id: end-of-file-fixer | ||
- id: flake8 | ||
- id: fix-encoding-pragma | ||
- id: name-tests-test | ||
- id: pretty-format-json | ||
args: ['--autofix'] | ||
- id: requirements-txt-fixer | ||
- id: trailing-whitespace | ||
- repo: https://github.com/asottile/pyupgrade | ||
sha: v1.0.4 | ||
hooks: | ||
- id: pyupgrade | ||
- repo: https://github.com/asottile/reorder_python_imports | ||
sha: v0.3.2 | ||
hooks: | ||
- id: reorder-python-imports | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# -*- coding: utf-8 -*- | ||
from .blueprint import GraphQL | ||
from .graphqlview import GraphQLView | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# -*- coding: utf-8 -*- | ||
import warnings | ||
|
||
from flask import Blueprint | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# -*- coding: utf-8 -*- | ||
from flask import render_template_string | ||
|
||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pre-commit==0.13.3 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd probably call this file There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, we usually don't pin specific versions for our dev dependencies, but that's totally up to you / the project's stance on that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe adding something like the following in the README will actually add more visibility into Yelp's pre-commit project and provide a better understanding to the developer, rather than using a CollaborateThis project is using pre-commit to help the developer run pre-commit hooks easily, allowing to autoformat Python files, reorder the imports, and other various checks. You can easily start using it via Thoughts? |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,3 +28,6 @@ deps = | |
Flask>=0.10.0 | ||
commands = | ||
isort --check-only flask_graphql/ -rc | ||
|
||
[pep8] | ||
max-line-length=120 |
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.
I've been using isort for checking the import ordering: https://github.com/graphql-python/flask-graphql/blob/master/tox.ini#L30.
Also being used in the automatic linters in
graphql-core
https://github.com/graphql-python/graphql-core/blob/master/bin/autolinter#L7, andgraphene
https://github.com/graphql-python/graphene/blob/master/bin/autolinter#L7.I kind of prefer it over
render-python-imports
as it seems it does a smarter import grouping, not requiring a import statement per imported var.If we could use
isort
instead ofrender-python-imports
would be great! :)