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 code formatter #3852

Merged
merged 18 commits into from
May 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ trim_trailing_whitespace = true
indent_size = 4
continuation_indent_size = 8
combine_as_imports = true
max_line_length = 79
max_line_length = 88
multi_line_output = 4
quote_type = single

Expand Down
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,8 @@ package-lock.json linguist-generated -diff -merge
# Precompiled emails templates
*.mjml linguist-generated

# Seeded isort known third parties
.isort.cfg linguist-generated

# Automatically resolve changelog conflicts
CHANGELOG.md merge=union
30 changes: 30 additions & 0 deletions .github/main.workflow
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
workflow "Linters" {
on = "push"
resolves = ["Black Linter", "Flake8 Linter"]
}

action "Build" {
uses = "jefftriplett/python-actions@ba888adab5b57956dce82b7dfc06e87b65090a6d"
args = "pip install flake8 black"
env = {
VENV_DIR = "/opt/"
}
}

action "Black Linter" {
uses = "jefftriplett/python-actions@ba888adab5b57956dce82b7dfc06e87b65090a6d"
args = "black --check saleor tests"
needs = ["Build"]
env = {
VENV_DIR = "/opt/"
}
}

action "Flake8 Linter" {
uses = "jefftriplett/python-actions@ba888adab5b57956dce82b7dfc06e87b65090a6d"
args = "flake8 saleor tests"
needs = ["Build"]
env = {
VENV_DIR = "/opt/"
}
}
2 changes: 2 additions & 0 deletions .isort.cfg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
repos:
- repo: https://github.com/ambv/black
rev: 18.9b0
hooks:
- id: black
language_version: python3

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.1.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: flake8

- repo: https://github.com/asottile/seed-isort-config
rev: v1.9.0
hooks:
- id: seed-isort-config

- repo: https://github.com/pre-commit/mirrors-isort
rev: v4.3.18
hooks:
- id: isort
2 changes: 1 addition & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
load-plugins=pylint.extensions.bad_builtin, pylint.extensions.mccabe, pylint_celery, pylint_django

[MESSAGES CONTROL]
disable=C0103, C0111, C0412, C1001, E1004, I0011, R0903, W0232, W0621
disable=C0103, C0111, C0330, C0412, C1001, E1004, I0011, R0903, W0232, W0621

[DESIGN]
max-complexity=5
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ All notable, unreleased changes to this project will be documented in this file.
- Reduce the time of tests execution by using dummy password hasher - #4083 by @korycins
- Add migrations since unnecessary indexes are removed in mptt model in [django-mptt/django-mptt#578](https://github.com/django-mptt/django-mptt/pull/578) - #4071 by @jxltom
- Update order events and order email events names in typescripts - #4089 by @jxltom
- Migrated code style to Black. Saleor now includes configurations and tools related to use black. - #3852 by krzysztofwolski and NyanKiyoshi


## 2.5.0
Expand Down
12 changes: 7 additions & 5 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ django-graphql-jwt = ">=0.1.13"
django-impersonate = ">=1.3"
django-measurement = "==3.0.0"
django-mptt = ">=0.7.1"
django-phonenumber-field = ">=1.3.0"
django-phonenumber-field = ">=1.3.0,<2.4.0"
django-prices = ">=1.0.2"
django-prices-openexchangerates = ">=1.0.0"
django-prices-vatlayer = ">=1.0.2"
Expand All @@ -47,16 +47,16 @@ graphene-django = ">=2.2"
Markdown = ">=2.4"
maxminddb = "*"
"maxminddb-geolite2" = "*"
phonenumberslite = ">=8.9.1"
phonenumberslite = ">=8.9.1,<8.10.10"
prices = ">=1.0.0"
"psycopg2-binary" = ">=2.7"
purl = ">=0.4.1"
raven = "==6.9.0"
requests = ">=1.2.0"
social-auth-app-django = ">=2.0.0"
text-unidecode = "*"
uwsgi = {version = ">=2.0.0", platform_system = "!= 'Windows'"}
celery = {version = ">=4.3", extras = ["redis"]}
uwsgi = {version = ">=2.0.0",platform_system = "!= 'Windows'"}
maarcingebala marked this conversation as resolved.
Show resolved Hide resolved
celery = {version = ">=4.3",extras = ["redis"]}
redis = "<4.0"
kombu = "<5.0.0"
weasyprint = ">=0.42.2"
Expand All @@ -65,7 +65,7 @@ braintree = "==3.49.0"
razorpay = ">=1.1.1"
stripe = "*"
"urllib3" = "*"
"dataclasses" = {version = "*", markers="python_version < '3.7'"}
dataclasses = {version = "*",markers = "python_version < '3.7'"}

[dev-packages]
pytest = "*"
Expand All @@ -87,3 +87,5 @@ yapf = "*"
django-extensions = "*"
pylint-plugin-utils = "*"
transifex-client = "*"
black = "==19.3b0"
NyanKiyoshi marked this conversation as resolved.
Show resolved Hide resolved
pre-commit = "*"