Showing 50 of 76 total issues
Function decode
has a Cognitive Complexity of 90 (exceeds 5 allowed). Consider refactoring. Open
function decode(chip, opcode, keyboard, logger) {
const a = (opcode >> 12) & 0xf;
const b = (opcode >> 8) & 0xf;
const c = (opcode >> 4) & 0xf;
const d = opcode & 0xf;
- 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
File chip8.js
has 625 lines of code (exceeds 250 allowed). Consider refactoring. Open
const cloneDeep = require("lodash/cloneDeep");
const values = require("lodash/values");
const range = require("lodash/range");
const consts = require("./consts");
Function decode
has 193 lines of code (exceeds 25 allowed). Consider refactoring. Open
function decode(chip, opcode, keyboard, logger) {
const a = (opcode >> 12) & 0xf;
const b = (opcode >> 8) & 0xf;
const c = (opcode >> 4) & 0xf;
const d = opcode & 0xf;
Function decode2
has 135 lines of code (exceeds 25 allowed). Consider refactoring. Open
function decode2(chip, pc) {
const opcode = fetch(chip, pc);
const a = (opcode >> 12) & 0xf;
const b = (opcode >> 8) & 0xf;
const c = (opcode >> 4) & 0xf;
Function decode2
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
function decode2(chip, pc) {
const opcode = fetch(chip, pc);
const a = (opcode >> 12) & 0xf;
const b = (opcode >> 8) & 0xf;
const c = (opcode >> 4) & 0xf;
- 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 update
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
function update(chip) {
function formatDebugString(str, digits, val) {
return `${str}: ${val
.toString(16)
.padStart(digits, "0")
Function exports
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = env => {
const GHPAGES = env && env.GHPAGES;
const plugins = [
new webpack.DefinePlugin({
Function init
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
function init() {
canvas = document.querySelector("#emulator");
romSelect = document.querySelector("select#rom-select");
romSelect.onchange = e => loadRom(event.target.value);
Function drw
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function drw(chip8, x, y, byte) {
let vf = 0;
const xCoord = chip8.v[x];
const yCoord = chip8.v[y];
const i = chip8.i;
- 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 too many return
statements within this function. Open
return module.exports.ldVxDT(chip, x);
Avoid too many return
statements within this function. Open
return module.exports.ldVxIndirectI(chip, x);
Avoid too many return
statements within this function. Open
return "SNE Vx, Vy";
Avoid too many return
statements within this function. Open
return "LD I, addr";
Avoid too many return
statements within this function. Open
return "LD Vx, Vy";
Avoid too many return
statements within this function. Open
return "ADD I, Vx";
Avoid too many return
statements within this function. Open
return module.exports.sne(chip, vx, byte);
Avoid too many return
statements within this function. Open
return "Fx29";
Avoid too many return
statements within this function. Open
return "Fx65";
Avoid too many return
statements within this function. Open
return module.exports.ldDTVx(chip, x);
Avoid too many return
statements within this function. Open
return "LD Vx, byte";