Showing 66 of 168 total issues
Function handle
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def handle(self, *args, **options):
dup_sets = SubmissionsService.find_duplicates(
models.FormSubmission.objects.all())
self.stdout.write("Found {} duplicate sets".format(len(dup_sets)))
existing_dup_sets = models.DuplicateSubmissionSet.objects.all()
- 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 makeOrgChart
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
function makeOrgChart (parent, chartConfig, orgData) {
var dataArray = config.getDataForChart(chartConfig, orgData);
if (dataArray === null) {
// don't buld the chart if there is no data available.
console.log(orgData.org.name, "no data for", chartConfig.chartName, "!!!");
Function buildSearchFunction
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function buildSearchFunction(searchSpace){
return function (searchTerm){
searchTerm = searchTerm.trim();
var termLength = searchTerm.length;
var results = [];
Function initializeSearchWidget
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function initializeSearchWidget(inputSelector, postURL, resultsCallback, emptySearchCallback){
var currentXHR = null;
function handleResultsAndResetRequest(callback){
return function(results){
Function handle
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def handle(self, *args, **options):
subs = models.FormSubmission.objects.filter(dob__isnull=True)
migrated = 0
errored = 0
for sub in subs:
- 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_django_validation_error
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def handle_django_validation_error(self, error):
"""Django's ValidationError can include lists of errors,
dicts of errors or just have a simple error message.
This method is responsible for pulling error messages out of
Django ValidationError objects and selecting the right way to
- 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 _fill
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _fill(self, pdf_path, output_path, option_check, answers):
answer_fields = {'fields': []}
# TODO: make this less nested
for k, v in answers.items():
if k in option_check:
- 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 count_unreads_and_send_notifications_to_orgs
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def count_unreads_and_send_notifications_to_orgs():
orgs = get_orgs_that_might_need_a_bundle_email_today()
errors = []
for org in orgs:
if org.slug != 'cfa':
- 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 followUpQuestion
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
var followUpQuestion = (function() {
var fUQ = {
init: function() {
// if any initial questions are already selected on page load, show the follow up
Function __init__
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, *args, form=None, required=True, recommended=False,
Function link_with_any_duplicates
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def link_with_any_duplicates(submission, applicant_id):
"""Links submission with any duplicates from the same applicant
If duplicates are found, returns the DuplicateSubmissionSet id
If no duplicates are found, returns 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 dont_audit_fixture_loading
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def dont_audit_fixture_loading(
Function log_multiple
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def log_multiple(cls, event_type, submission_ids,
Function concatenated_printout
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def concatenated_printout(form_letter_tuples):
canvas = None
pdf_file = None
count = len(form_letter_tuples)
for i, form_letter_tuple in enumerate(form_letter_tuples):
- 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 drawStreamFractionsChart
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function drawStreamFractionsChart (chart, chartConfig, sizes, data, xScale, yScale) {
Function get_existing_model
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_existing_model(cls, data, lookup, qset):
for instance in qset:
is_object = True
for key in lookup:
if getattr(instance, key, None) != lookup[key]:
- 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 drawLineChart
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function drawLineChart (chart, chartConfig, sizes, data, xScale, yScale) {
Function build_bundled_pdf_if_necessary
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def build_bundled_pdf_if_necessary(bundle):
"""Populates `bundled_pdf` attribute if needed
First checks whether or not there should be a pdf. If so,
- tries to grab filled pdfs for the bundles submissions
- 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 to_representation
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def to_representation(self, obj):
mini_form = ContactInfoMiniForm(obj)
contact_preferences = obj.get('contact_preferences', [])
output = []
for key in ('sms', 'email', 'voicemail', 'snailmail'):
- 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 checkboxSelector
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
var checkboxSelector = (function() {
var cs = {
init: function() {
$('.checkbox').each(function(index, button){
if($(this).find('input').is(':checked')) {
- 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"