掘金 后端 ( ) • 2024-04-30 11:35

帮助莫纳什大学本科生,处理Python项目的CI/CD部署,使用Python的PyDocStyle、PyLine、Flake8、Mypy进行测试的一个项目,第一次接触Pyton全面测试,莫纳什大学本科生大二能接触到这些看来还是有一定含金量的。

Take1

在构建CI/CD管道时,我最初在使用配置文件创建静态分析时将所有阶段合并在一起,没有区别。在后来的过程中,我通过为每个阶段使用相同的艺名来解决这个问题。

测试时发生的测试用例不会通过代码纠正。

下面是我的代码:

stages:
  - Static Analysis 
  - Test

flake8:
  stage: Static Analysis
  script:
    - pip install flake8
    - flake8 megamart.py
  allow_failure: true

mypy:
  stage: Static Analysis  
  script:
    - pip install mypy
    - mypy megamart.py
  allow_failure: true

pycodestyle:
  stage: Static Analysis
  script: 
    - pip install pycodestyle
    - pycodestyle megamart.py 
  allow_failure: true

pydocstyle:
  stage: Static Analysis
  script:
    - pip install pydocstyle
    - pydocstyle megamart.py
  allow_failure: true

pylint:
  stage: Static Analysis
  script:
    - pip install pylint
    - pylint megamart.py
  allow_failure: true

testing:
  stage: Test
  script:
    - python -m unittest test_megamart.py
  allow_failure: false

Take2

PyDocStyle

D200:单行文档字符串应与引号放在一行(找到4):

from datetime import datetime
"""
This is the Megamart module.

It is Megamart
"""
from datetime import datetime

D205:摘要行和说明之间需要1个空行

def is_not_allowed_to_purchase_item(item: Item, customer: Customer, purchase_date_string: str) -> bool:
  """
  Returns True if the customer is not allowed to purchase the specified item, False otherwise.
  If an item object or the purchase date string was not actually provided, an Exception should be raised.
  Items that are under the alcohol, tobacco or knives category may only be sold to customers who are aged 18+ and have their ID verified.
  An item potentially belongs to many categories - as long as it belongs to at least one of the three categories above, restrictions apply to that item.
  The checking of an item's categories against restricted categories should be done in a case-insensitive manner.
   For example, if an item A is in the category ['Alcohol'] and item B is in the category ['ALCOHOL'], both items A and B should be identified as restricted items.
  Even if the customer is aged 18+ and is verified, they must provide/link their member account to the transaction when purchasing restricted items.
  Otherwise, if a member account is not provided, they will not be allowed to purchase the restricted item even if normally allowed to.
  It is optional for customers to provide their date of birth in their profile.
  Purchase date string should be of the format dd/mm/yyyy.
  The age of the customer is calculated from their specified date of birth, which is also of the format dd/mm/yyyy.
  If an item is a restricted item but the purchase or birth date is in the incorrect format, an Exception should be raised.
  A customer whose date of birth is 01/08/2005 is only considered to be age 18+ on or after 01/08/2023.
  """
def is_not_allowed_to_purchase_item(item: Item, customer: Customer, purchase_date_string: str) -> bool:
  """
  Returns True if the customer is not allowed to purchase the specified item, False otherwise.

  Args:
      item (Item): The item being purchased.
      customer (Customer): The customer attempting the purchase.
      purchase_date_string (str): The purchase date in the format dd/mm/yyyy.

  Raises:
      Exception: If the provided item is None.

  If an item object or the purchase date string was not actually provided, an Exception should be raised.
  Items that are under the alcohol, tobacco or knives category may only be sold to customers who are aged 18+ and have their ID verified.
  An item potentially belongs to many categories - as long as it belongs to at least one of the three categories above, restrictions apply to that item.
  The checking of an item's categories against restricted categories should be done in a case-insensitive manner.
  For example, if an item A is in the category ['Alcohol'] and item B is in the category ['ALCOHOL'], both items A and B should be identified as restricted items.
  Even if the customer is aged 18+ and is verified, they must provide/link their member account to the transaction when purchasing restricted items.
  Otherwise, if a member account is not provided, they will not be allowed to purchase the restricted item even if normally allowed to.
  It is optional for customers to provide their date of birth in their profile.
  Purchase date string should be of the format dd/mm/yyyy.
  The age of the customer is calculated from their specified date of birth, which is also of the format dd/mm/yyyy.
  If an item is a restricted item but the purchase or birth date is in the incorrect format, an Exception should be raised.
  A customer whose date of birth is 01/08/2005 is only considered to be age 18+ on or after 01/08/2023.
  """

D401: First line should be in imperative mood

def is_not_allowed_to_purchase_item(item: Item, customer: Customer, purchase_date_string: str) -> bool:
  """
  Returns True if the customer is not allowed to purchase the specified item, False otherwise.

  Args:
      item (Item): The item being purchased.
      customer (Customer): The customer attempting the purchase.
      purchase_date_string (str): The purchase date in the format dd/mm/yyyy.
def is_not_allowed_to_purchase_item(item: Item, customer: Customer, purchase_date_string: str) -> bool:
  """
  Determine if the customer is allowed to purchase the specified item.

  Returns True if the customer is not allowed to purchase the specified item, False otherwise.

  Args:
      item (Item): The item being purchased.
      customer (Customer): The customer attempting the purchase.
      purchase_date_string (str): The purchase date in the format dd/mm/yyyy.

D202:函数docstring后面不允许有空行(找到1)

def calculate_fulfilment_surcharge(fulfilment_type: FulfilmentType, customer: Customer) -> float:
  """
  Currently, a fulfilment surcharge is only applicable for deliveries. There is no surcharge applied in any other case.

  The fulfilment surcharge is calculated as $5 or $0.50 for every kilometre, whichever is greater.
  Surcharge value returned should have at most two decimal places.
  If a fulfilment type was not actually provided, an Exception should be raised.
  Delivery fulfilment type can only be used if the customer has linked their member account to the transaction, and if delivery distance is specified in their member profile.
   Otherwise, a FulfilmentException should be raised.
  """

  if fulfilment_type == FulfilmentType.DELIVERY: # checks that fulfilment is of type delivery
    if customer == None:
def calculate_fulfilment_surcharge(fulfilment_type: FulfilmentType, customer: Customer) -> float:
  """
  Currently, a fulfilment surcharge is only applicable for deliveries. There is no surcharge applied in any other case.

  The fulfilment surcharge is calculated as $5 or $0.50 for every kilometre, whichever is greater.
  Surcharge value returned should have at most two decimal places.
  If a fulfilment type was not actually provided, an Exception should be raised.
  Delivery fulfilment type can only be used if the customer has linked their member account to the transaction, and if delivery distance is specified in their member profile.
   Otherwise, a FulfilmentException should be raised.
  """
  if fulfilment_type == FulfilmentType.DELIVERY: # checks that fulfilment is of type delivery
    if customer == None:

D300:使用“”“三重双引号”“”(找到’’’-引号)

def get_item_purchase_quantity_limit(item: Item, items_dict: Dict[str, Tuple[Item, int, Optional[int]]]) -> Optional[int]:
  '''
  For a given item, returns the integer purchase quantity limit.

  If an item object or items dictionary was not actually provided, an Exception should be raised.
  If the item was not found in the items dictionary or if the item does not have a purchase quantity limit, None should be returned.
  The items dictionary (which is a mapping from keys to values) contains string item IDs as its keys,
   and tuples containing an item object, integer stock level and an optional integer purchase quantity limit (which may be None) that correspond to their respective item ID as values.
  '''
  # check that an item object is provided provided.
  if item is None:
    raise Exception("Invalid input: item is not provided")
