Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add Flake8 as check action
NyanKiyoshi81fa485ada7a
diff --git a/.github/main.workflow b/.github/main.workflowindex e6e6d6d1a2..6e5c93259f 100644--- a/.github/main.workflow+++ b/.github/main.workflow@@ -1,9 +1,30 @@workflow "Linters" {on = "push"- resolves = ["Black Linter"]+ 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 = "lgeiger/black-action@4379f39aa4b6a3bb1cceb46a7665b9c26647d82d"- args = ". --check"+ 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/"+ }}diff --git a/saleor/checkout/views/summary.py b/saleor/checkout/views/summary.pyindex e134bfeef0..d340725175 100644--- a/saleor/checkout/views/summary.py+++ b/saleor/checkout/views/summary.py@@ -58,7 +58,7 @@ def summary_with_shipping_view(request, checkout):checkout.user.addresses.all() if checkout.user else Address.objects.none())- addresses_form, address_form, updated = update_billing_address_in_checkout_with_shipping(+ addresses_form, address_form, updated = update_billing_address_in_checkout_with_shipping( # noqacheckout, user_addresses, request.POST or None, request.country)diff --git a/saleor/core/utils/random_data.py b/saleor/core/utils/random_data.pyindex 17d7c6932c..85116d8fbc 100644--- a/saleor/core/utils/random_data.py+++ b/saleor/core/utils/random_data.py@@ -824,8 +824,13 @@ def add_address_to_admin(email):def create_page():content = """<h2>E-commerce for the PWA era</h2>- <h3>A modular, high performance e-commerce storefront built with GraphQL, Django, and ReactJS.</h3>- <p>Saleor is a rapidly-growing open source e-commerce platform that has served high-volume companies from branches like publishing and apparel since 2012. Based on Python and Django, the latest major update introduces a modular front end with a GraphQL API and storefront and dashboard written in React to make Saleor a full-functionality open source e-commerce.</p>+ <h3>A modular, high performance e-commerce storefront built with GraphQL,+ Django, and ReactJS.</h3>+ <p>Saleor is a rapidly-growing open source e-commerce platform that has served+ high-volume companies from branches like publishing and apparel since 2012.+ Based on Python and Django, the latest major update introduces a modular+ front end with a GraphQL API and storefront and dashboard written in React+ to make Saleor a full-functionality open source e-commerce.</p><p><a href="https://github.com/mirumee/saleor">Get Saleor today!</a></p>"""content_json = {@@ -842,7 +847,8 @@ def create_page():{"key": "","data": {},- "text": "A modular, high performance e-commerce storefront built with GraphQL, Django, and ReactJS.",+ "text": "A modular, high performance e-commerce storefront "+ "built with GraphQL, Django, and ReactJS.","type": "unstyled","depth": 0,"entityRanges": [],@@ -860,7 +866,13 @@ def create_page():{"key": "","data": {},- "text": "Saleor is a rapidly-growing open source e-commerce platform that has served high-volume companies from branches like publishing and apparel since 2012. Based on Python and Django, the latest major update introduces a modular front end with a GraphQL API and storefront and dashboard written in React to make Saleor a full-functionality open source e-commerce.",+ "text": "Saleor is a rapidly-growing open source e-commerce platform "+ "that has served high-volume companies from branches like "+ "publishing and apparel since 2012. Based on Python and "+ "Django, the latest major update introduces a modular "+ "front end with a GraphQL API and storefront and dashboard "+ "written in React to make Saleor a full-functionality "+ "open source e-commerce.","type": "unstyled","depth": 0,"entityRanges": [],diff --git a/saleor/dashboard/product/forms.py b/saleor/dashboard/product/forms.pyindex fdd54dc0e2..a890a4733a 100644--- a/saleor/dashboard/product/forms.py+++ b/saleor/dashboard/product/forms.py@@ -385,9 +385,8 @@ class ProductVariantForm(forms.ModelForm, AttributesMixin):self.fields["price_override"].widget.attrs["placeholder"] = self.instance.product.price.amount- self.available_attributes = self.instance.product.product_type.variant_attributes.all().prefetch_related(- "values"- )+ qs = self.instance.product.product_type.variant_attributes.all()+ self.available_attributes = qs.prefetch_related("values")self.prepare_fields_for_attributes()if include_taxes_in_prices():diff --git a/saleor/graphql/account/__init__.py b/saleor/graphql/account/__init__.pyindex 7354438930..3fba9aefb3 100644--- a/saleor/graphql/account/__init__.py+++ b/saleor/graphql/account/__init__.py@@ -1 +1,2 @@+# flake8: noqafrom . import fieldsdiff --git a/saleor/graphql/core/__init__.py b/saleor/graphql/core/__init__.pyindex 7354438930..e069383dca 100644--- a/saleor/graphql/core/__init__.py+++ b/saleor/graphql/core/__init__.py@@ -1 +1 @@-from . import fields+from . import fields # noqadiff --git a/saleor/graphql/core/types/__init__.py b/saleor/graphql/core/types/__init__.pyindex 19a2edb59e..3ea384e89d 100644--- a/saleor/graphql/core/types/__init__.py+++ b/saleor/graphql/core/types/__init__.py@@ -1,3 +1,4 @@+# flake8: noqafrom .common import (CountryDisplay,Error,diff --git a/saleor/graphql/product/types/__init__.py b/saleor/graphql/product/types/__init__.pyindex 433abcd553..0c13108754 100644--- a/saleor/graphql/product/types/__init__.py+++ b/saleor/graphql/product/types/__init__.py@@ -1,3 +1,4 @@+# flake8: noqafrom .attributes import Attribute, AttributeValue, SelectedAttributefrom .digital_contents import DigitalContent, DigitalContentUrlfrom .products import (diff --git a/saleor/graphql/shipping/mutations.py b/saleor/graphql/shipping/mutations.pyindex fbdfc9dead..1f9eeca8c2 100644--- a/saleor/graphql/shipping/mutations.py+++ b/saleor/graphql/shipping/mutations.py@@ -116,8 +116,10 @@ class ShippingPriceMixin:):raise ValidationError({- "maximum_order_price": "Maximum order price should be larger than the "- "minimum order price."+ "maximum_order_price": (+ "Maximum order price should be larger than "+ "the minimum order price."+ )})else:@@ -130,8 +132,10 @@ class ShippingPriceMixin:):raise ValidationError({- "maximum_order_weight": "Maximum order weight should be larger than the "- "minimum order weight."+ "maximum_order_weight": (+ "Maximum order weight should be larger than the "+ "minimum order weight."+ )})return cleaned_inputdiff --git a/saleor/site/context_processors.py b/saleor/site/context_processors.pyindex f5c2c79860..1b1beb114b 100644--- a/saleor/site/context_processors.py+++ b/saleor/site/context_processors.py@@ -1,3 +1,4 @@+import django.http.requestfrom django.contrib.sites.shortcuts import get_current_sitefrom django.db.models import prefetch_related_objects