Showing 25 of 104 total issues
Function loadHtml
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
loadHtml: function () {
this.dialogEl = document.createElement('div');
this.dialogEl.setAttribute("hidden", true);
this.dialogEl.setAttribute('class', 'fba-modal');
Function block
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const block = function (selection) {
selection
.each(load)
.filter(function (d) {
d.refresh = +this.getAttribute("data-refresh");
Function showValidationError
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
showValidationError: function (question, error) {
var questionDiv = question.closest(".question");
var label = questionDiv.querySelector(".usa-label") || questionDiv.querySelector(".usa-legend");
var questionNum = label.innerText;
Avoid deeply nested control flow statements. Open
Open
if (errors.hasOwnProperty(err)) {
alertErrorElementBody.innerHTML += err;
alertErrorElementBody.innerHTML += " ";
alertErrorElementBody.innerHTML += errors[err];
alertErrorElementBody.innerHTML += "<br />";
Function openDefinitionAccordionForAnchor
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
function openDefinitionAccordionForAnchor() {
// Both /definitions and /definitions/ are required here because locally the
// trailing slash is present for all links for some reason.
if (
(window.location.pathname != "/definitions" &&
- 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"