def get_item_purchase_quantity_limit(item: Item, items_dict: Dict[str, Tuple[Item, int, Optional[int]]]) -> Optional[int]:
  """
  For a given item, returns the integer purchase quantity limit.

  If an item object or items dictionary was not actually provided, an Exception should be raised.
  If the item was not found in the items dictionary or if the item does not have a purchase quantity limit, None should be returned.
  The items dictionary (which is a mapping from keys to values) contains string item IDs as its keys,
   and tuples containing an item object, integer stock level and an optional integer purchase quantity limit (which may be None) that correspond to their respective item ID as values.
  """
  # check that an item object is provided provided.
  if item is None:
    raise Exception("Invalid input: item is not provided")

PyLine

C0301:行太长(103/100)(行太长)

def is_not_allowed_to_purchase_item(item: Item, customer: Customer, purchase_date_string: str) -> bool:
  """
  Determine if the customer is allowed to purchase the specified item.

  Returns True if the customer is not allowed to purchase the specified item, False otherwise.
def is_not_allowed_to_purchase_item(item: Item, 
                                    customer: Customer, 
                                    purchase_date_string: str) -> bool:
  """
  Determine if the customer is allowed to purchase the specified item.

  Returns True if the customer is not allowed to purchase the specified item, False otherwise.

  Args:
      item (Item): The item being purchased.
      customer (Customer): The customer attempting the purchase.
      purchase_date_string (str): The purchase date in the format dd/mm/yyyy.

W0311:缩进不良。找到2个空格,应为4个(缩进错误)

def is_not_allowed_to_purchase_item(item: Item,
                                    customer: Customer,
                                    purchase_date_string: str) -> bool:
  """
   Determine if the customer is allowed to purchase the specified item.

  Returns True if the customer is not allowed to purchase the specified item, False otherwise.

  Args:
def is_not_allowed_to_purchase_item(item: Item,
                                    customer: Customer,
                                    purchase_date_string: str) -> bool:
    """
    Determine if the customer is allowed to purchase the specified item.

    Returns True if the customer is not allowed to purchase the specified item, False otherwise.

    Args:
      item (Item): The item being purchased.
      customer (Customer): The customer attempting the purchase.
      purchase_date_string (str): The purchase date in the format dd/mm/yyyy.

    Raises:

C0303:尾随空格(尾随空格)

       return items_dict[item_id][2]
    except IndexError:
        return None
 

# print(get_item_purchase_quantity_limit
# (Item('
   try:
      # check if item has a purchase limit
        if items_dict[item_id][2] is None:
            return None

        return items_dict[item_id][2]
    except IndexError:
        return None
# print(get_item_purchase_quantity_limit
# (Item('1', 'Tim Tam - Chocolate', 4.50,
# ['Confectionery', 'Biscuits']),
# {'1':(Item('1', 'Tim Tam - Chocolate', 4.50, ['Confectionery', 'Biscuits']),2,100)}))
def is_item_sufficiently_stocked(item: Item, purchase_quantity: int, items_dict: Dict[str, Tuple[Item, int, Optional[int]]]) -> bool:
  """

W0611:从InfuffentFundsException导入的未使用的InfuffentFundsException(未使用的导入)

from InsufficientFundsException import InsufficientFundsException
# from InsufficientFundsException import InsufficientFundsException

W0719:引发太一般异常:异常(引发广泛异常)

# check that dictionary provided
  if discounts_dict is None:
    raise Exception("Invalid input: discounts_dict not provided")
Create class:
class InvalidInputError(Exception):
    """Custom exception for invalid input errors."""
    pass
  if discounts_dict is None:
    raise InvalidInputError("Invalid input: discounts_dict not provided")

R1714:考虑通过使用“payment_method in(PaymentMethod.CREDIT,PaymentMethod.DEBIT)”将这些比较与“in”合并。如果元素是可散列的,请使用集合。(考虑使用输入)

if payment_method == PaymentMethod.CREDIT or payment_method == PaymentMethod.DEBIT:
if payment_method == PaymentMethod.CREDIT or payment_method == PaymentMethod.DEBIT:
    return round(subtotal, 2)

R0914: Too many local variables (17/15) (too-many-locals)

def checkout(transaction: Transaction,
             items_dict: Dict[str, Tuple[Item, int, Optional[int]]],
             discounts_dict: Dict[str, Discount]) -> Transaction:

C0121:比较“fulfilment_type==None”应该是“fulfilment_type is None”(单例比较)

  elif fulfilment_type == None: # if no fulfilment type provided
    raise InvalidInputError("Invalid input: discounts_dict not provided")
elif fulfilment_type is None:

W0707:考虑使用“except ValueError as exc”和“raise InvalidInputError”显式地重新引发

d输入:purchase_date_string和customer date of birth字符串的格式必须是DD/MM/YYYY')from exc'(raise-missing-from)

  except ValueError:
            raise InvalidInputError("Invalid input: purchase_date_string "
                            "and customer date of birth string "
                            "must be in the format DD/MM/YYYY")
except ValueError as exc:
    raise InvalidInputError("Invalid input: purchase_date_string and customer date of birth string must be in the format DD/MM/YYYY") from exc

C0305Trailing newlines (trailing-newlines)


#### END
#### END

PyDocstyle

D207:文档字符串缩进不足

"""
    For a given item, returns the integer purchase quantity limit.
  
    If an item object or items dictionary was not actually provided,
     an Exception should be raised.
    If the item was not found in the items dictionary or
    if the item does not have a purchase quantity limit,
    None should be returned.
    The items dictionary (which is a mapping from keys to values)
     contains string item IDs as its keys,
     and tuples containing an item object, integer stock level and
      an optional integer purchase quantity limit
      (which may be None) that correspond to their respective
      item ID as values.
    """
 """
    For a given item, returns the integer purchase quantity limit.

    If an item object or items dictionary was not actually provided,
     an Exception should be raised.
    If the item was not found in the items dictionary or
    if the item does not have a purchase quantity limit,
    None should be returned.
    The items dictionary (which is a mapping from keys to values)
     contains string item IDs as its keys,
     and tuples containing an item object, integer stock level and
      an optional integer purchase quantity limit
      (which may be None) that correspond to their respective
      item ID as values.
    """

D205:摘要行和说明之间需要1个空行(找到0)

  """

    For a given item, returns True if the purchase quantity does not
     exceed the currently available stock, or False

    if it exceeds,or the item was not found in the items dictionary.

    If an item object, purchase quantity or items dictionary was not
     actually provided, an Exception should be ra
