Skip to content

Commit 93ca54f

Browse files
committed
Add precommit and run precommit on all files
1 parent 724695a commit 93ca54f

13 files changed

+102
-40
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@
88
/build/
99

1010
/dist/
11+
/venv/

.pre-commit-config.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
- repo: https://github.com/pre-commit/pre-commit-hooks.git
2+
sha: v0.7.1
3+
hooks:
4+
- id: autopep8-wrapper
5+
- id: check-added-large-files
6+
- id: check-ast
7+
- id: check-byte-order-marker
8+
- id: check-case-conflict
9+
- id: check-docstring-first
10+
- id: check-json
11+
- id: check-merge-conflict
12+
- id: check-yaml
13+
- id: debug-statements
14+
- id: double-quote-string-fixer
15+
- id: end-of-file-fixer
16+
- id: flake8
17+
- id: fix-encoding-pragma
18+
- id: name-tests-test
19+
- id: pretty-format-json
20+
args: ['--autofix']
21+
- id: requirements-txt-fixer
22+
- id: trailing-whitespace
23+
- repo: https://github.com/asottile/pyupgrade
24+
sha: v1.0.4
25+
hooks:
26+
- id: pyupgrade
27+
- repo: https://github.com/asottile/reorder_python_imports
28+
sha: v0.3.2
29+
hooks:
30+
- id: reorder-python-imports

flask_graphql/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# -*- coding: utf-8 -*-
12
from .blueprint import GraphQL
23
from .graphqlview import GraphQLView
34

flask_graphql/blueprint.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# -*- coding: utf-8 -*-
12
import warnings
23

34
from flask import Blueprint

flask_graphql/graphqlview.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
1+
# -*- coding: utf-8 -*-
12
import json
23

34
import six
4-
from flask import Response, request
5+
from flask import request
6+
from flask import Response
57
from flask.views import View
6-
from werkzeug.exceptions import BadRequest, MethodNotAllowed
7-
8-
from graphql import Source, execute, parse, validate
8+
from graphql import execute
9+
from graphql import parse
10+
from graphql import Source
11+
from graphql import validate
912
from graphql.error import format_error as format_graphql_error
1013
from graphql.error import GraphQLError
1114
from graphql.execution import ExecutionResult
1215
from graphql.type.schema import GraphQLSchema
1316
from graphql.utils.get_operation_ast import get_operation_ast
17+
from werkzeug.exceptions import BadRequest
18+
from werkzeug.exceptions import MethodNotAllowed
1419

1520
from .render_graphiql import render_graphiql
1621

flask_graphql/render_graphiql.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# -*- coding: utf-8 -*-
12
from flask import render_template_string
23

34

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pre-commit==0.13.3

setup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
from setuptools import setup, find_packages
1+
# -*- coding: utf-8 -*-
2+
from setuptools import find_packages
3+
from setuptools import setup
24

35
required_packages = ['graphql-core>=1.0', 'flask>=0.7.0']
46

tests/app.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
# -*- coding: utf-8 -*-
12
from flask import Flask
2-
from flask_graphql import GraphQLView
3+
34
from .schema import Schema
5+
from flask_graphql import GraphQLView
46

57

68
def create_app(path='/graphql', **kwargs):

tests/schema.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
from graphql.type.definition import GraphQLArgument, GraphQLField, GraphQLNonNull, GraphQLObjectType
1+
# -*- coding: utf-8 -*-
2+
from graphql.type.definition import GraphQLArgument
3+
from graphql.type.definition import GraphQLField
4+
from graphql.type.definition import GraphQLNonNull
5+
from graphql.type.definition import GraphQLObjectType
26
from graphql.type.scalars import GraphQLString
37
from graphql.type.schema import GraphQLSchema
48

59

610
def resolve_raises(*_):
7-
raise Exception("Throws!")
11+
raise Exception('Throws!')
812

913

1014
QueryRootType = GraphQLObjectType(

0 commit comments

Comments
 (0)