oceanprotocol/provider

View on GitHub
ocean_provider/utils/datatoken.py

Summary

Maintainability
B
5 hrs
Test Coverage
C
78%

File datatoken.py has 286 lines of code (exceeds 250 allowed). Consider refactoring.
Wontfix

import json
import logging
from datetime import datetime, timezone
from typing import Optional

Severity: Minor
Found in ocean_provider/utils/datatoken.py - About 2 hrs to fix

    Function verify_order_tx has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def verify_order_tx(
        web3: Web3,
        datatoken_address: HexAddress,
        tx_id: HexStr,
        service: Service,
    Severity: Minor
    Found in ocean_provider/utils/datatoken.py - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function verify_order_tx has 8 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def verify_order_tx(
    Severity: Major
    Found in ocean_provider/utils/datatoken.py - About 1 hr to fix

      Function validate_order has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def validate_order(
      Severity: Major
      Found in ocean_provider/utils/datatoken.py - About 50 mins to fix

        Function record_consume_request has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def record_consume_request(
        Severity: Minor
        Found in ocean_provider/utils/datatoken.py - About 45 mins to fix

          Function validate_transfer_not_used_for_other_service has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def validate_transfer_not_used_for_other_service(
          Severity: Minor
          Found in ocean_provider/utils/datatoken.py - About 35 mins to fix

            There are no issues that match your filters.

            Category
            Status