Add
"""
Determine if the customer is allowed to purchase the specified item.

D400:第一行应该以句点结尾(不是’t’)

Determine Savings on an item is defined as how much money you would not
    need to spend on an item compared to if you bought it at its original price.
    If an item's original price or final price was not actually provided,
    an Exception should be raised.

    If the final price of the item is greater than its original price,
     an Exception should be raised.
 """
    Determine whether to increase the surcharge.

    Determine Savings on an item is defined as how much money you would not
    need to spend on an item compared to if you bought it at its original price.
    If an item's original price or final price was not actually provided,
    an Exception should be raised.

    If the final price of the item is greater than its original price,
     an Exception should be raised.
    """

Lizard

Flake8

D400: The first line should end with a period (not't ')

# You are to complete the implementation for the eight methods below:
#### START
# You are to complete the implementation for the eight methods below:
# START

E501行太长(93>79个字符)

#   "1" : (Item('1', 'Tim Tam - Chocolate', 4.50, ['Confectionery', 'Biscuits']),10,5),
#   "2" : (Item('2', 'Coffee Powder', 16.00, ['Coffee', 'Drinks']),20,5),
# }
#   "1" : (Item('1', 'Tim Tam - Chocolate', 4.50, 
#   ['Confectionery', 'Biscuits']),10,5),
#   "2" : (Item('2', 'Coffee Powder', 16.00,
#   ['Coffee', 'Drinks']),20,5),
# }

E231“,”后缺少空格

transaction.all_items_subtotal = round(totals["subtotal"],2)
    transaction.fulfilment_surcharge_amount = round(surcharge,2)
    transaction.rounding_amount_applied = round(rounding,2)
    transaction.final_total = round(total,2)
    transaction.amount_saved = round(totals["total_savings"],2)
transaction.all_items_subtotal = round(totals["subtotal"], 2)
    transaction.fulfilment_surcharge_amount = round(surcharge, 2)
    transaction.rounding_amount_applied = round(rounding, 2)
    transaction.final_total = round(total, 2)
    transaction.amount_saved = round(totals["total_savings"], 2)

E303空行太多(%2)

 totals["total_savings"] += calculate_item_savings(item_original_cost,
                                                item_final_cost)*transaction_line.quantity


        # adds on items purchased
        totals["items_purchased"] += transaction_line.quantity
        totals["total_savings"] += calculate_item_savings(item_original_cost,
                                                item_final_cost)*transaction_line.quantity
        # adds on items purchased
        totals["items_purchased"] += transaction_line.quantity

E302需要2个空行,找到1


# print(round_off_subtotal(1.96532534,PaymentMethod.CASH))
def checkout(transaction: Transaction,
             items_dict: Dict[str, Tuple[Item, int, Optional[int]]],
             discounts_dict: Dict[str, Discount]) -> Transaction:
# print(round_off_subtotal(1.96532534,PaymentMethod.CASH))
def checkout(transaction: Transaction,
             items_dict: Dict[str, Tuple[Item, int, Optional[int]]],
             discounts_dict: Dict[str, Discount]) -> Transaction:

E128 continuation line under-indented for visual indent

def get_item_purchase_quantity_limit(item: Item,
                                     items_dict: Dict[str, Tuple[Item, int,
                                     Optional[int]]]) -> Optional[int]:
def get_item_purchase_quantity_limit(item: Item,
                                     items_dict:
                                     Dict
                                     [str, Tuple[Item, int, Optional[int]]])\
        -> Optional[int]:

    """

Mypy

error: Incompatible types in assignment (expression has type "None", variable has type "str")

  date: str = None # format: dd/mm/YYYY e.g. 01/08/2023
  date: str = "" # format: dd/mm/YYYY e.g. 01/08/2023

error: Incompatible types in assignment (expression has type "float", target has type "int")

        totals["subtotal"] += transaction_line.final_cost
if transaction.payment_method is not None:
    total = round_off_subtotal(surcharge_total, transaction.payment_method)
else:
    # Provide a default PaymentMethod value, such as PaymentMethod.CASH
    total = round_off_subtotal(surcharge_total, PaymentMethod.CASH)

error: Argument 2 to "calculate_fulfilment_surcharge" has incompatible type "Customer | None"; expected "Customer" [arg-type]

surcharge = calculate_fulfilment_surcharge(transaction.fulfilment_type,
                                               transaction.customer)
    if transaction.customer is not None and transaction.fulfilment_type is not None:
        surcharge = calculate_fulfilment_surcharge(transaction.fulfilment_type, transaction.customer)
    else:
        # Handle the case where transaction.customer or transaction.fulfilment_type is None
        surcharge = 0  # or provide a default value or handle the case as needed

Comparison Summary Table

Aspects/Tools pycodestyles pydocstyles pylint pyflakes mypy lizard Total Issues found across all files in the entire repository 19 300 283 302 15 Score (if any) Issues found fo 19 300 283 302 15 Fixed Issues for the megamart.py All All All All All Remaining Issues Unfixed 0 0 0 0 0

Conclusions and recommendations

在“megamart”文件中,最常见的问题是“pyflakes”,其次是“pydocstyles”。这些问题大多与代码注释有关。为了解决这些问题,建议保持代码注释简洁,并遵循一致的代码格式标准。如果您使用的是集成开发环境(IDE),请考虑为自动代码格式化配置插件。

最复杂的函数是“checkout”,因为它涉及18个逻辑条件,包括检查空值和特定的数据类型。

Take3

Appendix

pylint_output.txt

