File VexFlowMusicSheetCalculator.ts
has 1432 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { MusicSheetCalculator } from "../MusicSheetCalculator";
import { VexFlowGraphicalSymbolFactory } from "./VexFlowGraphicalSymbolFactory";
import { GraphicalMeasure } from "../GraphicalMeasure";
import { StaffLine } from "../StaffLine";
import { SkyBottomLineBatchCalculator } from "../SkyBottomLineBatchCalculator";
Function calculateMeasureXLayout
has a Cognitive Complexity of 129 (exceeds 5 allowed). Consider refactoring. Open
protected calculateMeasureXLayout(measures: GraphicalMeasure[]): number {
const visibleMeasures: GraphicalMeasure[] = [];
for (const measure of measures) {
if (measure?.isVisible()) { // if we don't check for visibility, invisible parts affect layout (#1444)
visibleMeasures.push(measure);
- 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 calculateGlissandi
has a Cognitive Complexity of 116 (exceeds 5 allowed). Consider refactoring. Open
public calculateGlissandi(): void {
const openGlissDict: { [staffId: number]: GraphicalGlissando[] } = {};
for (const graphicalMeasure of this.graphicalMusicSheet.MeasureList[0]) { //let i: number = 0; i < this.graphicalMusicSheet.MeasureList[0].length; i++) {
openGlissDict[graphicalMeasure.ParentStaff.idInMusicSheet] = [];
}
- 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 calculateSingleOctaveShift
has a Cognitive Complexity of 101 (exceeds 5 allowed). Consider refactoring. Open
protected calculateSingleOctaveShift(sourceMeasure: SourceMeasure, multiExpression: MultiExpression, measureIndex: number, staffIndex: number): void {
// calculate absolute Timestamp and startStaffLine (and EndStaffLine if needed)
const octaveShift: OctaveShift = multiExpression.OctaveShiftStart;
const startTimeStamp: Fraction = octaveShift.ParentStartMultiExpression.Timestamp;
- 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 calculateSlurs
has a Cognitive Complexity of 97 (exceeds 5 allowed). Consider refactoring. Open
protected calculateSlurs(): void {
const openSlursDict: { [staffId: number]: GraphicalSlur[] } = {};
for (const graphicalMeasure of this.graphicalMusicSheet.MeasureList[0]) { //let i: number = 0; i < this.graphicalMusicSheet.MeasureList[0].length; i++) {
openSlursDict[graphicalMeasure.ParentStaff.idInMusicSheet] = [];
}
- 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 calculateSinglePedal
has a Cognitive Complexity of 74 (exceeds 5 allowed). Consider refactoring. Open
protected calculateSinglePedal(sourceMeasure: SourceMeasure, multiExpression: MultiExpression, measureIndex: number, staffIndex: number): void {
// calculate absolute Timestamp and startStaffLine (and EndStaffLine if needed)
const pedal: Pedal = multiExpression.PedalStart;
const startTimeStamp: Fraction = pedal.ParentStartMultiExpression.Timestamp;
- 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 calculateElongationFactor
has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring. Open
private calculateElongationFactor(containers: (GraphicalLyricEntry|GraphicalChordSymbolContainer)[], staffEntry: GraphicalStaffEntry, lastEntryDict: any,
oldMinimumStaffEntriesWidth: number, elongationFactorForMeasureWidth: number,
measureNumber: number, oldMinSpacing: number, nextMeasureOverlap: number): number {
let newElongationFactorForMeasureWidth: number = elongationFactorForMeasureWidth;
let currentContainerIndex: number = 0;
- 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 calculatePedalSkyBottomLine
has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring. Open
private calculatePedalSkyBottomLine(startVfVoiceEntry: VexFlowVoiceEntry, endVfVoiceEntry: VexFlowVoiceEntry,
vfPedal: VexFlowPedal, parentStaffline: StaffLine): void {
let endBbox: BoundingBox = endVfVoiceEntry?.PositionAndShape;
if (!endBbox) {
endBbox = vfPedal.endMeasure.PositionAndShape;
- 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 calculateMeasureXLayout
has 158 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected calculateMeasureXLayout(measures: GraphicalMeasure[]): number {
const visibleMeasures: GraphicalMeasure[] = [];
for (const measure of measures) {
if (measure?.isVisible()) { // if we don't check for visibility, invisible parts affect layout (#1444)
visibleMeasures.push(measure);
Function calculateSingleOctaveShift
has 151 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected calculateSingleOctaveShift(sourceMeasure: SourceMeasure, multiExpression: MultiExpression, measureIndex: number, staffIndex: number): void {
// calculate absolute Timestamp and startStaffLine (and EndStaffLine if needed)
const octaveShift: OctaveShift = multiExpression.OctaveShiftStart;
const startTimeStamp: Fraction = octaveShift.ParentStartMultiExpression.Timestamp;
Function calculateSinglePedal
has 149 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected calculateSinglePedal(sourceMeasure: SourceMeasure, multiExpression: MultiExpression, measureIndex: number, staffIndex: number): void {
// calculate absolute Timestamp and startStaffLine (and EndStaffLine if needed)
const pedal: Pedal = multiExpression.PedalStart;
const startTimeStamp: Fraction = pedal.ParentStartMultiExpression.Timestamp;
Function calculatePedalSkyBottomLine
has 125 lines of code (exceeds 25 allowed). Consider refactoring. Open
private calculatePedalSkyBottomLine(startVfVoiceEntry: VexFlowVoiceEntry, endVfVoiceEntry: VexFlowVoiceEntry,
vfPedal: VexFlowPedal, parentStaffline: StaffLine): void {
let endBbox: BoundingBox = endVfVoiceEntry?.PositionAndShape;
if (!endBbox) {
endBbox = vfPedal.endMeasure.PositionAndShape;
VexFlowMusicSheetCalculator
has 37 functions (exceeds 20 allowed). Consider refactoring. Open
export class VexFlowMusicSheetCalculator extends MusicSheetCalculator {
/** space needed for a dash for lyrics spacing, calculated once */
private dashSpace: number;
public beamsNeedUpdate: boolean = false;
Function layoutGraphicalTie
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
protected layoutGraphicalTie(tie: GraphicalTie, tieIsAtSystemBreak: boolean, isTab: boolean): void {
const startNote: VexFlowGraphicalNote = (tie.StartNote as VexFlowGraphicalNote);
const endNote: VexFlowGraphicalNote = (tie.EndNote as VexFlowGraphicalNote);
let vfStartNote: VF.StemmableNote = undefined;
- 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 calculateGlissandi
has 99 lines of code (exceeds 25 allowed). Consider refactoring. Open
public calculateGlissandi(): void {
const openGlissDict: { [staffId: number]: GraphicalGlissando[] } = {};
for (const graphicalMeasure of this.graphicalMusicSheet.MeasureList[0]) { //let i: number = 0; i < this.graphicalMusicSheet.MeasureList[0].length; i++) {
openGlissDict[graphicalMeasure.ParentStaff.idInMusicSheet] = [];
}
Function calculateElongationFactor
has 99 lines of code (exceeds 25 allowed). Consider refactoring. Open
private calculateElongationFactor(containers: (GraphicalLyricEntry|GraphicalChordSymbolContainer)[], staffEntry: GraphicalStaffEntry, lastEntryDict: any,
oldMinimumStaffEntriesWidth: number, elongationFactorForMeasureWidth: number,
measureNumber: number, oldMinSpacing: number, nextMeasureOverlap: number): number {
let newElongationFactorForMeasureWidth: number = elongationFactorForMeasureWidth;
let currentContainerIndex: number = 0;
Function layoutGraphicalTie
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected layoutGraphicalTie(tie: GraphicalTie, tieIsAtSystemBreak: boolean, isTab: boolean): void {
const startNote: VexFlowGraphicalNote = (tie.StartNote as VexFlowGraphicalNote);
const endNote: VexFlowGraphicalNote = (tie.EndNote as VexFlowGraphicalNote);
let vfStartNote: VF.StemmableNote = undefined;
Function calculateSlurs
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected calculateSlurs(): void {
const openSlursDict: { [staffId: number]: GraphicalSlur[] } = {};
for (const graphicalMeasure of this.graphicalMusicSheet.MeasureList[0]) { //let i: number = 0; i < this.graphicalMusicSheet.MeasureList[0].length; i++) {
openSlursDict[graphicalMeasure.ParentStaff.idInMusicSheet] = [];
}
Function calculateOctaveShiftSkyBottomLine
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
private calculateOctaveShiftSkyBottomLine(startStaffEntry: GraphicalStaffEntry, endStaffEntry: GraphicalStaffEntry,
vfOctaveShift: VexFlowOctaveShift, parentStaffline: StaffLine): void {
if (!endStaffEntry) {
log.warn("octaveshift: no endStaffEntry");
return;
- 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 calculateOctaveShiftSkyBottomLine
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
private calculateOctaveShiftSkyBottomLine(startStaffEntry: GraphicalStaffEntry, endStaffEntry: GraphicalStaffEntry,
vfOctaveShift: VexFlowOctaveShift, parentStaffline: StaffLine): void {
if (!endStaffEntry) {
log.warn("octaveshift: no endStaffEntry");
return;
Function calculateDynamicExpressionsForMultiExpression
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected calculateDynamicExpressionsForMultiExpression(multiExpression: MultiExpression, measureIndex: number, staffIndex: number): void {
if (measureIndex < this.rules.MinMeasureToDrawIndex || measureIndex > this.rules.MaxMeasureToDrawIndex) {
return;
// we do already use the min/max in MusicSheetCalculator.calculateDynamicsExpressions,
// but this may be necessary for StaffLinkedExpressions, not tested.
Function calculateElongationFactorFromStaffEntries
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public calculateElongationFactorFromStaffEntries(staffEntries: GraphicalStaffEntry[], oldMinimumStaffEntriesWidth: number,
elongationFactorForMeasureWidth: number, measureNumber: number): number {
interface EntryInfo {
cumulativeOverlap: number;
extend: boolean;
Function createMetronomeMark
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected createMetronomeMark(metronomeExpression: InstantaneousTempoExpression): void {
// note: sometimes MeasureNumber is 0 here, e.g. in Christbaum, maybe because of pickup measure (auftakt)
const measureNumber: number = Math.max(metronomeExpression.ParentMultiTempoExpression.SourceMeasureParent.MeasureNumber - 1, 0);
const staffNumber: number = Math.max(metronomeExpression.StaffNumber - 1, 0);
const firstMetronomeMark: boolean = measureNumber === 0 && staffNumber === 0;
Function formatMeasures
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
protected formatMeasures(): void {
// let totalFinalizeBeamsTime: number = 0;
for (const verticalMeasureList of this.graphicalMusicSheet.MeasureList) {
if (!verticalMeasureList || !verticalMeasureList[0]) {
continue;
- 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 calculateDynamicExpressionsForMultiExpression
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
protected calculateDynamicExpressionsForMultiExpression(multiExpression: MultiExpression, measureIndex: number, staffIndex: number): void {
if (measureIndex < this.rules.MinMeasureToDrawIndex || measureIndex > this.rules.MaxMeasureToDrawIndex) {
return;
// we do already use the min/max in MusicSheetCalculator.calculateDynamicsExpressions,
// but this may be necessary for StaffLinkedExpressions, not tested.
- 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 calculateSkyBottomLines
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected calculateSkyBottomLines(): void {
const staffLines: StaffLine[] = CollectionUtil.flat(this.musicSystems.map(musicSystem => musicSystem.StaffLines));
//const numMeasures: number = staffLines.map(staffLine => staffLine.Measures.length).reduce((a, b) => a + b, 0);
let numMeasures: number = 0; // number of graphical measures that are rendered
for (const staffline of staffLines) {
- 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 handleVoiceEntryLyrics
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected handleVoiceEntryLyrics(voiceEntry: VoiceEntry, graphicalStaffEntry: GraphicalStaffEntry, lyricWords: LyricWord[]): void {
voiceEntry.LyricsEntries.forEach((key: string, lyricsEntry: LyricsEntry) => {
const graphicalLyricEntry: GraphicalLyricEntry = new GraphicalLyricEntry(lyricsEntry,
graphicalStaffEntry,
this.rules.LyricsHeight,
Function createMetronomeMark
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected createMetronomeMark(metronomeExpression: InstantaneousTempoExpression): void {
// note: sometimes MeasureNumber is 0 here, e.g. in Christbaum, maybe because of pickup measure (auftakt)
const measureNumber: number = Math.max(metronomeExpression.ParentMultiTempoExpression.SourceMeasureParent.MeasureNumber - 1, 0);
const staffNumber: number = Math.max(metronomeExpression.StaffNumber - 1, 0);
const firstMetronomeMark: boolean = measureNumber === 0 && staffNumber === 0;
- 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
for (const graphicalVoiceEntry of graphicalStaffEntry.graphicalVoiceEntries) {
for (const graphicalNote of graphicalVoiceEntry.notes) {
for (const slur of graphicalNote.sourceNote.NoteSlurs) {
// extra check for some MusicSheets that have openSlurs (because only the first Page is available -> Recordare files)
if (!slur.EndNote || !slur.StartNote) {
Avoid deeply nested control flow statements. Open
for (const gGliss of openGlissandi) {
if (gGliss.staffEntries.indexOf(graphicalStaffEntry) === -1) {
gGliss.staffEntries.push(graphicalStaffEntry);
}
}
Avoid deeply nested control flow statements. Open
if (startMeasure) {
startMeasure.vfTies.push(vfTie);
(gGliss as VexFlowGlissando).vfTie = vfTie;
}
Avoid deeply nested control flow statements. Open
for (const voiceEntry of staffEntry.graphicalVoiceEntries) {
if (!voiceEntry.parentVoiceEntry.IsGrace) {
if (voiceEntry && voiceEntry.notes && voiceEntry.notes[0] && voiceEntry.notes[0].sourceNote) {// TODO null chaining, TS 3.7
if (voiceEntry.notes[0].sourceNote.PrintObject) { // only respect collision when not invisible
collidableVoiceEntries++;
Avoid deeply nested control flow statements. Open
if (i < systemsInBetweenCount - 1) {
// if not - 1, the last octaveshift will always go to the end of the staffline
nextOctaveShift.endsOnDifferentStaffLine = true;
nextOctaveShift.graphicalEndAtMeasureEnd = true;
nextOctaveShift.endMeasure = nextShiftLastMeasure;
Avoid deeply nested control flow statements. Open
if (endMeasure.ParentStaffLine === nextShiftStaffline) {
nextShiftLastMeasure = endMeasure;
lastNote = endStaffEntry;
}
Avoid deeply nested control flow statements. Open
if (startNote.FretNumber > endNote.FretNumber) {
slideDirection = -1;
}
Avoid deeply nested control flow statements. Open
for (const graphicalVoiceEntry of graphicalStaffEntry.graphicalVoiceEntries) {
for (const graphicalNote of graphicalVoiceEntry.notes) {
const gliss: Glissando = graphicalNote.sourceNote.NoteGlissando;
// extra check for some MusicSheets that have openSlurs (because only the first Page is available -> Recordare files)
if (!gliss?.EndNote || !gliss?.StartNote) {
Avoid deeply nested control flow statements. Open
for (let i: number = startStaffLine.ParentMusicSystem.Id; i < endStaffLine.ParentMusicSystem.Id; i++) {
const nextPedalMusicSystem: MusicSystem = this.musicSystems[i + 1];
const nextPedalStaffline: StaffLine = nextPedalMusicSystem.StaffLines[staffIndex];
const nextPedalFirstMeasure: GraphicalMeasure = nextPedalStaffline.Measures[0];
let nextOpenEnd: boolean = false;
Avoid deeply nested control flow statements. Open
if (endingBarStyleEnum === SystemLinesEnum.ThinBold ||
endingBarStyleEnum === SystemLinesEnum.DotsThinBold
) {
barlineSpacing = this.rules.PickupMeasureRepetitionSpacing;
break;
Avoid deeply nested control flow statements. Open
if (!lastNote) {
log.warn(logPrefix + "no lastNote found");
}
Avoid deeply nested control flow statements. Open
for (const staffline of nextShiftMusicSystem.StaffLines) {
if (staffline.ParentStaff.idInMusicSheet === staffIndex) {
nextShiftStaffline = staffline;
break;
}
Avoid deeply nested control flow statements. Open
switch (pedalMarking.style) {
case PEDAL_STYLES_ENUM.BRACKET_OPEN_END:
case PEDAL_STYLES_ENUM.BRACKET_OPEN_BOTH:
case PEDAL_STYLES_ENUM.MIXED_OPEN_END:
otherPedalStopX = otherPedalEndBBox.AbsolutePosition.x + otherPedalEndBBox.BorderRight - otherPedalMarkingMarginXOffset;
Avoid deeply nested control flow statements. Open
for (const gSlur of openGraphicalSlurs) {
if (gSlur.staffEntries.indexOf(graphicalStaffEntry) === -1) {
gSlur.staffEntries.push(graphicalStaffEntry);
}
}
Avoid deeply nested control flow statements. Open
if (!firstNote) {
log.warn(logPrefix + "no firstNote found");
}
Avoid deeply nested control flow statements. Open
if (vfStartNote && vfStartNote.vfnote && vfStartNote.vfnote.length >= 2) {
startStemmableNote = vfStartNote.vfnote[0]; // otherwise needs to be undefined in TabSlide constructor!
first_indices = [0];
// startNoteIndexInTie = vfStartNote.vfnote[1];
}
Avoid deeply nested control flow statements. Open
if (alignRests) {
break;
}
Avoid deeply nested control flow statements. Open
if (!nextShiftStaffline) { // shouldn't happen
continue;
}
Avoid deeply nested control flow statements. Open
if (endMeasure) {
endMeasure.vfTies.push(vfTie);
(gGliss as VexFlowGlissando).vfTie = vfTie;
}
Avoid deeply nested control flow statements. Open
if (startTieNote.FretNumber > endTieNote.FretNumber) {
slideDirection = -1;
}
Avoid deeply nested control flow statements. Open
if (this.dashSpace === undefined) { // don't replace undefined check
this.dashSpace = 1.5;
// better method, doesn't work:
// this.dashLength = new GraphicalLabel(new Label("-"), this.rules.LyricsHeight, TextAlignmentEnum.CenterBottom)
// .PositionAndShape.Size.width; // always returns 0
Avoid deeply nested control flow statements. Open
if (lastNote.graphicalVoiceEntries.length === 1 &&
lastNote.graphicalVoiceEntries[0].notes.length === 1 &&
lastNote.graphicalVoiceEntries[0].notes[0].sourceNote.isWholeMeasureNote()
) {
// also draw octaveshift until end of measure if we have a whole note that goes over the whole measure
Avoid deeply nested control flow statements. Open
if (!vfStartNote && !vfEndNote) {
return; // otherwise causes Vexflow error
}
Avoid deeply nested control flow statements. Open
if (vfEndNote && vfEndNote.vfnote && vfEndNote.vfnote.length >= 2) {
endStemmableNote = vfEndNote.vfnote[0];
last_indices = [0];
// endNoteIndexInTie = vfEndNote.vfnote[1];
}
Avoid too many return
statements within this function. Open
return;
Function calculateExpressionAlignements
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected calculateExpressionAlignements(): void {
for (const musicSystem of this.musicSystems) {
for (const staffLine of musicSystem.StaffLines) {
try {
(<VexFlowStaffLine>staffLine).AlignmentManager.alignDynamicExpressions();
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
if(pedalMarking.EndsStave){
if(endVfVoiceEntry){
stopX = endVfVoiceEntry.parentStaffEntry.parentMeasure.PositionAndShape.AbsolutePosition.x +
endVfVoiceEntry.parentStaffEntry.parentMeasure.PositionAndShape.Size.width - pedalMarkingMarginXOffset;
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 94.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if(otherPedalMarking.EndsStave){
otherPedalStopX = otherPedalEndBBox.AbsolutePosition.x + otherPedalEndBBox.Size.width - otherPedalMarkingMarginXOffset;
} else {
switch (pedalMarking.style) {
case PEDAL_STYLES_ENUM.BRACKET_OPEN_END:
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 94.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
} else if (this.rules.DefaultVexFlowNoteFont?.toLowerCase() === "petaluma") {
(Vex.Flow as any).DEFAULT_FONT_STACK = [(Vex.Flow as any).Fonts?.Petaluma, (Vex.Flow as any).Fonts?.Gonville, (Vex.Flow as any).Fonts?.Bravura];
}
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 75.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
if (this.rules.DefaultVexFlowNoteFont?.toLowerCase() === "gonville") {
(Vex.Flow as any).DEFAULT_FONT_STACK = [(Vex.Flow as any).Fonts?.Gonville, (Vex.Flow as any).Fonts?.Bravura, (Vex.Flow as any).Fonts?.Custom];
} else if (this.rules.DefaultVexFlowNoteFont?.toLowerCase() === "petaluma") {
(Vex.Flow as any).DEFAULT_FONT_STACK = [(Vex.Flow as any).Fonts?.Petaluma, (Vex.Flow as any).Fonts?.Gonville, (Vex.Flow as any).Fonts?.Bravura];
}
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 75.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (index >= 0) {
// save Voice Entry in gliss and then remove it from array of open glissandi
const gGliss: GraphicalGlissando = openGlissandi[index];
if (gGliss.staffEntries.indexOf(graphicalStaffEntry) === -1) {
gGliss.staffEntries.push(graphicalStaffEntry);
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 75.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (index >= 0) {
// save Voice Entry in VFSlur and then remove it from array of open VFSlurs
const gSlur: GraphicalSlur = openGraphicalSlurs[index];
if (gSlur.staffEntries.indexOf(graphicalStaffEntry) === -1) {
gSlur.staffEntries.push(graphicalStaffEntry);
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 75.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (staffEntry.LyricsEntries.length > 0 && this.rules.RenderLyrics) {
newElongationFactorForMeasureWidth =
this.calculateElongationFactor(
staffEntry.LyricsEntries,
staffEntry,
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 73.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (staffEntry.graphicalChordContainers.length > 0 && this.rules.RenderChordSymbols) {
newElongationFactorForMeasureWidth =
this.calculateElongationFactor(
staffEntry.graphicalChordContainers,
staffEntry,
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 73.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (lastNote.graphicalVoiceEntries.length === 1 &&
lastNote.graphicalVoiceEntries[0].notes.length === 1 &&
lastNote.graphicalVoiceEntries[0].notes[0].sourceNote.isWholeMeasureNote()
) {
// also draw octaveshift until end of measure if we have a whole note that goes over the whole measure
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 69.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
public indexOfGraphicalGlissFromGliss(gGlissandi: GraphicalGlissando[], glissando: Glissando): number {
for (let glissIndex: number = 0; glissIndex < gGlissandi.length; glissIndex++) {
if (gGlissandi[glissIndex].Glissando === glissando) {
return glissIndex;
}
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 62.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
public findIndexGraphicalSlurFromSlur(gSlurs: GraphicalSlur[], slur: Slur): number {
for (let slurIndex: number = 0; slurIndex < gSlurs.length; slurIndex++) {
if (gSlurs[slurIndex].slur === slur) {
return slurIndex;
}
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 62.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (startNote && startNote.vfnote && startNote.vfnote.length >= 2) {
vfStartNote = startNote.vfnote[0];
startNoteIndexInTie = startNote.vfnote[1];
}
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 61.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (endNote && endNote.vfnote && endNote.vfnote.length >= 2) {
vfEndNote = endNote.vfnote[0];
endNoteIndexInTie = endNote.vfnote[1];
}
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 61.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
protected handleTiedGraphicalNote(tiedGraphicalNote: GraphicalNote, beams: Beam[], activeClef: ClefInstruction,
octaveShiftValue: OctaveEnum, graphicalStaffEntry: GraphicalStaffEntry, duration: Fraction,
openTie: Tie, isLastTieNote: boolean): void {
return;
}
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 57.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (startMeasure.MeasureNumber < minMeasureToDrawIndex + 1) { // octaveshift starts before range of measures selected to render
startMeasure = this.graphicalMusicSheet.MeasureList[minMeasureToDrawIndex][staffIndex]; // first rendered measure
}
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 46.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (startMeasure.MeasureNumber < minMeasureToDrawIndex + 1) { // starts before range of measures selected to render
startMeasure = this.graphicalMusicSheet.MeasureList[minMeasureToDrawIndex][staffIndex]; // first rendered measure
}
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 46.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
stopX = endVfVoiceEntry.parentStaffEntry.parentMeasure.PositionAndShape.AbsolutePosition.x +
endVfVoiceEntry.parentStaffEntry.parentMeasure.PositionAndShape.Size.width - pedalMarkingMarginXOffset;
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 45.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76