Showing 121 of 349 total issues
Function parse_regulatory_citations
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def parse_regulatory_citations(regulatory_citation, case_id, entity_id):
citations = []
if regulatory_citation:
matches = list(REGULATION_REGEX.finditer(regulatory_citation))
for index, match in enumerate(matches):
- 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_multi
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def filter_multi(query, kwargs, fields):
for key, column in fields:
if kwargs.get(key):
# handle combination exclude/include lists
exclude_list = [parse_exclude_arg(value) for value in kwargs[key] if is_exclude_arg(value)]
- 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_fulltext
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def filter_fulltext(query, kwargs, fields):
for key, column in fields:
if kwargs.get(key):
exclude_list = [parse_exclude_arg(value) for value in kwargs[key] if is_exclude_arg(value)]
include_list = [value for value in kwargs[key] if not is_exclude_arg(value)]
- 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_seek_page
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def fetch_seek_page(query, kwargs, index_column, clear=False, count=None, cap=100, eager=True):
Avoid deeply nested control flow statements. Open
if (bull !== b && !(bull.length > 1 && b.length > 1)) {
src = cap.slice(i + 1).join('\n') + src;
i = l - 1;
}
Avoid deeply nested control flow statements. Open
for (m = 0, len1 = v.length; m < len1; m++) {
o = v[m];
this.model.oauth.scopes.push(o);
}
Function related
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def related(related_model, id_label, related_id_label=None, cycle_label=None,
Avoid deeply nested control flow statements. Open
if (!loose) loose = next;
Avoid deeply nested control flow statements. Open
for child in section.iter():
if child.text:
text += ' %s ' % child.text.strip()
heading = section.find(tag_name.format('heading')).text.strip()
Function redis_url
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def redis_url():
"""
Retrieves the URL needed to connect to a Redis instance.
"""
- 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 concurrent:
refresh_command = 'REFRESH MATERIALIZED VIEW CONCURRENTLY {}'.format(mv)
else:
refresh_command = 'REFRESH MATERIALIZED VIEW {}'.format(mv)
Avoid deeply nested control flow statements. Open
if (this.model.oauth === null) {
this.model.oauth = {};
}
Function process_mur
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def process_mur(mur):
es = utils.get_elasticsearch_connection()
bucket = get_bucket()
mur_names = get_mur_names()
(mur_no_td, open_date_td, close_date_td, parties_td, subject_td, citations_td)\
- 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_query
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def build_query(self, committee_type=None, **kwargs):
#For this endpoint we now enforce the enpoint specified to map the right model.
reports_class, reports_schema = reports_schema_map.get(
reports_type_map.get(committee_type),
default_schemas,
- 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_query
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def build_query(self, **kwargs):
if kwargs.get('name'):
kwargs['q'] = kwargs['name']
query = super().build_query(**kwargs)
- 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
for child in section.iter():
if child.text:
text += ' %s ' % child.text.strip()
heading = section.find(tag_name.format('heading')).text.strip()
Avoid deeply nested control flow statements. Open
for (a in this.auths) {
auth = this.auths[a];
if (auth.type === 'oauth2') {
this.model.oauth = {};
this.model.oauth.scopes = [];
Avoid deeply nested control flow statements. Open
if (this.model.oauth.scopes === void 0) {
this.model.oauth.scopes = [];
}
Function buildUrl
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
buildUrl: function(base, url){
if (url.indexOf('/') === 0) {
var parts = base.split('/');
base = parts[0] + '//' + parts[2];
return base + 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 fetch_seek_paginator
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def fetch_seek_paginator(query, kwargs, index_column, clear=False, count=None, cap=100):