oceanprotocol/aquarius

View on GitHub

Showing 37 of 40 total issues

Function decrypt_ddo has 7 arguments (exceeds 6 allowed). Consider refactoring.
Open

def decrypt_ddo(w3, provider_url, contract_address, chain_id, txid, hash, es_instance):
Severity: Major
Found in aquarius/events/decryptor.py - About 35 mins to fix

    Avoid too many return statements within this function.
    Open

        return jsonify(names)
    Severity: Major
    Found in aquarius/app/assets.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                  return jsonify(get_signature_vrs(raw))
      Severity: Major
      Found in aquarius/app/assets.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return False
        Severity: Major
        Found in aquarius/events/proof_checker.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return (jsonify(errors=errors), 400)
          Severity: Major
          Found in aquarius/app/assets.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return jsonify(error=f"Encountered error when validating asset: {str(e)}."), 500
            Severity: Major
            Found in aquarius/app/assets.py - About 30 mins to fix

              Function thread_process_ve_allocate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def thread_process_ve_allocate(self):
                      while True:
                          if self._thread_process_ve_allocate_is_on:
                              logger.info("Starting ve_allocate.update_lists ....")
                              try:
              Severity: Minor
              Found in aquarius/events/events_monitor.py - About 25 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

              Function thread_process_nft_ownership has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def thread_process_nft_ownership(self):
                      while True:
                          if self._thread_process_nfts_is_on:
                              logger.info("Starting nft_ownership update_lists ....")
                              try:
              Severity: Minor
              Found in aquarius/events/events_monitor.py - About 25 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

              Function thread_process_blocks has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def thread_process_blocks(self):
                      while True:
                          if self._thread_process_blocks_is_on:
                              try:
                                  logger.info("Starting process_current_blocks ....")
              Severity: Minor
              Found in aquarius/events/events_monitor.py - About 25 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

              Function thread_process_purgatory has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def thread_process_purgatory(self):
                      while True:
                          if self._thread_process_purgatory_is_on:
                              logger.info("Starting purgatory.update_lists ....")
                              try:
              Severity: Minor
              Found in aquarius/events/events_monitor.py - About 25 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

              Function handle_tx_retry has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def handle_tx_retry(self, tx_id, log_index):
                      try:
                          # we don't need to wait more than 1 sec. if tx is not there, we will retry later
                          tx_receipt = self._web3.eth.wait_for_transaction_receipt(tx_id, timeout=1)
                      except Exception:
              Severity: Minor
              Found in aquarius/retry_mechanism.py - About 25 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

              Function update_asset has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def update_asset(self, asset, ve_allocated_realtime):
                      """
                      Updates the field `state.allocated`  in `asset` object.
                      """
                      did = asset["id"]
              Severity: Minor
              Found in aquarius/events/ve_allocate.py - About 25 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

              Function decrypt_ddo has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              def decrypt_ddo(w3, provider_url, contract_address, chain_id, txid, hash, es_instance):
                  aquarius_account = get_aquarius_wallet()
                  nonce = Decimal(time.time_ns())
              
                  signature = get_signature_bytes(
              Severity: Minor
              Found in aquarius/events/decryptor.py - About 25 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

              Function __init__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def __init__(self, web3):
                      self._es_instance = ElasticsearchInstance()
              
                      self._other_db_index = f"{self._es_instance.db_index}_plus"
                      self._es_instance.es.indices.create(index=self._other_db_index, ignore=400)
              Severity: Minor
              Found in aquarius/events/events_monitor.py - About 25 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

              Function trigger_caching has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              def trigger_caching():
                  """Triggers manual caching of a specific transaction (MetadataCreated or MetadataUpdated event)
                  ---
                  tags:
                    - name
              Severity: Minor
              Found in aquarius/app/assets.py - About 25 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

              Function process_queue has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def process_queue(self):
                      # possible improvements: order by closest, take only a fixed number from the queue
                      # delete from retry queue after a certain number of retries
                      queue_elements = self.get_from_retry_queue()
                      for queue_element in queue_elements:
              Severity: Minor
              Found in aquarius/retry_mechanism.py - About 25 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

              Function thread_process_queue has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def thread_process_queue(self):
                      while True:
                          if self._thread_process_queue_is_on:
                              try:
                                  logger.info("Starting process_queue ....")
              Severity: Minor
              Found in aquarius/events/events_monitor.py - About 25 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

              Severity
              Category
              Status
              Source
              Language