Showing 136 of 282 total issues
Function setActive
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
setActive(which: string): void {
const $current = $('.game-items').find('li.active').length ? $('.game-items li.active') : $('.game-items li:first');
let $el;
this.templateHelper.removeClass('active', $current);
if (which === 'next') {
- 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 scoreBlocks
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function scoreBlocks(possibles, blocks, x, y, filled, width, height) {
Function drawBlock
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
drawBlock: function(x, y, blockType, blockVariation, blockIndex, blockRotation, falling) {
Function v
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function v(t, n, i, r, a, s, u) {
Avoid deeply nested control flow statements. Open
Open
if (n.dataFilter == v) return t;
Avoid deeply nested control flow statements. Open
Open
if (shiftIndex) { i = shiftIndex; }
Avoid deeply nested control flow statements. Open
Open
for (j = i + 1; j < helperParts.length; j += 1) {
hashContent += " " + (helperParts[j]);
if (helperParts[j].indexOf(openingQuote) >= 0) {
shiftIndex = j;
break;
Function computeLineStartsMap
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
export function computeLineStartsMap(text: string): number[] {
const result: number[] = [0];
let pos = 0;
while (pos < text.length) {
const char = text.charCodeAt(pos++);
- 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
Open
if (y + blocks[i] < 0) {
gameOver = true;
}
Avoid deeply nested control flow statements. Open
Open
if (stringBlocks[j].indexOf(("{{#" + helperName)) >= 0) {
helperContent += stringBlocks[j];
if (foundElse) { elseContent += stringBlocks[j]; }
toSkip += 1;
} else if (stringBlocks[j].indexOf(("{{/" + helperName)) >= 0) {
Avoid deeply nested control flow statements. Open
Open
if (stringBlocks[j].indexOf('{{/') >= 0) {
depth -= 1;
}
Avoid deeply nested control flow statements. Open
Open
if (n) return p(n, "parsererror", k, y, b)
Avoid deeply nested control flow statements. Open
Open
if (helperParts[j].indexOf(openingQuote) >= 0) {
shiftIndex = j;
slices.push(part);
break;
}
Function add
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
add: function(x, y, blockType, blockVariation, blockIndex, blockOrientation) {
Avoid deeply nested control flow statements. Open
Open
if (stringBlocks[j].indexOf('{{#') >= 0) {
depth += 1;
}
Avoid deeply nested control flow statements. Open
Open
if( game._checkCollisions(x, y + 1, blocks, true) ) {
// collision
score = scoreBlocks(possibles, blocks, x, y, filled, width, height);
if (score > best_score_for_shape) {
best_score_for_shape = score;
Avoid deeply nested control flow statements. Open
Open
if (shiftIndex) { i = shiftIndex; }
Avoid deeply nested control flow statements. Open
Open
if (isPartial) {
helperName = '_partial';
if (helperContext[0]) {
if (helperContext[0].indexOf('[') === 0) { helperContext[0] = helperContext[0].replace(/[[\]]/g, ''); }
else { helperContext[0] = "\"" + (helperContext[0].replace(/"|'/g, '')) + "\""; }
Function func
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
var func = function(filled, checkCollisions, width, height, mode, _one_shape) {
Avoid deeply nested control flow statements. Open
Open
if (helperName === 'raw') {
blocks.push({
type: 'plain',
content: helperContent,
});