File parity.js
has 391 lines of code (exceeds 250 allowed). Consider refactoring. Open
var Parity = {};
$(document).ready(function(){
// Create the grid on load
Parity.grid = $('#interactive-parity-grid');
- Create a ticketCreate a ticket
Function setRandomBits
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
function setRandomBits() {
for (var row = 0; row < Parity.grid_values.length - 1; row++) {
for (var col = 0; col < Parity.grid_values.length - 1; col++) {
if (Parity.initial_bits) {
let char_position = row * (Parity.grid_values.length - 1) + col;
- Read upRead up
- Create a ticketCreate a ticket
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 setupMode
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
function setupMode() {
var header = $('#interactive-parity-mode');
// Hide all controls
$('.interactive-parity-controls').hide()
- Read upRead up
- Create a ticketCreate a ticket
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 setupGrid
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
function setupGrid(){
// Get grid size and set it
Parity.grid_size = parseInt($('#interactive-parity-grid-size').val());
// Create 2D array of bit values - true is on (white) while false is off (black)
- Read upRead up
- Create a ticketCreate a ticket
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 setupMode
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
function setupMode() {
var header = $('#interactive-parity-mode');
// Hide all controls
$('.interactive-parity-controls').hide()
- Create a ticketCreate a ticket
Function setupGrid
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
function setupGrid(){
// Get grid size and set it
Parity.grid_size = parseInt($('#interactive-parity-grid-size').val());
// Create 2D array of bit values - true is on (white) while false is off (black)
- Create a ticketCreate a ticket
Function setParityBits
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function setParityBits() {
column_counts = new Array(Parity.grid_values.length).fill(0);
for (var row = 0; row < Parity.grid_values.length-1; row++) {
var black_bit_count = 0;
- Read upRead up
- Create a ticketCreate a ticket
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 updateCircler
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function updateCircler(axis, index) {
var circler, top, left, bottom, right;
var gridUnitPercentage = 100 / Parity.grid_size;
if (axis == 'x') {
circler = Parity.rowCircler;
- Read upRead up
- Create a ticketCreate a ticket
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 checkParity
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function checkParity() {
var parity_status = true;
column_counts = new Array(Parity.grid_values.length).fill(0);
for (var row = 0; row < Parity.grid_values.length; row++) {
- Read upRead up
- Create a ticketCreate a ticket
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 updateCircler
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function updateCircler(axis, index) {
var circler, top, left, bottom, right;
var gridUnitPercentage = 100 / Parity.grid_size;
if (axis == 'x') {
circler = Parity.rowCircler;
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if (!Parity.hide_size_controls) {
$('.interactive-parity-size-controls').show();
}
- Create a ticketCreate a ticket