Showing 67 of 188 total issues
Function handleKeydown
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
handleKeydown(e) {
let highlightCitation = this.state.highlightCitation;
if(this.state.dropdownVisible) {
// down arrow or tab
- 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 drawChart
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
LineChart.prototype.drawChart = function() {
var entityTotals = this.groupEntityTotals();
var x = this.setXScale();
var y = this.setYScale();
var xAxis = d3.svg.axis()
Function modalRenderFactory
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
function modalRenderFactory(template, fetch) {
var callback;
fetch = fetch || identity;
return function(api, data, response) {
Function Filters
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
function Filters(props) {
const resultCountChange = props.query.resultCount - props.query.lastResultCount;
return <div>
<div className="accordion__content">
Function SearchResults
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
function SearchResults(props) {
function highlights(advisory_opinion) {
return {__html: '…' + advisory_opinion.highlights }
}
- 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 render_candidate
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def render_candidate(candidate, committees, cycle, election_full=True):
# candidate fields will be top-level in the template
tmpl_vars = candidate
tmpl_vars['parent'] = 'data'
tmpl_vars['cycle'] = cycle
- 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 exports
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(config) {
var browserify = {
debug: true,
transform: [
[{global: true}, 'hbsfy']
Function renderCandidatePanel
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
var renderCandidatePanel = function(showFinancialTotals) {
return tables.modalRenderFactory(
candidatesTemplate,
function(row) {
var query = URI.parseQuery(window.location.search);
Function initDisbursementsTable
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function initDisbursementsTable() {
var $table = $('table[data-type="itemized-disbursements"]');
var path = ['schedules', 'schedule_b'];
var opts = {
// possibility of multiple committees, so split into array
Function initSpendingTables
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function initSpendingTables() {
$('.data-table').each(function(index, table) {
var $table = $(table);
var dataType = $table.data('type');
var opts = tableOpts[dataType];
Function amendmentVersionDescription
has a Cognitive Complexity of 11 (exceeds 5 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 = '';
- 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 initCyclesMulti
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
CycleSelect.prototype.initCyclesMulti = function(selected) {
var cycles = _.range(selected - this.duration + 2, selected + 2, 2);
var params = this.getParams();
var selectedCycle;
var cycleId = this.cycleId;
Function stateLegend
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function stateLegend(svg, scale, quantize, quantiles) {
// Add legend swatches
var legendWidth = 40;
var legendBar = 35;
var ticks = quantize.ticks(quantiles);
Function render
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
return <section className="main__content--full data-container__wrapper">
<div id="filters" className="filters is-open">
<button className="filters__header filters__toggle js-filter-toggle" type="button">
<span className="filters__title">Edit filters</span>
Function refreshExport
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
DataTable.prototype.refreshExport = function() {
if (this.opts.useExport && !this.opts.disableExport) {
var numRows = this.api.context[0].fnRecordsTotal();
if (numRows > DOWNLOAD_CAP) {
this.disableExport({message: DOWNLOAD_MESSAGES.recordCap});
- 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 10 (exceeds 5 allowed). Consider refactoring. Open
ElectionSearch.prototype.search = function(e, opts) {
e && e.preventDefault();
opts = _.extend({pushState: true}, opts || {});
var self = this;
var serialized = self.serialize();
- 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 updateColorScale
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function updateColorScale($container, cached) {
$container = $container.closest('#state-maps');
var displayed = $container.find('.state-map select').map(function(_, select) {
return $(select).val();
}).get();
Function render_candidate
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def render_candidate(candidate, committees, cycle, election_full=True):
# candidate fields will be top-level in the template
tmpl_vars = candidate
tmpl_vars['parent'] = 'data'
tmpl_vars['cycle'] = cycle
Function ElectionSearch
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function ElectionSearch(selector) {
this.$elm = $(selector);
this.districts = 0;
this.serialized = {};
this.results = [];
Function buildTotalLink
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function buildTotalLink(path, getParams) {
return function(data, type, row, meta) {
data = data || 0;
var params = getParams(data, type, row, meta);
var span = document.createElement('div');