oceanprotocol/provider

View on GitHub

Showing 69 of 71 total issues

Function validate_dns_record has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def validate_dns_record(record, domain, record_type):
    value = record if isinstance(record, str) else record.to_text().strip()
    allow_non_public_ip = bool_value_of_env("ALLOW_NON_PUBLIC_IP")

    try:
Severity: Minor
Found in ocean_provider/utils/url.py - About 35 mins 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

Avoid too many return statements within this function.
Open

            return error_response(f"Provider {network_name}: " + message, 400, logger)
Severity: Major
Found in ocean_provider/routes/consume.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            return True, self
    Severity: Major
    Found in ocean_provider/file_types/types/smartcontract.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              return True
      Severity: Major
      Found in ocean_provider/validation/algo.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                    return False
        Severity: Major
        Found in ocean_provider/validation/algo.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return True
          Severity: Major
          Found in ocean_provider/validation/algo.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return False
            Severity: Major
            Found in ocean_provider/validation/algo.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return True
              Severity: Major
              Found in ocean_provider/validation/algo.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                                return False
                Severity: Major
                Found in ocean_provider/validation/algo.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                              return False
                  Severity: Major
                  Found in ocean_provider/validation/algo.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                return error_response(
                    Severity: Major
                    Found in ocean_provider/routes/consume.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                              return True
                      Severity: Major
                      Found in ocean_provider/validation/algo.py - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                return self.validate_usage() if self.check_usage else True
                        Severity: Major
                        Found in ocean_provider/validation/algo.py - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                  return get_redirect(location, redirect_count + 1)
                          Severity: Major
                          Found in ocean_provider/utils/url.py - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                        return False, "Missing parameters"
                            Severity: Major
                            Found in ocean_provider/file_types/types/smartcontract.py - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                          return False
                              Severity: Major
                              Found in ocean_provider/validation/algo.py - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                            return False
                                Severity: Major
                                Found in ocean_provider/validation/algo.py - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                              return False, "Missing userparams: " + ",".join(missing_inputs)
                                  Severity: Major
                                  Found in ocean_provider/file_types/types/smartcontract.py - About 30 mins to fix

                                    Avoid too many return statements within this function.
                                    Open

                                                return False
                                    Severity: Major
                                    Found in ocean_provider/validation/algo.py - About 30 mins to fix

                                      Avoid too many return statements within this function.
                                      Open

                                                  return False
                                      Severity: Major
                                      Found in ocean_provider/validation/algo.py - About 30 mins to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language