Function toggleTeams
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
function toggleTeams(numteams, visible) {
for (var i = 0; i < numteams; i++) {
var sublistsize = 1;
var elementId = 'team' + i;
var obj = document.getElementById(elementId + '_' + sublistsize);
- 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 collapseObj
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
function collapseObj(obj, atag, header) {
obj.style.display = 'none';
atag.innerHTML = '<img src="/assets/expand.png">';
header.style.backgroundColor = 'white';
header.style.color = "#000000";
Function collapseObj
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function collapseObj(obj, atag, header) {
obj.style.display = 'none';
atag.innerHTML = '<img src="/assets/expand.png">';
header.style.backgroundColor = 'white';
header.style.color = "#000000";
- 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 toggleTeams
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function toggleTeams(numteams, visible) {
for (var i = 0; i < numteams; i++) {
var sublistsize = 1;
var elementId = 'team' + i;
var obj = document.getElementById(elementId + '_' + sublistsize);
Avoid deeply nested control flow statements. Open
if (visible) {
obj.style.display = '';
//E1877: changes made to adjust width of expandables
var offsets = obj.getBoundingClientRect();
obj.style.width = 'calc(100vw - 103px)';
Avoid deeply nested control flow statements. Open
if (!visible)
collapseObj(obj, atag, header);
Function toggleTeam
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function toggleTeam(elementId) {
var sublistsize = 1;
var obj = document.getElementById(elementId + '_' + sublistsize);
var atag = document.getElementById(elementId + 'Link');
var header = document.getElementById(elementId + '_header');
- 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"