Showing 12 of 12 total issues
Function _check_query
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def _check_query(self, document: dict, query: dict) -> bool:
matched = True
for k, query_value in query.items():
key_value = document
for name in k.split('.'):
- 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 format_html
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def format_html(message: dict) -> str:
entities = message.get('entities', [])
if not entities:
return get_message_text(message)
pointer = 0
- 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 make_request
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def make_request(url, method='GET', params=None, body=None, headers=None):
parse_result = urlparse(url)
protocol = parse_result.scheme
hostname = parse_result.netloc
port = 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 load_config
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def load_config():
bot_name = os.getenv('TELEGRAM_BOT_NAME') or 'evernoterobot'
host = os.getenv('EVERNOTEBOT_HOSTNAME') or '127.0.0.1'
port = os.getenv('EVERNOTEBOT_EXPOSE_PORT') or 8000
bot_api_token = os.getenv('TELEGRAM_API_TOKEN') or 'bot_api_token'
- 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_oauth_data
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_oauth_data(
Function make_request
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def make_request(url, method='GET', params=None, body=None, headers=None):
Function get_oauth_data
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_oauth_data(
user_id: int,
app_key: str,
app_secret: str,
callback_url: str,
- 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_all
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_all(self, query: Optional[Dict] = None) -> typing.Generator:
if query is None:
query = {}
table = self._table_name
args = tuple()
- 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 dict_merge
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def dict_merge(d1: dict, d2: dict):
for k, v in d2.items():
if k in d1 and isinstance(d1[k], dict) and isinstance(d2[k], dict):
dict_merge(d1[k], d2[k])
else:
- 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 create
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def create(self, data: dict, auto_generate_id: bool = False) -> int:
table = self._table_name
if auto_generate_id:
if 'id' in data:
del data['id']
- 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_headers
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def validate_headers(self, headers: list[tuple[str, bytes]], body: bytes):
headers = headers or []
content_length = None
content_type = None
for name, value in headers:
- 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 save
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def save(self, data: dict):
object_id = data.get("id")
if object_id:
data["_id"] = object_id
del data["id"]
- 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"