Showing 33 of 167 total issues
Function midiEventsCreateParser
has a Cognitive Complexity of 132 (exceeds 5 allowed). Consider refactoring. Open
MIDIEvents.createParser = function midiEventsCreateParser(
stream,
startAt,
strictMode
) {
- 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 midiEventsWriteToTrack
has a Cognitive Complexity of 88 (exceeds 5 allowed). Consider refactoring. Open
MIDIEvents.writeToTrack = function midiEventsWriteToTrack(
events,
destination,
strictMode
) {
- 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 midiEventsCreateParser
has 282 lines of code (exceeds 25 allowed). Consider refactoring. Open
MIDIEvents.createParser = function midiEventsCreateParser(
stream,
startAt,
strictMode
) {
File midievents.js
has 542 lines of code (exceeds 250 allowed). Consider refactoring. Open
'use strict';
// MIDIEvents : Read and edit events from various sources (ArrayBuffer, Stream)
function MIDIEvents() {
throw new Error('MIDIEvents function not intended to be run.');
Function next
has 220 lines of code (exceeds 25 allowed). Consider refactoring. Open
next: function() {
// Check available datas
if (stream.end()) {
return null;
}
Function midiEventsWriteToTrack
has 169 lines of code (exceeds 25 allowed). Consider refactoring. Open
MIDIEvents.writeToTrack = function midiEventsWriteToTrack(
events,
destination,
strictMode
) {
File midievents.mocha.js
has 395 lines of code (exceeds 250 allowed). Consider refactoring. Open
'use strict';
var assert = require('assert');
var MIDIEvents = require('../src/midievents');
Function getRequiredBufferLength
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
MIDIEvents.getRequiredBufferLength = function(events) {
var bufferLength = 0;
var i = 0;
var j;
- 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 getRequiredBufferLength
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
MIDIEvents.getRequiredBufferLength = function(events) {
var bufferLength = 0;
var i = 0;
var j;
Avoid deeply nested control flow statements. Open
if (strictMode && 59 < events[i].seconds) {
throw new Error(
'Event #' +
i +
': SMTPE offset seconds value must' +
Avoid deeply nested control flow statements. Open
for (k = 0, l = events[i].length; k < l; k++) {
destination[index++] = events[i].data[k];
}
Avoid deeply nested control flow statements. Open
if (
'number' !== typeof events[i].scale ||
0 > events[i].scale ||
1 < events[i].scale
) {
Avoid deeply nested control flow statements. Open
if (strictMode && 99 < events[i].subframes) {
throw new Error(
'Event #' +
i +
': SMTPE offset subframes amount' +
Avoid deeply nested control flow statements. Open
for (k = 0, l = events[i].length; k < l; k++) {
destination[index++] = events[i].data[k];
}
Avoid deeply nested control flow statements. Open
if (strictMode && 23 < events[i].hour) {
throw new Error(
'Event #' +
i +
': SMTPE offset hour value must be' +
Avoid deeply nested control flow statements. Open
if (strictMode && 59 < events[i].minutes) {
throw new Error(
'Event #' +
i +
': SMTPE offset minutes value must' +
Avoid deeply nested control flow statements. Open
if (
'number' != typeof events[i].key ||
-7 > events[i].key ||
7 < events[i].scale
) {
Avoid deeply nested control flow statements. Open
if (strictMode && 30 < events[i].frames) {
throw new Error(
'Event #' +
i +
': SMTPE offset frames amount must' +
Avoid too many return
statements within this function. Open
return event;
Avoid too many return
statements within this function. Open
return event;