Showing 257 of 257 total issues
Avoid deeply nested control flow statements. Open
if elt == "as":
child_opts.alias = value
elif elt == "verify":
child_opts.verify = value
elif elt == "via":
Avoid deeply nested control flow statements. Open
if n_t is None:
log.warn(f'callback did not return anything when parsing {self.url} {info}')
self.t = n_t
Avoid deeply nested control flow statements. Open
for e in iter_entities(_t):
if _country_code:
set_nodecountry(e, _country_code)
if bool(_hide_from_discovery) and is_idp(e):
set_entity_attributes(
Function img_to_data
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def img_to_data(data: bytes, content_type: str) -> Optional[str]:
"""Convert a file (specified by a path) into a data URI."""
mime_type, options = cgi.parse_header(content_type)
data64 = None
if len(data) > config.icon_maxsize:
- 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
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def update(self, t, tid=None, etag=None, lazy=True):
relt = root(t)
assert relt is not None
if relt.tag == "{%s}EntityDescriptor" % NS['md']:
self._unindex(relt)
- 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 _lookup
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _lookup(self, member, store=None):
if store is None:
store = self.store
if member is 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 deeply nested control flow statements. Open
if ico is not None and 'url' in ico and not ico['url'].startswith('data:'):
urls.append(ico)
if config.load_icons_async:
Function lookup
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def lookup(self, member, xp=None, store=None):
"""
Lookup elements in the working metadata repository
:param member: A selector (cf below)
- 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 total_seconds(dt) < error_seconds:
annotate_entity(
entity_elt,
"certificate-error",
"certificate has expired",
Avoid deeply nested control flow statements. Open
for entity_id in info.parser_info.entities:
md_sources[entity_id].append(r.url)
return md_sources
Function with_entity_attributes
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def with_entity_attributes(entity, cb):
def _stext(e):
if e.text is not None:
return e.text.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
Function entity_contacts
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def entity_contacts(entity):
def _contact_dict(contact):
first_name = first_text(contact, "{%s}GivenName" % NS['md'])
last_name = first_text(contact, "{%s}SurName" % NS['md'])
org = first_text(entity, "{%s}OrganizationName" % NS['md']) or first_text(
- 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 filter_or_validate
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def filter_or_validate(
Function i_handle
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def i_handle(self, t, url=None, response=None, exception=None, last_fetched=None):
Function annotate_entity
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def annotate_entity(e, category, title, message, source=None):
Function i_handle
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def i_handle(self, t, url=None, response=None, exception=None, last_fetched=None):
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, request, response, pool, name, content_handler):
Function i_handle
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def i_handle(self, t: Resource, url=None, response=None, exception=None, last_fetched=None):
Function __call__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __call__(self, watched=None, url=None, response=None, exception=None, last_fetched=None):
Function discojson
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def discojson(e, sources=None, langs=None, fallback_to_favicon=False, icon_store=None):