Showing 34 of 73 total issues
Function load_lists
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def load_lists(lst):
"""
loads a sample of data for each type in lst
l = PEOPLE
l = INT
- 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 __init__
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, tot_rows, col_types, col_label):
self.tot_rows = tot_rows
self.col_types = col_types
self.col_label = col_label
self.tbl = []
- 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_browser_bookmarks_chrome
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def get_browser_bookmarks_chrome(self):
"""
export Chrome bookmarks to CSV
by reading Bookmarks file in json format
"""
- 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_filtered_collist_by_name
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def get_filtered_collist_by_name(self, filename, col_name, filter_col_id, filter_val_list):
with open(filename) as f:
ndx = 0
res = []
for num, line in enumerate(f):
- 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_address
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def lookup_address(nme):
"""
use the Google map API to get address details
"""
csv_line = ''
- 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 random_person_v2
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def random_person_v2(person_generator):
"""
this should use the LISTS and the COLUMNS
which the original function isnt doing - not there yet
"""
- 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
File generate.py
has 260 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import os
import random
File browser_usage.py
has 254 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import os
import time
Function agg_4
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def agg_4(tbl, colLabel):
# Table 4 - grain_person_location.csv
tbl_agg = []
# first get distinct list of locations from source data
- 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 agg_1
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def agg_1(tbl, colLabel):
# Table 2 - grain_person_year.csv
# has one record for every person per year
tbl_agg = []
for row_worker in workers:
- 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_collist_by_name
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def get_collist_by_name(self, filename, col_name):
with open(filename) as f:
ndx = 0
res = []
for num, line in enumerate(f):
- 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 export_all_emails
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def export_all_emails(f):
"""
Walks through all stores and folders in Outlook and extracts
emails to a CSV file
"""
- 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 __init__
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self):
self.filelist = []
self.columns = []
self.lookup = []
for root, _, files in os.walk(data_fldr):
- 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 convert_csv
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def convert_csv(self):
delim = '","'
txt = '"' + self.path + delim
txt += str(self.msg.size) + delim
txt += str(self.msg.ReceivedTime) + delim
- 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 r[2] == row_loc:
amt += get_num_from_curr(r[4])
tbl_agg.append([row_worker, row_loc, amt])
Avoid deeply nested control flow statements. Open
if col.strip('"').strip('\n') == col_name:
ndx = col_num
#if 'tools.csv' in filename:
# print(cols)
if line.strip('\n').strip('') != '': # ignore blank lines
Avoid deeply nested control flow statements. Open
if r[3] == row_worker:
num_jobs += 1
amt += get_num_from_curr(r[4])
tbl_agg.append([row_year, row_worker, num_jobs, amt])
Avoid deeply nested control flow statements. Open
if lst['name'] != 'INT':
if lst['name'] == self.colTypes[c]:
txt = get_rand_text_from_list(lst['lst'])
thisRow.append(txt)
Avoid deeply nested control flow statements. Open
if random.randint(1,20) > 16:
txt += '.\n'
else:
txt += ' ' + random.choice(all_words)
lst.append(txt)
Avoid deeply nested control flow statements. Open
if cols[filter_col_id].strip('"').strip('\n') in filter_val_list:
#print('MATCH')
#print('cols[filter_col_id] = ', cols[filter_col_id])
#print('filter_val_list = ', filter_val_list)
#print('cols[ndx] = ', cols[ndx].strip('\n').strip('"'))