megamart.py:22:0: C0301: Line too long (103/100) (line-too-long)
megamart.py:25:0: C0301: Line too long (105/100) (line-too-long)
megamart.py:26:0: C0301: Line too long (137/100) (line-too-long)
megamart.py:27:0: C0301: Line too long (152/100) (line-too-long)
megamart.py:28:0: C0301: Line too long (113/100) (line-too-long)
megamart.py:29:0: C0301: Line too long (163/100) (line-too-long)
megamart.py:30:0: C0301: Line too long (148/100) (line-too-long)
megamart.py:31:0: C0301: Line too long (135/100) (line-too-long)
megamart.py:34:0: C0301: Line too long (115/100) (line-too-long)
megamart.py:35:0: C0301: Line too long (123/100) (line-too-long)
megamart.py:36:0: C0301: Line too long (103/100) (line-too-long)
megamart.py:23:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:39:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:40:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:43:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:45:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:48:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:50:0: W0311: Bad indentation. Found 6 spaces, expected 12 (bad-indentation)
megamart.py:52:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:53:0: W0311: Bad indentation. Found 6 spaces, expected 12 (bad-indentation)
megamart.py:56:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:57:0: W0311: Bad indentation. Found 6 spaces, expected 12 (bad-indentation)
megamart.py:60:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:61:0: W0311: Bad indentation. Found 6 spaces, expected 12 (bad-indentation)
megamart.py:64:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:65:0: W0311: Bad indentation. Found 6 spaces, expected 12 (bad-indentation)
megamart.py:68:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:69:0: C0301: Line too long (127/100) (line-too-long)
megamart.py:69:0: W0311: Bad indentation. Found 6 spaces, expected 12 (bad-indentation)
megamart.py:71:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:74:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:75:0: C0301: Line too long (144/100) (line-too-long)
megamart.py:75:0: W0311: Bad indentation. Found 6 spaces, expected 12 (bad-indentation)
megamart.py:76:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:77:0: C0301: Line too long (127/100) (line-too-long)
megamart.py:77:0: W0311: Bad indentation. Found 6 spaces, expected 12 (bad-indentation)
megamart.py:80:0: C0301: Line too long (134/100) (line-too-long)
megamart.py:80:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:82:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:83:0: W0311: Bad indentation. Found 6 spaces, expected 12 (bad-indentation)
megamart.py:84:0: C0303: Trailing whitespace (trailing-whitespace)
megamart.py:86:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:89:0: C0301: Line too long (161/100) (line-too-long)
megamart.py:92:0: C0301: Line too long (122/100) (line-too-long)
megamart.py:96:0: C0301: Line too long (132/100) (line-too-long)
megamart.py:97:0: C0301: Line too long (101/100) (line-too-long)
megamart.py:98:0: C0301: Line too long (183/100) (line-too-long)
megamart.py:93:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:101:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:102:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:105:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:106:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:108:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:111:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:112:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:114:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:116:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:117:0: W0311: Bad indentation. Found 6 spaces, expected 12 (bad-indentation)
megamart.py:119:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:120:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:121:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:122:0: C0303: Trailing whitespace (trailing-whitespace)
megamart.py:124:0: C0301: Line too long (196/100) (line-too-long)
megamart.py:127:0: C0301: Line too long (133/100) (line-too-long)
megamart.py:129:0: C0301: Line too long (179/100) (line-too-long)
megamart.py:130:0: C0301: Line too long (116/100) (line-too-long)
megamart.py:131:0: C0301: Line too long (158/100) (line-too-long)
megamart.py:132:0: C0301: Line too long (101/100) (line-too-long)
megamart.py:133:0: C0301: Line too long (183/100) (line-too-long)
megamart.py:128:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:136:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:137:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:140:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:141:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:144:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:145:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:148:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:149:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:152:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:153:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:154:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:155:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:156:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:159:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:160:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:163:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:164:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:165:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:167:0: C0301: Line too long (198/100) (line-too-long)
megamart.py:173:0: C0301: Line too long (101/100) (line-too-long)
megamart.py:174:0: C0301: Line too long (124/100) (line-too-long)
megamart.py:175:0: C0301: Line too long (120/100) (line-too-long)
megamart.py:176:0: C0301: Line too long (107/100) (line-too-long)
megamart.py:177:0: C0301: Line too long (155/100) (line-too-long)
megamart.py:178:0: C0301: Line too long (108/100) (line-too-long)
megamart.py:179:0: C0301: Line too long (181/100) (line-too-long)
megamart.py:180:0: C0301: Line too long (163/100) (line-too-long)
megamart.py:181:0: C0301: Line too long (119/100) (line-too-long)
megamart.py:171:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:183:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:184:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:185:0: C0303: Trailing whitespace (trailing-whitespace)
megamart.py:186:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:187:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:189:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:192:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:193:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:195:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:198:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:201:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:202:0: C0301: Line too long (102/100) (line-too-long)
megamart.py:202:0: W0311: Bad indentation. Found 6 spaces, expected 12 (bad-indentation)
megamart.py:205:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:207:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:210:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:213:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:214:0: C0301: Line too long (138/100) (line-too-long)
megamart.py:214:0: W0311: Bad indentation. Found 6 spaces, expected 12 (bad-indentation)
megamart.py:215:0: C0303: Trailing whitespace (trailing-whitespace)
megamart.py:217:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:218:0: C0301: Line too long (132/100) (line-too-long)
megamart.py:218:0: W0311: Bad indentation. Found 6 spaces, expected 12 (bad-indentation)
megamart.py:220:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:222:0: C0301: Line too long (149/100) (line-too-long)
megamart.py:228:0: C0301: Line too long (140/100) (line-too-long)
megamart.py:229:0: C0301: Line too long (102/100) (line-too-long)
megamart.py:227:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:232:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:233:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:235:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:236:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:238:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:239:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:241:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:246:0: C0301: Line too long (119/100) (line-too-long)
megamart.py:250:0: C0301: Line too long (174/100) (line-too-long)
megamart.py:245:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:254:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:255:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:256:0: W0311: Bad indentation. Found 6 spaces, expected 12 (bad-indentation)
megamart.py:257:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:258:0: W0311: Bad indentation. Found 6 spaces, expected 12 (bad-indentation)
megamart.py:259:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:260:0: W0311: Bad indentation. Found 6 spaces, expected 12 (bad-indentation)
megamart.py:263:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:264:0: W0311: Bad indentation. Found 6 spaces, expected 12 (bad-indentation)
megamart.py:265:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:267:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:268:0: W0311: Bad indentation. Found 6 spaces, expected 12 (bad-indentation)
megamart.py:269:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:270:0: C0303: Trailing whitespace (trailing-whitespace)
megamart.py:271:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:272:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:273:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:274:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:276:0: C0301: Line too long (129/100) (line-too-long)
megamart.py:285:0: C0301: Line too long (130/100) (line-too-long)
megamart.py:286:0: C0301: Line too long (144/100) (line-too-long)
megamart.py:287:0: C0301: Line too long (143/100) (line-too-long)
megamart.py:281:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:291:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:292:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:295:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:296:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:299:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:300:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:301:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:302:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:304:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:308:0: C0301: Line too long (147/100) (line-too-long)
megamart.py:311:0: C0301: Line too long (104/100) (line-too-long)
megamart.py:312:0: C0301: Line too long (128/100) (line-too-long)
megamart.py:314:0: C0301: Line too long (130/100) (line-too-long)
megamart.py:315:0: C0301: Line too long (153/100) (line-too-long)
megamart.py:316:0: C0301: Line too long (119/100) (line-too-long)
megamart.py:317:0: C0301: Line too long (108/100) (line-too-long)
megamart.py:319:0: C0301: Line too long (151/100) (line-too-long)
megamart.py:320:0: C0301: Line too long (184/100) (line-too-long)
megamart.py:309:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:325:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:326:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:329:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:330:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:333:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:334:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:337:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:340:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:343:44: C0303: Trailing whitespace (trailing-whitespace)
megamart.py:343:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:344:0: C0303: Trailing whitespace (trailing-whitespace)
megamart.py:345:0: C0303: Trailing whitespace (trailing-whitespace)
megamart.py:347:100: C0303: Trailing whitespace (trailing-whitespace)
megamart.py:347:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:348:0: C0301: Line too long (176/100) (line-too-long)
megamart.py:348:0: W0311: Bad indentation. Found 6 spaces, expected 12 (bad-indentation)
megamart.py:349:0: C0303: Trailing whitespace (trailing-whitespace)
megamart.py:351:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:353:0: C0301: Line too long (136/100) (line-too-long)
megamart.py:354:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:355:0: W0311: Bad indentation. Found 6 spaces, expected 12 (bad-indentation)
megamart.py:356:0: W0311: Bad indentation. Found 8 spaces, expected 16 (bad-indentation)
megamart.py:357:0: W0311: Bad indentation. Found 10 spaces, expected 20 (bad-indentation)
megamart.py:358:0: C0301: Line too long (183/100) (line-too-long)
megamart.py:358:0: W0311: Bad indentation. Found 10 spaces, expected 20 (bad-indentation)
megamart.py:359:0: C0303: Trailing whitespace (trailing-whitespace)
megamart.py:361:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:362:0: W0311: Bad indentation. Found 6 spaces, expected 12 (bad-indentation)
megamart.py:365:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:368:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:369:0: C0301: Line too long (192/100) (line-too-long)
megamart.py:369:0: W0311: Bad indentation. Found 6 spaces, expected 12 (bad-indentation)
megamart.py:373:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:374:0: C0303: Trailing whitespace (trailing-whitespace)
megamart.py:376:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:379:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:380:0: C0303: Trailing whitespace (trailing-whitespace)
megamart.py:382:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:384:0: C0301: Line too long (116/100) (line-too-long)
megamart.py:386:0: C0301: Line too long (105/100) (line-too-long)
megamart.py:386:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:387:0: C0303: Trailing whitespace (trailing-whitespace)
megamart.py:390:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:394:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:395:0: C0301: Line too long (190/100) (line-too-long)
megamart.py:395:0: W0311: Bad indentation. Found 6 spaces, expected 12 (bad-indentation)
megamart.py:396:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:397:0: C0301: Line too long (164/100) (line-too-long)
megamart.py:397:0: W0311: Bad indentation. Found 6 spaces, expected 12 (bad-indentation)
megamart.py:398:0: W0311: Bad indentation. Found 4 spaces, expected 8 (bad-indentation)
megamart.py:401:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:404:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:407:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:408:0: C0303: Trailing whitespace (trailing-whitespace)
megamart.py:410:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:414:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:415:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:416:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:417:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:418:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:419:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:420:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:428:0: C0303: Trailing whitespace (trailing-whitespace)
megamart.py:430:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
megamart.py:467:0: C0301: Line too long (154/100) (line-too-long)
megamart.py:470:0: C0305: Trailing newlines (trailing-newlines)
megamart.py:1:0: C0114: Missing module docstring (missing-module-docstring)
megamart.py:40:4: W0719: Raising too general exception: Exception (broad-exception-raised)
megamart.py:69:6: W0719: Raising too general exception: Exception (broad-exception-raised)
megamart.py:77:6: W0707: Consider explicitly re-raising using 'except ValueError as exc' and 'raise Exception('Invalid input: purchase_date_string and customer date of birth string must be in the format DD/MM/YYYY') from exc' (raise-missing-from)
megamart.py:77:6: W0719: Raising too general exception: Exception (broad-exception-raised)
megamart.py:22:0: R0911: Too many return statements (7/6) (too-many-return-statements)
megamart.py:102:4: W0719: Raising too general exception: Exception (broad-exception-raised)
megamart.py:106:4: W0719: Raising too general exception: Exception (broad-exception-raised)
megamart.py:137:4: W0719: Raising too general exception: Exception (broad-exception-raised)
megamart.py:141:4: W0719: Raising too general exception: Exception (broad-exception-raised)
megamart.py:145:4: W0719: Raising too general exception: Exception (broad-exception-raised)
megamart.py:149:4: W0719: Raising too general exception: Exception (broad-exception-raised)
megamart.py:160:4: W0719: Raising too general exception: Exception (broad-exception-raised)
megamart.py:184:4: W0719: Raising too general exception: Exception (broad-exception-raised)
megamart.py:187:4: W0719: Raising too general exception: Exception (broad-exception-raised)
megamart.py:202:6: W0719: Raising too general exception: Exception (broad-exception-raised)
megamart.py:214:6: W0719: Raising too general exception: Exception (broad-exception-raised)
megamart.py:218:6: W0719: Raising too general exception: Exception (broad-exception-raised)
megamart.py:233:4: W0719: Raising too general exception: Exception (broad-exception-raised)
megamart.py:236:4: W0719: Raising too general exception: Exception (broad-exception-raised)
megamart.py:239:4: W0719: Raising too general exception: Exception (broad-exception-raised)
megamart.py:254:2: R1705: Unnecessary "elif" after "return", remove the leading "el" from "elif" (no-else-return)
megamart.py:255:7: C0121: Comparison 'customer == None' should be 'customer is None' (singleton-comparison)
megamart.py:257:7: C0121: Comparison 'customer.membership_number == None' should be 'customer.membership_number is None' (singleton-comparison)
megamart.py:259:7: C0121: Comparison 'customer.delivery_distance_km == None' should be 'customer.delivery_distance_km is None' (singleton-comparison)
megamart.py:264:6: W0719: Raising too general exception: Exception (broad-exception-raised)
megamart.py:271:7: C0121: Comparison 'fulfilment_type == None' should be 'fulfilment_type is None' (singleton-comparison)
megamart.py:272:4: W0719: Raising too general exception: Exception (broad-exception-raised)
megamart.py:292:4: W0719: Raising too general exception: Exception (broad-exception-raised)
megamart.py:296:4: W0719: Raising too general exception: Exception (broad-exception-raised)
megamart.py:299:2: R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
megamart.py:299:5: R1714: Consider merging these comparisons with 'in' by using 'payment_method in (PaymentMethod.CREDIT, PaymentMethod.DEBIT)'. Use a set instead if elements are hashable. (consider-using-in)
megamart.py:308:0: R0914: Too many local variables (17/15) (too-many-locals)
megamart.py:326:4: W0719: Raising too general exception: Exception (broad-exception-raised)
megamart.py:330:4: W0719: Raising too general exception: Exception (broad-exception-raised)
megamart.py:334:4: W0719: Raising too general exception: Exception (broad-exception-raised)
megamart.py:6:0: W0611: Unused TransactionLine imported from TransactionLine (unused-import)
megamart.py:16:0: W0611: Unused InsufficientFundsException imported from InsufficientFundsException (unused-import)

