Showing 74 of 1,128 total issues
Function load_worldbank_data
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def load_worldbank_data(self, url, model_name):
xml_data = from_url_get_xml(url)
data_objects = []
countries_not_found = []
model = apps.get_model('dataservices', model_name)
- 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 handle
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def handle(self, *args, **options):
missing_data_query = Q(date_of_creation__isnull=True) | Q(address_line_1__isnull=True) | Q(address_line_1='')
queryset = models.Company.objects.filter(Q(company_type=company_types.COMPANIES_HOUSE) & missing_data_query)
counter = Counter()
for company in queryset:
- 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 _last_four_quarters
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _last_four_quarters(self):
current_year, current_quarter = self.get_current_period().values()
if not current_year and not current_quarter:
return self.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 build_search_company_query
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def build_search_company_query(params):
term = params.pop('term', None)
# perform OR operation for items specified in same group and
# then an AND operation for different groups e.g.,
- 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_data
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def load_data(self):
data = []
chunks = pd.read_sql(sa.text(self.sql), self.engine, chunksize=10000)
for chunk in chunks:
- 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 populate_db_from_s3
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def populate_db_from_s3(self, filename, test):
# Read from S3, write into local DB, hook up country table
cursor = connection.cursor()
filestream = get_s3_file_stream(filename or settings.COMTRADE_DATA_FILE_NAME)
file_reader = csv.DictReader(filestream.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 fetch_companies_house_data
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def fetch_companies_house_data(self, row: dict) -> dict:
number = row["number"]
try:
profile = get_companies_house_profile(number)
if profile.get('date_of_creation'):
- 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_exportplan_label_on_update
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def update_exportplan_label_on_update(sender, instance, *args, **kwargs):
# Not needed since name is added during serialiser here
if instance._state.adding:
return
if instance.export_countries and instance.export_commodity_codes:
- 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_email
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_email(self):
email = self.request.data.get('email')
if email is not None:
return email
- 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 handle
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def handle(self, *args, **options):
for i in range(100):
factories.CompanyFactory(
is_published_investment_support_directory=True,
is_published_find_a_supplier=True,
- 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_tables
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def filter_tables(self, options, table_names_view_names):
if options['table'] is not None:
filtered = {}
for t, v in table_names_view_names.items():
if t == options['table']:
- 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 handle
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def handle(self, *args, **options):
queryset = models.Company.objects.filter(company_type=company_types.COMPANIES_HOUSE)
counter = Counter()
for company in queryset:
try:
- 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 deep_extend
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def deep_extend(o1, o2):
# Deep extend dict o2 onto o1. o1 is mutated
for key, value in o2.items():
if o1.get(key) and isinstance(o1.get(key), dict) and isinstance(value, dict):
deep_extend(o1.get(key), 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 check_non_default_enabled
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def check_non_default_enabled(self):
self.stdout.write(
self.style.WARNING(
'These markets do not have the default enabled status, '
'they will require this change to be done manually!'
- 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"