File query2.py
has 349 lines of code (exceeds 250 allowed). Consider refactoring. Open
import logging
from datetime import datetime
from typing import (
Any,
Dict,
Function check
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def check(string: str):
i = 0
# Find opening bracket
found = False
for char in string:
- 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 check
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def check(string: str):
if string[0] != "[":
return None, string
# Find closing bracket
i = 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 check
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def check(string: str):
if string[0] != "{":
return None, string
# Find closing bracket
i = 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
Consider simplifying this complex logical expression. Open
if char == "'" and prev_char != "\\" and not double_quote:
single_quote = not single_quote
elif char == '"' and prev_char != "\\" and not single_quote:
double_quote = not double_quote
elif single_quote or double_quote:
Function parse
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def parse(string: str, namespace: dict) -> QToken:
entries_str = string[1:-1]
d: Dict[str, QToken] = {}
while len(entries_str) > 0:
entries_str = entries_str.strip()
- 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
Consider simplifying this complex logical expression. Open
if char == "'" and prev_char != "\\" and not double_quote:
single_quote = not single_quote
elif char == '"' and prev_char != "\\" and not single_quote:
double_quote = not double_quote
elif double_quote or single_quote:
Consider simplifying this complex logical expression. Open
if char == "'" and prev_char != "\\" and not double_quote:
single_quote = not single_quote
elif char == '"' and prev_char != "\\" and not single_quote:
double_quote = not double_quote
elif single_quote or double_quote:
Function query
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def query(
Function check
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def check(string: str):
token = ""
for i, char in enumerate(string):
if char.isalpha() or char == "_":
token += char
- 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 check
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def check(string: str):
token = ""
quotes_type = string[0]
if quotes_type != '"' and quotes_type != "'":
return token, string
- 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 parse
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def parse(string: str, namespace: dict) -> QToken:
arg_start = 0
arg_end = len(string) - 1
# Find opening bracket
for char in string:
- 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 _parse_token
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _parse_token(string: str, namespace: dict) -> Tuple[Tuple[Any, str], str]:
# TODO: The whole parsing thing is shoddily written, needs a rewrite from ground-up
if not isinstance(string, str):
raise QueryParseException(
"Reached unreachable, cannot parse something that isn't a string"
- 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 parse
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def parse(string: str, namespace: dict) -> QToken:
entries_str = string[1:-1]
ls: List[QToken] = []
while len(entries_str) > 0:
entries_str = entries_str.strip()
- 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"