Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Fix Codeclimate issues

Marcin Gębalaebd016b185ee
diff --git a/saleor/graphql/core/types/money.py b/saleor/graphql/core/types/money.py
index f8f82b89d2..7473d585f9 100644
--- a/saleor/graphql/core/types/money.py
+++ b/saleor/graphql/core/types/money.py
@@ -3,8 +3,6 @@ from textwrap import dedent
import graphene
from django_prices.templatetags import prices_i18n
-from ..utils import str_to_enum
-
class Money(graphene.ObjectType):
currency = graphene.String(description='Currency code.', required=True)
diff --git a/saleor/graphql/menu/enums.py b/saleor/graphql/menu/enums.py
index 4e58cec5b6..c374a83590 100644
--- a/saleor/graphql/menu/enums.py
+++ b/saleor/graphql/menu/enums.py
@@ -9,4 +9,6 @@ class NavigationType(graphene.Enum):
def description(self):
if self == NavigationType.MAIN:
return 'Main storefront\'s navigation.'
- return 'Secondary storefront\'s navigation.'
+ if self == NavigationType.SECONDARY:
+ return 'Secondary storefront\'s navigation.'
+ raise ValueError('Unsupported enum value: %s' % self.value)
diff --git a/saleor/graphql/payment/enums.py b/saleor/graphql/payment/enums.py
index 68aa4d6866..010568a7e8 100644
--- a/saleor/graphql/payment/enums.py
+++ b/saleor/graphql/payment/enums.py
@@ -25,3 +25,4 @@ class OrderAction(graphene.Enum):
return 'Represents a refund action.'
if self == OrderAction.VOID:
return 'Represents a void action.'
+ raise ValueError('Unsupported enum value: %s' % self.value)
diff --git a/saleor/graphql/product/enums.py b/saleor/graphql/product/enums.py
index d1e6f7e48d..9de057ac87 100644
--- a/saleor/graphql/product/enums.py
+++ b/saleor/graphql/product/enums.py
@@ -27,12 +27,11 @@ class ProductOrderField(graphene.Enum):
def description(self):
if self == ProductOrderField.NAME:
return 'Sort products by name.'
-
if self == ProductOrderField.PRICE:
return 'Sort products by price.'
-
if self == ProductOrderField.DATE:
return 'Sort products by update date.'
+ raise ValueError('Unsupported enum value: %s' % self.value)
class OrderDirection(graphene.Enum):
@@ -43,5 +42,6 @@ class OrderDirection(graphene.Enum):
def description(self):
if self == OrderDirection.ASC:
return 'Specifies an ascending sort order.'
- else:
+ if self == OrderDirection.DESC:
return 'Specifies a descending sort order.'
+ raise ValueError('Unsupported enum value: %s' % self.value)