Showing 168 of 286 total issues
Avoid deeply nested control flow statements. Open
if (!score.measures[i].notes[j].pitch.chord) {
// determine note variables
var step = score.measures[i].notes[j].pitch.step;
var octave = score.measures[i].notes[j].pitch.octave;
var alter = score.measures[i].notes[j].pitch.alter;
Avoid deeply nested control flow statements. Open
if (type === "whole" || type === "half") {
var keys = ["b/4/d0"];
} else {
var keys = ["b/4/d2"];
}
Avoid deeply nested control flow statements. Open
} else if (score.measures[i].notes[j].type === "rest") {
var durationType = 1; // rests type is 1
var noteDuration = getVexflowDuration(score.measures[i].notes[j].duration, durationType);
note = new Vex.Flow.StaveNote({ keys: ["b/4"], duration: noteDuration });
Avoid deeply nested control flow statements. Open
if (pattern.measures[i].notes[j].type === "note") {
if (!pattern.measures[i].notes[j].pitch.chord) {
// determine note variables
var step = pattern.measures[i].notes[j].pitch.step;
var octave = pattern.measures[i].notes[j].pitch.octave;
Avoid deeply nested control flow statements. Open
if(typeof noteTuplet === 'undefined'){
console.log("beam is undefined");
noteTuplet = false;
}
Avoid deeply nested control flow statements. Open
if (measures[i].ties[j].indexOf("start") > -1) {
tieStart = measures[i].notes[j];
}
Avoid deeply nested control flow statements. Open
if (pattern.measures[i].notes[j].pitch.dot) {
durationType = 2;
}
Avoid deeply nested control flow statements. Open
if(note.pitch.dot){
noteDuration += 0.5*noteDuration;
}
Function ApplicationController
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
MusicXMLAnalyzer.ApplicationController = function() {
var that = {},
headerController = null,
uploadController = null,
- 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
if (pattern.measures[i].notes[j].pitch.dot) {
note.addDotToAll();
}
Avoid deeply nested control flow statements. Open
if(typeof noteDuration === 'undefined'){
noteDuration = 0.25;
}
Avoid deeply nested control flow statements. Open
if (pattern.measures[i].notes[j].pitch.beam) {
var beam = pattern.measures[i].notes[j].pitch.beam;
if (beam === "begin" || beam === "continue" || beam === "end") {
tuplet = "3";
}
Avoid deeply nested control flow statements. Open
if (measures[i].ties[j].indexOf("stop") > -1) {
tieStop = measures[i].notes[j];
if (tieStart !== null) {
var tie = new Vex.Flow.StaveTie({ first_note: tieStart, last_note: tieStop, first_indices: [0], last_indices: [0] });
ties.push(tie);
Avoid deeply nested control flow statements. Open
if (measures[i].ties[j].indexOf("stop") > -1) {
tieStop = measures[i].notes[j];
if (tieStart !== null) {
var tie = new Vex.Flow.StaveTie({ first_note: tieStart, last_note: tieStop, first_indices: [0], last_indices: [0] });
ties.push(tie);
Avoid deeply nested control flow statements. Open
} else if (pattern.measures[i].notes[j].type === "rest") {
var durationType = 1; // rests type is 1
var noteDuration = getVexflowDuration(pattern.measures[i].notes[j].duration, durationType);
note = new Vex.Flow.StaveNote({ keys: ["b/4"], duration: noteDuration });
Function renderNotes
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
renderNotes = function(measures, canvas, renderer, context, stave, score) {
Function getPartsList
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getPartsList($uploadId, $partId) {
$upload = Upload::find($uploadId);
if ($upload) {
$doc = new DOMDocument();
$doc->loadXML($upload->content);
- 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
Consider simplifying this complex logical expression. Open
if (($j == $startMeasure && $noteCounter >= $start) || ($j > $startMeasure && $j < $endMeasure) || ($j == $endMeasure && $noteCounter <= $end)) {
// set color to red if note is between start and end of result
$currentColor = "#b71c1c";
}
Function getHome
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getHome() {
if (Cookie::get('user_id')) {
$user = User::find(Cookie::get('user_id'));
if ($user) {
$name = 'user_id';
- 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 method. Open
return "eighth";