Showing 67 of 188 total issues
Function amendmentVersionDescription
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function amendmentVersionDescription(row) {
// Helper function for labeling filings as either an "original" or
// a numbered amendment (e.g. "amendment 1" or "amendment 2")
// Different filings are coded slightly differently, which makes for some tricky logic
var description = '';
Function formatData
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
TopEntities.prototype.formatData = function(result, rank) {
var data;
if (this.category === 'candidates') {
data = {
name: result.name,
Function stateMap
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
function stateMap($elm, data, width, height, min, max, addLegend, addTooltips) {
Function renderCandidatePanel
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
var renderCandidatePanel = function(showFinancialTotals) {
return tables.modalRenderFactory(
candidatesTemplate,
function(row) {
var query = URI.parseQuery(window.location.search);
- 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 search
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def search():
"""Renders the top-level /data page.
If there's a query string, it will
load candidate and committee search results.
- 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_with_nested
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def load_with_nested(primary_type, primary_id, secondary_type, cycle=None,
Avoid deeply nested control flow statements. Open
if ($elm.hasClass('tt-input')) {
// show message after generated checkbox (last item in list)
$label = $('[data-filter="typeahead"] li').last();
filterAction = 'Filter added';
}
Function drawResult
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
ElectionSearch.prototype.drawResult = function(result) {
var election = this.formatResult(result, this);
var upcomingElections = _.filter(this.upcomingElections, function(upcoming) {
if (election.office === 'H') {
return upcoming.election_state === election.state &&
- 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 ensureWidgets
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
DataTable.prototype.ensureWidgets = function() {
if (this.hasWidgets) { return; }
this.$processing = $('<div class="overlay is-loading"></div>').hide();
this.$body.before(this.$processing);
- 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_legal_search_results
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def load_legal_search_results(query, query_type='all', offset=0, limit=20, **kwargs):
filters = dict((key, value) for key, value in kwargs.items() if value)
if query or query_type in ['advisory_opinions', 'murs']:
filters['hits_returned'] = limit
- 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 'uscode' in url:
section = re.search('section=([0-9]+)', url).group(1)
citations.append({'text': section, 'url': url})
if 'cfr' in url:
Function collate_dispositions
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def collate_dispositions(dispositions):
""" Collate dispositions - group them by disposition, penalty """
collated_dispositions = OrderedDict()
for row in dispositions:
if row['disposition'] in collated_dispositions:
- 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 'cfr' in url:
title_no = re.search('titlenum=([0-9]+)', url).group(1)
part_no = re.search('partnum=([0-9]+)', url).group(1)
section_no = re.search('sectionnum=([0-9]+)', url).group(1)
text = '%s C.F.R. %s.%s' % (title_no, part_no, section_no)
Function murs
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def murs(query, offset, mur_no=None, mur_respondents=None, mur_election_cycles=None,
Function load_legal_search_results
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def load_legal_search_results(query, query_type='all', offset=0, limit=20, **kwargs):
Function load_nested_type
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def load_nested_type(parent_type, c_id, nested_type, *path, **filters):
Function makeSizeColumn
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
var makeSizeColumn = _.partial(makeCommitteeColumn, _, function(data, type, row, meta, column) {
Function deploy
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def deploy(ctx, space=None, branch=None, login=None, yes=False):
Function constructor
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
constructor(props) {
super(props);
const initState = URI.parseQuery(window.location.search);
initState.q = initState.search;
initState.type = initState.search_type;
- 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 CheckboxList
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function CheckboxList(props) {
function handleCheckboxListChange(e) {
const newEvent = { target: { name: props.name, value: props.value} };
// value should be set to an array of values. If the array is empty,
- 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"