Showing 151 of 151 total issues
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function export_taxa
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def export_taxa(
Function adjust_dir_name
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def adjust_dir_name(
Function choose_palette
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def choose_palette(
cls,
data: pd.DataFrame,
col: Optional[str],
palette: Optional[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 _new_conc
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _new_conc(self, x: NestedDotDict) -> Optional[HmdbConcentration]:
specimen = x["biospecimen"]
# both can be "Not Specified"
ages = {
"Adult": PersonAge.adults,
- 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 fetch_properties
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def fetch_properties(self, cid: int) -> Mapping[str, Any]:
url = f"{self._pug}/compound/cid/{cid}/JSON"
#
try:
matches: NestedDotDict = self._query_json(url)
- 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 _build_by_name
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _build_by_name(cls, tax: Iterable[Taxon]) -> Mapping[str, FrozenSet[Taxon]]:
by_name = defaultdict(set)
# put these in the right order
# so that we favor mnemonic, then scientific name, then common name
for t in tax:
- 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 fetch
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def fetch(self, inchikey_or_hmdb_id: str) -> HmdbData:
logger.debug(f"Downloading HMDB data for {inchikey_or_hmdb_id}")
# e.g. https://hmdb.ca/metabolites/HMDB0001925.xml
cid = None
if inchikey_or_hmdb_id.startswith("HMDB"):
- 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 str_to
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def str_to(
cls, type_: Callable[[str], T], nullable: bool = False, flex_type: bool = False
) -> Callable[[str], str]:
def str_to(value: Optional[str]) -> Optional[T]:
if value is None and nullable:
- 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 list
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def list(
cls,
lst: Iterable[Any],
*,
attr: Union[None, str, Callable[[Any], Any]] = 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
Avoid too many return
statements within this function. Open
return None
Function _process
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _process(
self,
compound_id: Optional[str],
library: Optional[str],
inchi: Optional[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 accept
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def accept(self, target: TargetNode) -> bool:
if target.link_reqs is None:
# typically for root nodes -- we'll have a self-loop to check, too
logger.trace(f"Rejected probable root: {target}")
return False
- 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 req_is
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def req_is(cls, type_, nullable: bool = False, then_convert=None) -> Callable[[str], str]:
def req_is(value):
if nullable and value is None:
pass
elif not isinstance(value, type_):
- 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 cross
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def cross(
cls,
source_types: Set[TargetType],
rel_types: Set[TargetRelType],
dest_types: Set[TargetType],
- 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 _guess_neighbor
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _guess_neighbor(self, kind: CoOccurrenceType, neighbor_id: str) -> str:
if kind is CoOccurrenceType.chemical:
return Codes.PubchemCompoundId(neighbor_id)
elif kind is CoOccurrenceType.gene and neighbor_id.startswith("EC:"):
return Codes.EcNumber(neighbor_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 get_by_id_or_name
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_by_id_or_name(self, item: Union[int, str, Taxon]) -> FrozenSet[Taxon]:
"""
Gets all taxa that match an ID or name.
"""
if isinstance(item, Taxon):
- 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 __truediv__
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def __truediv__(
self,
keys: Union[
Sequence[Union[None, str, Callable[[Any], Any]]], FilterFn, Callable[[List[T]], Any]
],
- 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
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def load(cls, data: NestedDotDict) -> Settings:
extra_default_keys = dict(defaults)
def get(s: str, t: Type[T]) -> T:
if s in extra_default_keys: # could be accessed more than once
- 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_suffix
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _check_suffix(cls, suffix, suffixes):
if suffixes is not None and callable(suffixes):
try:
suffixes(suffix) # make sure it's ok
except FilenameSuffixError:
- 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"