pydocstyle_output.txt

megamart.py:1 at module level:
        D100: Missing docstring in public module
megamart.py:23 in public function `is_not_allowed_to_purchase_item`:
        D205: 1 blank line required between summary line and description (found 0)
megamart.py:23 in public function `is_not_allowed_to_purchase_item`:
        D401: First line should be in imperative mood (perhaps 'Return', not 'Returns')
megamart.py:93 in public function `get_item_purchase_quantity_limit`:
        D205: 1 blank line required between summary line and description (found 0)
megamart.py:93 in public function `get_item_purchase_quantity_limit`:
        D300: Use """triple double quotes""" (found '''-quotes)
megamart.py:128 in public function `is_item_sufficiently_stocked`:
        D205: 1 blank line required between summary line and description (found 0)
megamart.py:171 in public function `calculate_final_item_price`:
        D205: 1 blank line required between summary line and description (found 0)
megamart.py:171 in public function `calculate_final_item_price`:
        D401: First line should be in imperative mood; try rephrasing (found 'An')
megamart.py:227 in public function `calculate_item_savings`:
        D205: 1 blank line required between summary line and description (found 0)
megamart.py:227 in public function `calculate_item_savings`:
        D401: First line should be in imperative mood (perhaps 'Save', not 'Savings')
megamart.py:245 in public function `calculate_fulfilment_surcharge`:
        D202: No blank lines allowed after function docstring (found 1)
megamart.py:245 in public function `calculate_fulfilment_surcharge`:
        D205: 1 blank line required between summary line and description (found 0)
megamart.py:245 in public function `calculate_fulfilment_surcharge`:
        D401: First line should be in imperative mood; try rephrasing (found 'Currently')
megamart.py:281 in public function `round_off_subtotal`:
        D202: No blank lines allowed after function docstring (found 1)
megamart.py:281 in public function `round_off_subtotal`:
        D205: 1 blank line required between summary line and description (found 0)
megamart.py:281 in public function `round_off_subtotal`:
        D401: First line should be in imperative mood; try rephrasing (found 'Currently')
megamart.py:309 in public function `checkout`:
        D202: No blank lines allowed after function docstring (found 1)
megamart.py:309 in public function `checkout`:
        D205: 1 blank line required between summary line and description (found 0)
megamart.py:309 in public function `checkout`:
        D401: First line should be in imperative mood; try rephrasing (found 'This')

pycodestyle_output.txt

megamart.py:19:1: E266 too many leading '#' for block comment
megamart.py:22:80: E501 line too long (103 > 79 characters)
megamart.py:23:3: E111 indentation is not a multiple of 4
megamart.py:24:80: E501 line too long (94 > 79 characters)
megamart.py:25:80: E501 line too long (105 > 79 characters)
megamart.py:26:80: E501 line too long (137 > 79 characters)
megamart.py:27:80: E501 line too long (152 > 79 characters)
megamart.py:28:80: E501 line too long (113 > 79 characters)
megamart.py:29:80: E501 line too long (163 > 79 characters)
megamart.py:30:80: E501 line too long (148 > 79 characters)
megamart.py:31:80: E501 line too long (135 > 79 characters)
megamart.py:34:80: E501 line too long (115 > 79 characters)
megamart.py:35:80: E501 line too long (123 > 79 characters)
megamart.py:36:80: E501 line too long (103 > 79 characters)
megamart.py:38:3: E114 indentation is not a multiple of 4 (comment)
megamart.py:39:3: E111 indentation is not a multiple of 4
megamart.py:42:3: E114 indentation is not a multiple of 4 (comment)
megamart.py:43:3: E111 indentation is not a multiple of 4
megamart.py:45:3: E111 indentation is not a multiple of 4
megamart.py:45:80: E501 line too long (82 > 79 characters)
megamart.py:49:7: E114 indentation is not a multiple of 4 (comment)
megamart.py:50:7: E111 indentation is not a multiple of 4
megamart.py:53:7: E111 indentation is not a multiple of 4
megamart.py:57:7: E111 indentation is not a multiple of 4
megamart.py:61:7: E111 indentation is not a multiple of 4
megamart.py:65:7: E111 indentation is not a multiple of 4
megamart.py:69:7: E111 indentation is not a multiple of 4
megamart.py:69:80: E501 line too long (127 > 79 characters)
megamart.py:75:7: E111 indentation is not a multiple of 4
megamart.py:75:80: E501 line too long (144 > 79 characters)
megamart.py:77:7: E111 indentation is not a multiple of 4
megamart.py:77:80: E501 line too long (127 > 79 characters)
megamart.py:80:80: E501 line too long (134 > 79 characters)
megamart.py:83:7: E111 indentation is not a multiple of 4
megamart.py:84:1: W293 blank line contains whitespace
megamart.py:85:3: E114 indentation is not a multiple of 4 (comment)
megamart.py:86:3: E111 indentation is not a multiple of 4
megamart.py:89:80: E501 line too long (161 > 79 characters)
megamart.py:92:80: E501 line too long (122 > 79 characters)
megamart.py:93:3: E111 indentation is not a multiple of 4
megamart.py:95:80: E501 line too long (97 > 79 characters)
megamart.py:96:80: E501 line too long (132 > 79 characters)
megamart.py:97:80: E501 line too long (101 > 79 characters)
megamart.py:98:80: E501 line too long (183 > 79 characters)
megamart.py:100:3: E114 indentation is not a multiple of 4 (comment)
megamart.py:101:3: E111 indentation is not a multiple of 4
megamart.py:104:3: E114 indentation is not a multiple of 4 (comment)
megamart.py:105:3: E111 indentation is not a multiple of 4
megamart.py:108:3: E111 indentation is not a multiple of 4
megamart.py:110:3: E114 indentation is not a multiple of 4 (comment)
megamart.py:111:3: E111 indentation is not a multiple of 4
megamart.py:114:3: E111 indentation is not a multiple of 4
megamart.py:117:7: E111 indentation is not a multiple of 4
megamart.py:120:3: E111 indentation is not a multiple of 4
megamart.py:122:1: W293 blank line contains whitespace
megamart.py:124:80: E501 line too long (196 > 79 characters)
megamart.py:127:80: E501 line too long (133 > 79 characters)
megamart.py:128:3: E111 indentation is not a multiple of 4
megamart.py:129:80: E501 line too long (179 > 79 characters)
megamart.py:130:80: E501 line too long (116 > 79 characters)
megamart.py:131:80: E501 line too long (158 > 79 characters)
megamart.py:132:80: E501 line too long (101 > 79 characters)
megamart.py:133:80: E501 line too long (183 > 79 characters)
megamart.py:135:3: E114 indentation is not a multiple of 4 (comment)
megamart.py:136:3: E111 indentation is not a multiple of 4
megamart.py:139:3: E114 indentation is not a multiple of 4 (comment)
megamart.py:140:3: E111 indentation is not a multiple of 4
megamart.py:143:3: E114 indentation is not a multiple of 4 (comment)
megamart.py:144:3: E111 indentation is not a multiple of 4
megamart.py:147:3: E114 indentation is not a multiple of 4 (comment)
megamart.py:148:3: E111 indentation is not a multiple of 4
megamart.py:151:3: E114 indentation is not a multiple of 4 (comment)
megamart.py:152:3: E111 indentation is not a multiple of 4
megamart.py:153:3: E111 indentation is not a multiple of 4
megamart.py:155:3: E111 indentation is not a multiple of 4
megamart.py:158:3: E114 indentation is not a multiple of 4 (comment)
megamart.py:159:3: E111 indentation is not a multiple of 4
megamart.py:162:3: E114 indentation is not a multiple of 4 (comment)
megamart.py:163:3: E111 indentation is not a multiple of 4
megamart.py:165:3: E111 indentation is not a multiple of 4
megamart.py:167:80: E501 line too long (198 > 79 characters)
megamart.py:170:80: E501 line too long (89 > 79 characters)
megamart.py:171:3: E111 indentation is not a multiple of 4
megamart.py:172:80: E501 line too long (85 > 79 characters)
megamart.py:173:80: E501 line too long (101 > 79 characters)
megamart.py:174:80: E501 line too long (124 > 79 characters)
megamart.py:175:80: E501 line too long (120 > 79 characters)
megamart.py:176:80: E501 line too long (107 > 79 characters)
megamart.py:177:80: E501 line too long (155 > 79 characters)
megamart.py:178:80: E501 line too long (108 > 79 characters)
megamart.py:179:80: E501 line too long (181 > 79 characters)
megamart.py:180:80: E501 line too long (163 > 79 characters)
megamart.py:181:80: E501 line too long (119 > 79 characters)
megamart.py:183:3: E111 indentation is not a multiple of 4
megamart.py:183:19: E261 at least two spaces before inline comment
megamart.py:185:1: W293 blank line contains whitespace
megamart.py:186:3: E111 indentation is not a multiple of 4
megamart.py:186:29: E261 at least two spaces before inline comment
megamart.py:189:3: E111 indentation is not a multiple of 4
megamart.py:191:3: E114 indentation is not a multiple of 4 (comment)
megamart.py:192:3: E111 indentation is not a multiple of 4
megamart.py:193:37: E231 missing whitespace after ','
megamart.py:195:3: E111 indentation is not a multiple of 4
megamart.py:197:3: E114 indentation is not a multiple of 4 (comment)
megamart.py:198:3: E111 indentation is not a multiple of 4
megamart.py:202:7: E111 indentation is not a multiple of 4
megamart.py:202:80: E501 line too long (102 > 79 characters)
megamart.py:207:3: E111 indentation is not a multiple of 4
megamart.py:207:8: E261 at least two spaces before inline comment
megamart.py:214:7: E111 indentation is not a multiple of 4
megamart.py:214:80: E501 line too long (138 > 79 characters)
megamart.py:215:1: W293 blank line contains whitespace
megamart.py:218:7: E111 indentation is not a multiple of 4
megamart.py:218:80: E501 line too long (132 > 79 characters)
megamart.py:220:3: E111 indentation is not a multiple of 4
megamart.py:220:27: E231 missing whitespace after ','
megamart.py:222:80: E501 line too long (149 > 79 characters)
megamart.py:226:1: E303 too many blank lines (3)
megamart.py:226:80: E501 line too long (89 > 79 characters)
megamart.py:227:3: E111 indentation is not a multiple of 4
megamart.py:228:80: E501 line too long (140 > 79 characters)
megamart.py:229:80: E501 line too long (102 > 79 characters)
megamart.py:230:80: E501 line too long (99 > 79 characters)
megamart.py:232:3: E111 indentation is not a multiple of 4
megamart.py:232:34: E261 at least two spaces before inline comment
megamart.py:235:3: E111 indentation is not a multiple of 4
megamart.py:235:31: E261 at least two spaces before inline comment
megamart.py:238:3: E111 indentation is not a multiple of 4
megamart.py:238:45: E261 at least two spaces before inline comment
megamart.py:238:80: E501 line too long (96 > 79 characters)
megamart.py:239:80: E501 line too long (86 > 79 characters)
megamart.py:241:3: E111 indentation is not a multiple of 4
megamart.py:241:54: E231 missing whitespace after ','
megamart.py:244:80: E501 line too long (97 > 79 characters)
megamart.py:245:3: E111 indentation is not a multiple of 4
megamart.py:246:80: E501 line too long (119 > 79 characters)
megamart.py:247:80: E501 line too long (98 > 79 characters)
megamart.py:249:80: E501 line too long (80 > 79 characters)
megamart.py:250:80: E501 line too long (174 > 79 characters)
megamart.py:254:3: E111 indentation is not a multiple of 4
megamart.py:254:49: E261 at least two spaces before inline comment
megamart.py:254:80: E501 line too long (93 > 79 characters)
megamart.py:255:17: E711 comparison to None should be 'if cond is None:'
megamart.py:256:7: E111 indentation is not a multiple of 4
megamart.py:256:80: E501 line too long (90 > 79 characters)
megamart.py:257:35: E711 comparison to None should be 'if cond is None:'
megamart.py:257:43: E261 at least two spaces before inline comment
megamart.py:258:7: E111 indentation is not a multiple of 4
megamart.py:258:80: E501 line too long (90 > 79 characters)
megamart.py:259:38: E711 comparison to None should be 'if cond is None:'
megamart.py:259:46: E261 at least two spaces before inline comment
megamart.py:259:80: E501 line too long (84 > 79 characters)
megamart.py:260:7: E111 indentation is not a multiple of 4
megamart.py:260:80: E501 line too long (87 > 79 characters)
megamart.py:264:7: E111 indentation is not a multiple of 4
megamart.py:265:47: E261 at least two spaces before inline comment
megamart.py:267:20: E261 at least two spaces before inline comment
megamart.py:268:7: E111 indentation is not a multiple of 4
megamart.py:268:24: E231 missing whitespace after ','
megamart.py:270:1: W293 blank line contains whitespace
megamart.py:271:3: E111 indentation is not a multiple of 4
megamart.py:271:24: E711 comparison to None should be 'if cond is None:'
megamart.py:271:32: E261 at least two spaces before inline comment
megamart.py:273:3: E111 indentation is not a multiple of 4
megamart.py:273:8: E261 at least two spaces before inline comment
megamart.py:276:80: E501 line too long (129 > 79 characters)
megamart.py:280:80: E501 line too long (80 > 79 characters)
megamart.py:281:3: E111 indentation is not a multiple of 4
megamart.py:284:80: E501 line too long (99 > 79 characters)
megamart.py:285:80: E501 line too long (130 > 79 characters)
megamart.py:286:80: E501 line too long (144 > 79 characters)
megamart.py:287:80: E501 line too long (143 > 79 characters)
megamart.py:290:3: E114 indentation is not a multiple of 4 (comment)
megamart.py:291:3: E111 indentation is not a multiple of 4
megamart.py:294:3: E114 indentation is not a multiple of 4 (comment)
megamart.py:295:3: E111 indentation is not a multiple of 4
megamart.py:298:3: E114 indentation is not a multiple of 4 (comment)
megamart.py:298:80: E501 line too long (91 > 79 characters)
megamart.py:299:3: E111 indentation is not a multiple of 4
megamart.py:299:80: E501 line too long (85 > 79 characters)
megamart.py:300:26: E231 missing whitespace after ','
megamart.py:301:3: E111 indentation is not a multiple of 4
megamart.py:301:8: E261 at least two spaces before inline comment
megamart.py:302:34: E231 missing whitespace after ','
megamart.py:304:44: E225 missing whitespace around operator
megamart.py:304:48: E231 missing whitespace after ','
megamart.py:308:1: E302 expected 2 blank lines, found 1
megamart.py:308:80: E501 line too long (147 > 79 characters)
megamart.py:309:3: E111 indentation is not a multiple of 4
megamart.py:311:80: E501 line too long (104 > 79 characters)
megamart.py:312:80: E501 line too long (128 > 79 characters)
megamart.py:313:1: W293 blank line contains whitespace
megamart.py:314:80: E501 line too long (130 > 79 characters)
megamart.py:315:80: E501 line too long (153 > 79 characters)
megamart.py:316:80: E501 line too long (119 > 79 characters)
megamart.py:317:80: E501 line too long (108 > 79 characters)
megamart.py:318:1: W293 blank line contains whitespace
megamart.py:319:80: E501 line too long (151 > 79 characters)
megamart.py:320:80: E501 line too long (184 > 79 characters)
megamart.py:321:80: E501 line too long (89 > 79 characters)
megamart.py:324:3: E114 indentation is not a multiple of 4 (comment)
megamart.py:325:3: E111 indentation is not a multiple of 4
megamart.py:328:3: E114 indentation is not a multiple of 4 (comment)
megamart.py:329:3: E111 indentation is not a multiple of 4
megamart.py:332:3: E114 indentation is not a multiple of 4 (comment)
megamart.py:333:3: E111 indentation is not a multiple of 4
megamart.py:336:3: E114 indentation is not a multiple of 4 (comment)
megamart.py:337:3: E111 indentation is not a multiple of 4
megamart.py:339:3: E114 indentation is not a multiple of 4 (comment)
megamart.py:340:3: E111 indentation is not a multiple of 4
megamart.py:342:3: E114 indentation is not a multiple of 4 (comment)
megamart.py:343:3: E111 indentation is not a multiple of 4
megamart.py:343:45: W291 trailing whitespace
megamart.py:344:1: W293 blank line contains whitespace
megamart.py:345:1: W293 blank line contains whitespace
megamart.py:346:5: E303 too many blank lines (2)
megamart.py:346:80: E501 line too long (83 > 79 characters)
megamart.py:347:61: E231 missing whitespace after ','
megamart.py:347:80: E501 line too long (100 > 79 characters)
megamart.py:347:82: E231 missing whitespace after ','
megamart.py:347:101: W291 trailing whitespace
megamart.py:348:7: E111 indentation is not a multiple of 4
megamart.py:348:80: E501 line too long (176 > 79 characters)
megamart.py:349:1: W293 blank line contains whitespace
megamart.py:350:80: E501 line too long (94 > 79 characters)
megamart.py:351:76: E231 missing whitespace after ','
megamart.py:351:80: E501 line too long (87 > 79 characters)
megamart.py:353:80: E501 line too long (136 > 79 characters)
megamart.py:355:7: E111 indentation is not a multiple of 4
megamart.py:355:24: E225 missing whitespace around operator
megamart.py:357:11: E111 indentation is not a multiple of 4
megamart.py:357:30: E231 missing whitespace after ','
megamart.py:357:45: E231 missing whitespace after ','
megamart.py:357:59: E231 missing whitespace after ','
megamart.py:357:80: E501 line too long (85 > 79 characters)
megamart.py:358:11: E111 indentation is not a multiple of 4
megamart.py:358:80: E501 line too long (183 > 79 characters)
megamart.py:359:1: W293 blank line contains whitespace
megamart.py:362:7: E111 indentation is not a multiple of 4
megamart.py:368:80: E501 line too long (94 > 79 characters)
megamart.py:369:7: E111 indentation is not a multiple of 4
megamart.py:369:80: E501 line too long (192 > 79 characters)
megamart.py:372:5: E303 too many blank lines (2)
megamart.py:373:80: E501 line too long (87 > 79 characters)
megamart.py:374:1: W293 blank line contains whitespace
megamart.py:380:1: W293 blank line contains whitespace
megamart.py:381:80: E501 line too long (95 > 79 characters)
megamart.py:384:80: E501 line too long (116 > 79 characters)
megamart.py:385:80: E501 line too long (87 > 79 characters)
megamart.py:386:63: E231 missing whitespace after ','
megamart.py:386:80: E501 line too long (105 > 79 characters)
megamart.py:387:1: W293 blank line contains whitespace
megamart.py:389:5: E303 too many blank lines (2)
megamart.py:395:7: E111 indentation is not a multiple of 4
megamart.py:395:58: E231 missing whitespace after ','
megamart.py:395:80: E501 line too long (190 > 79 characters)
megamart.py:395:124: E231 missing whitespace after ','
megamart.py:397:7: E111 indentation is not a multiple of 4
megamart.py:397:58: E231 missing whitespace after ','
megamart.py:397:80: E501 line too long (164 > 79 characters)
megamart.py:397:124: E231 missing whitespace after ','
megamart.py:400:3: E114 indentation is not a multiple of 4 (comment)
megamart.py:401:3: E111 indentation is not a multiple of 4
megamart.py:401:80: E501 line too long (95 > 79 characters)
megamart.py:403:3: E114 indentation is not a multiple of 4 (comment)
megamart.py:404:3: E111 indentation is not a multiple of 4
megamart.py:406:3: E114 indentation is not a multiple of 4 (comment)
megamart.py:407:3: E111 indentation is not a multiple of 4
megamart.py:407:45: E231 missing whitespace after ','
megamart.py:408:1: W293 blank line contains whitespace
megamart.py:409:3: E114 indentation is not a multiple of 4 (comment)
megamart.py:410:3: E111 indentation is not a multiple of 4
megamart.py:412:3: E114 indentation is not a multiple of 4 (comment)
megamart.py:413:3: E114 indentation is not a multiple of 4 (comment)
megamart.py:414:3: E111 indentation is not a multiple of 4
megamart.py:415:3: E111 indentation is not a multiple of 4
megamart.py:415:50: E231 missing whitespace after ','
megamart.py:416:3: E111 indentation is not a multiple of 4
megamart.py:416:60: E231 missing whitespace after ','
megamart.py:417:3: E111 indentation is not a multiple of 4
megamart.py:417:55: E231 missing whitespace after ','
megamart.py:418:3: E111 indentation is not a multiple of 4
megamart.py:418:40: E231 missing whitespace after ','
megamart.py:419:3: E111 indentation is not a multiple of 4
megamart.py:419:49: E231 missing whitespace after ','
megamart.py:420:3: E111 indentation is not a multiple of 4
megamart.py:422:3: E114 indentation is not a multiple of 4 (comment)
megamart.py:423:3: E114 indentation is not a multiple of 4 (comment)
megamart.py:424:3: E114 indentation is not a multiple of 4 (comment)
megamart.py:425:3: E114 indentation is not a multiple of 4 (comment)
megamart.py:426:3: E114 indentation is not a multiple of 4 (comment)
megamart.py:427:3: E114 indentation is not a multiple of 4 (comment)
megamart.py:428:1: W293 blank line contains whitespace
megamart.py:430:3: E111 indentation is not a multiple of 4
megamart.py:430:3: E303 too many blank lines (2)
megamart.py:434:80: E501 line too long (93 > 79 characters)
megamart.py:448:80: E501 line too long (87 > 79 characters)
megamart.py:467:80: E501 line too long (154 > 79 characters)
megamart.py:469:1: E266 too many leading '#' for block comment
megamart.py:470:1: W391 blank line at end of file

mypy_output.txt

Transaction.py:9: error: Incompatible types in assignment (expression has type "None", variable has type "str")  [assignment]
Transaction.py:10: error: Incompatible types in assignment (expression has type "None", variable has type "str")  [assignment]
megamart.py:347: error: Argument 2 to "is_not_allowed_to_purchase_item" has incompatible type "Customer | None"; expected "Customer"  [arg-type]
megamart.py:355: error: Unsupported operand types for < ("int" and "None")  [operator]
megamart.py:355: note: Left operand is of type "int | None"
megamart.py:356: error: Unsupported operand types for > ("int" and "None")  [operator]
megamart.py:356: note: Right operand is of type "int | None"
megamart.py:382: error: Incompatible types in assignment (expression has type "float", variable has type "int")  [assignment]
megamart.py:386: error: Incompatible types in assignment (expression has type "float", variable has type "int")  [assignment]
megamart.py:395: error: Unsupported operand types for - ("None" and "int")  [operator]
megamart.py:395: note: Left operand is of type "int | None"
megamart.py:397: error: Incompatible types in assignment (expression has type "tuple[Item, int, int | None]", variable has type "tuple[Item, int, int]")  [assignment]
megamart.py:401: error: Argument 1 to "calculate_fulfilment_surcharge" has incompatible type "FulfilmentType | None"; expected "FulfilmentType"  [arg-type]
megamart.py:401: error: Argument 2 to "calculate_fulfilment_surcharge" has incompatible type "Customer | None"; expected "Customer"  [arg-type]
megamart.py:407: error: Argument 2 to "round_off_subtotal" has incompatible type "PaymentMethod | None"; expected "PaymentMethod"  [arg-type]

lizard_output.txt

================================================
  NLOC    CCN   token  PARAM  length  location  
------------------------------------------------
      41     16    201      3      65 is_not_allowed_to_purchase_item@[email protected]
      21      6     93      5      30 get_item_purchase_quantity_limit@[email protected]
      26      8    113      6      39 is_item_sufficiently_stocked@[email protected]
      32      9    147      3      51 calculate_final_item_price@[email protected]
      13      4     53      2      16 calculate_item_savings@[email protected]
      26      8    110      2      31 calculate_fulfilment_surcharge@[email protected]
      18      5     82      2      25 round_off_subtotal@[email protected]
      60     11    441      7     123 checkout@[email protected]
1 file analyzed.
==============================================================
NLOC    Avg.NLOC  AvgCCN  Avg.token  function_cnt    file
--------------------------------------------------------------
    252      29.6     8.4      155.0         8     megamart.py

===========================================================================================================
!!!! Warnings (cyclomatic_complexity > 15 or length > 1000 or nloc > 1000000 or parameter_count > 100) !!!!
================================================
  NLOC    CCN   token  PARAM  length  location  
------------------------------------------------
      41     16    201      3      65 is_not_allowed_to_purchase_item@[email protected]
==========================================================================================
Total nloc   Avg.NLOC  AvgCCN  Avg.token   Fun Cnt  Warning cnt   Fun Rt   nloc Rt
------------------------------------------------------------------------------------------
       252      29.6     8.4      155.0        8            1      0.12    0.17