Showing 37 of 40 total issues
File es_mapping.py
has 672 lines of code (exceeds 250 allowed). Consider refactoring. Open
# Copyright 2023 Ocean Protocol Foundation
# SPDX-License-Identifier: Apache-2.0
es_mapping = """
{
File events_monitor.py
has 570 lines of code (exceeds 250 allowed). Consider refactoring. Open
#
# Copyright 2023 Ocean Protocol Foundation
# SPDX-License-Identifier: Apache-2.0
#
import json
File processors.py
has 560 lines of code (exceeds 250 allowed). Consider refactoring. Open
#
# Copyright 2023 Ocean Protocol Foundation
# SPDX-License-Identifier: Apache-2.0
#
import copy
File assets.py
has 418 lines of code (exceeds 250 allowed). Consider refactoring. Open
#
# Copyright 2023 Ocean Protocol Foundation
# SPDX-License-Identifier: Apache-2.0
#
import copy
Function handle_price_change
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def handle_price_change(self, event_name, event, to_block):
"""Process one event of types: EVENT_ORDER_STARTED, EVENT_EXCHANGE_CREATED, EVENT_EXCHANGE_RATE_CHANGED, EVENT_DISPENSER_CREATED
Args:
event_name (str): event uppercase constant name
- Read upRead up
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
EventsMonitor
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class EventsMonitor(BlockProcessingClass):
"""Detect on-chain published Metadata and cache it in the database for
fast retrieval and searchability.
The published metadata is extracted from the `MetadataCreated`
Function setup_logging
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def setup_logging(default_path="logging.yaml", default_level=None):
"""Logging Setup"""
path = default_path
log_level_name = os.getenv("LOG_LEVEL", None)
- Read upRead up
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 graph_to_dict
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def graph_to_dict(g):
"""
Pass in a rdflib.Graph and get back a chunk of JSON using
the Talis JSON serialization for RDF:
http://n2.talis.com/wiki/RDF_JSON_Specification
- Read upRead up
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 validate_dict
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def validate_dict(dict_orig, chain_id, nft_address):
"""Performs shacl validation on a dict. Returns a tuple of conforms, error messages."""
dictionary = copy.deepcopy(dict_orig)
dictionary["@type"] = "DDO"
extra_errors = {}
- Read upRead up
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 35 lines of code (exceeds 25 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)
Function get_last_processed_block
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def get_last_processed_block(self):
"""Get last processed_block, fallback to contract deployment block"""
block = get_defined_block(self._chain_id)
try:
# Re-establishing the connection with ES
- Read upRead up
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 get_last_processed_block
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def get_last_processed_block(self):
"""Get last processed_block, fallback to contract deployment block"""
block = get_defined_block(self._chain_id)
try:
# Re-establishing the connection with ES
- Read upRead up
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 deeply nested control flow statements. Open
if logger == "elasticsearch":
continue
Function get_number_orders_price
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_number_orders_price(token_address, last_sync_block, chain_id):
try:
client = get_client(chain_id, last_sync_block)
if not client:
return -1, {}
- Read upRead up
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 get_network_name
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_network_name():
"""
:return str: network name
"""
network_name = os.getenv("NETWORK_NAME", None)
- Read upRead up
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_lists
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def update_lists(self):
"""
Grab and process all nft transfership events from subgraph, starting from last known block
"""
start_block = self.get_last_processed_block()
- Read upRead up
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 get_assets_names
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_assets_names():
"""Get names of assets as specified in the payload
---
tags:
- name
- Read upRead up
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_logs
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def process_logs(self, logs, to_block):
"""Given a list of events, of different types, process them ..
Args:
logs: list of events to be processed
- Read upRead up
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 validate_remote
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def validate_remote():
"""Validate DDO content.
---
tags:
- ddo
- Read upRead up
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_current_blocks
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def process_current_blocks(self):
"""Process all blocks from the last processed block to the current block."""
last_block = self.get_last_processed_block()
current_block = None
- Read upRead up
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"