File MusicSheetCalculator.ts
has 2851 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { GraphicalStaffEntry } from "./GraphicalStaffEntry";
import { StaffLine } from "./StaffLine";
import { GraphicalMusicSheet } from "./GraphicalMusicSheet";
import { EngravingRules } from "./EngravingRules";
import { Tie } from "../VoiceData/Tie";
Function calculateChordSymbols
has a Cognitive Complexity of 134 (exceeds 5 allowed). Consider refactoring. Open
protected calculateChordSymbols(): void {
for (const musicSystem of this.musicSystems) {
for (const staffLine of musicSystem.StaffLines) {
const skybottomcalculator: SkyBottomLineCalculator = staffLine.SkyBottomLineCalculator;
let minimumOffset: number = Number.MAX_SAFE_INTEGER; // only calculated if option set
- 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 calculateGraphicalContinuousDynamic
has a Cognitive Complexity of 117 (exceeds 5 allowed). Consider refactoring. Open
public calculateGraphicalContinuousDynamic(graphicalContinuousDynamic: GraphicalContinuousDynamicExpression, startPosInStaffline: PointF2D): void {
const isSoftAccent: boolean = graphicalContinuousDynamic.IsSoftAccent;
const staffIndex: number = graphicalContinuousDynamic.ParentStaffLine.ParentStaff.idInMusicSheet;
// TODO: Previously the staffIndex was passed down. BUT you can (and this function actually does this) get it from
// the musicSystem OR from the ParentStaffLine. Is this the same index?
- 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
MusicSheetCalculator
has 108 functions (exceeds 20 allowed). Consider refactoring. Open
export abstract class MusicSheetCalculator {
public static symbolFactory: IGraphicalSymbolFactory;
public static transposeCalculator: ITransposeCalculator;
public static stafflineNoteCalculator: IStafflineNoteCalculator;
protected static textMeasurer: ITextMeasurer;
Function createGraphicalMeasure
has a Cognitive Complexity of 98 (exceeds 5 allowed). Consider refactoring. Open
private createGraphicalMeasure(sourceMeasure: SourceMeasure, openTuplets: Tuplet[], openBeams: Beam[],
accidentalCalculator: AccidentalCalculator, activeClefs: ClefInstruction[],
openOctaveShifts: OctaveShiftParams[], openLyricWords: LyricWord[], staffIndex: number,
staffEntryLinks: StaffEntryLink[]): GraphicalMeasure {
const staff: Staff = this.graphicalMusicSheet.ParentMusicSheet.getStaffFromIndex(staffIndex);
- 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 calculateFingerings
has a Cognitive Complexity of 90 (exceeds 5 allowed). Consider refactoring. Open
public calculateFingerings(): void {
if (this.rules.FingeringPosition === PlacementEnum.Left ||
this.rules.FingeringPosition === PlacementEnum.Right) {
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 calculateTupletNumbers
has a Cognitive Complexity of 72 (exceeds 5 allowed). Consider refactoring. Open
protected calculateTupletNumbers(): void {
if (!this.rules.TupletNumberLimitConsecutiveRepetitions) {
return;
}
let currentTupletNumber: number = -1;
- 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 calculateTempoExpressionsForMultiTempoExpression
has a Cognitive Complexity of 71 (exceeds 5 allowed). Consider refactoring. Open
protected calculateTempoExpressionsForMultiTempoExpression(sourceMeasure: SourceMeasure, multiTempoExpression: MultiTempoExpression,
measureIndex: number): void {
// calculate absolute Timestamp
const absoluteTimestamp: Fraction = Fraction.plus(sourceMeasure.AbsoluteTimestamp, multiTempoExpression.Timestamp);
const measures: GraphicalMeasure[] = this.graphicalMusicSheet.MeasureList[measureIndex];
- 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 calculateGraphicalContinuousDynamic
has 275 lines of code (exceeds 25 allowed). Consider refactoring. Open
public calculateGraphicalContinuousDynamic(graphicalContinuousDynamic: GraphicalContinuousDynamicExpression, startPosInStaffline: PointF2D): void {
const isSoftAccent: boolean = graphicalContinuousDynamic.IsSoftAccent;
const staffIndex: number = graphicalContinuousDynamic.ParentStaffLine.ParentStaff.idInMusicSheet;
// TODO: Previously the staffIndex was passed down. BUT you can (and this function actually does this) get it from
// the musicSystem OR from the ParentStaffLine. Is this the same index?
Function createGraphicalTies
has a Cognitive Complexity of 68 (exceeds 5 allowed). Consider refactoring. Open
protected createGraphicalTies(): void {
for (let measureIndex: number = 0; measureIndex < this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length; measureIndex++) {
const sourceMeasure: SourceMeasure = this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures[measureIndex];
for (let staffIndex: number = 0; staffIndex < sourceMeasure.CompleteNumberOfStaves; staffIndex++) {
for (let j: number = 0; j < sourceMeasure.VerticalSourceStaffEntryContainers.length; 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 calculateMusicSystems
has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring. Open
protected calculateMusicSystems(): void {
if (!this.graphicalMusicSheet.MeasureList) {
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 createGraphicalMeasure
has 184 lines of code (exceeds 25 allowed). Consider refactoring. Open
private createGraphicalMeasure(sourceMeasure: SourceMeasure, openTuplets: Tuplet[], openBeams: Beam[],
accidentalCalculator: AccidentalCalculator, activeClefs: ClefInstruction[],
openOctaveShifts: OctaveShiftParams[], openLyricWords: LyricWord[], staffIndex: number,
staffEntryLinks: StaffEntryLink[]): GraphicalMeasure {
const staff: Staff = this.graphicalMusicSheet.ParentMusicSheet.getStaffFromIndex(staffIndex);
Function handleVoiceEntry
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
protected handleVoiceEntry(voiceEntry: VoiceEntry, graphicalStaffEntry: GraphicalStaffEntry,
accidentalCalculator: AccidentalCalculator, openLyricWords: LyricWord[],
activeClef: ClefInstruction,
openTuplets: Tuplet[], openBeams: Beam[],
octaveShiftValue: OctaveEnum, staffIndex: number,
- 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 prepareGraphicalMusicSheet
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
public prepareGraphicalMusicSheet(): void {
// Clear the stored system images dict - all systems have to be redrawn.
// Not necessary now. TODO Check
// this.graphicalMusicSheet.SystemImages.length = 0;
const musicSheet: MusicSheet = this.graphicalMusicSheet.ParentMusicSheet;
- 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 calculateOrnaments
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
private calculateOrnaments(): void {
for (let idx2: number = 0, len2: number = this.musicSystems.length; idx2 < len2; ++idx2) {
const system: MusicSystem = this.musicSystems[idx2];
for (let idx3: number = 0, len3: number = system.StaffLines.length; idx3 < len3; ++idx3) {
const line: StaffLine = system.StaffLines[idx3];
- 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 calculateMusicSystems
has 131 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected calculateMusicSystems(): void {
if (!this.graphicalMusicSheet.MeasureList) {
return;
}
Function clearSystemsAndMeasures
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
protected clearSystemsAndMeasures(): void {
for (let idx: number = 0, len: number = this.graphicalMusicSheet.MusicPages.length; idx < len; ++idx) {
const graphicalMusicPage: GraphicalMusicPage = this.graphicalMusicSheet.MusicPages[idx];
for (let idx2: number = 0, len2: number = graphicalMusicPage.MusicSystems.length; idx2 < len2; ++idx2) {
const musicSystem: MusicSystem = graphicalMusicPage.MusicSystems[idx2];
- 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 prepareGraphicalMusicSheet
has 100 lines of code (exceeds 25 allowed). Consider refactoring. Open
public prepareGraphicalMusicSheet(): void {
// Clear the stored system images dict - all systems have to be redrawn.
// Not necessary now. TODO Check
// this.graphicalMusicSheet.SystemImages.length = 0;
const musicSheet: MusicSheet = this.graphicalMusicSheet.ParentMusicSheet;
Function handleStaffEntries
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
private handleStaffEntries(staffIsPercussionArray: Array<boolean>): void {
for (let idx: number = 0, len: number = this.graphicalMusicSheet.MeasureList.length; idx < len; ++idx) {
const measures: GraphicalMeasure[] = this.graphicalMusicSheet.MeasureList[idx];
for (let idx2: number = 0, len2: number = measures.length; idx2 < len2; ++idx2) {
const measure: GraphicalMeasure = measures[idx2];
- 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 calculateChordSymbols
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected calculateChordSymbols(): void {
for (const musicSystem of this.musicSystems) {
for (const staffLine of musicSystem.StaffLines) {
const skybottomcalculator: SkyBottomLineCalculator = staffLine.SkyBottomLineCalculator;
let minimumOffset: number = Number.MAX_SAFE_INTEGER; // only calculated if option set
Function calculateMoodAndUnknownExpression
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
protected calculateMoodAndUnknownExpression(multiExpression: MultiExpression, measureIndex: number, staffIndex: number): void {
// calculate absolute Timestamp
const absoluteTimestamp: Fraction = multiExpression.AbsoluteTimestamp;
const measures: GraphicalMeasure[] = this.graphicalMusicSheet.MeasureList[measureIndex];
let relative: PointF2D = new PointF2D();
- 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 calculateSingleStaffLineLyricsPosition
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
protected calculateSingleStaffLineLyricsPosition(staffLine: StaffLine, lyricVersesNumber: string[]): GraphicalStaffEntry[] {
let numberOfVerses: number = 0;
let lyricsStartYPosition: number = this.rules.StaffHeight; // Add offset to prevent collision
const relevantVerseNumbers: Map<string, boolean> = new Map<string, boolean>();
const lyricsStaffEntriesList: GraphicalStaffEntry[] = [];
- 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 calculateTempoExpressionsForMultiTempoExpression
has 91 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected calculateTempoExpressionsForMultiTempoExpression(sourceMeasure: SourceMeasure, multiTempoExpression: MultiTempoExpression,
measureIndex: number): void {
// calculate absolute Timestamp
const absoluteTimestamp: Fraction = Fraction.plus(sourceMeasure.AbsoluteTimestamp, multiTempoExpression.Timestamp);
const measures: GraphicalMeasure[] = this.graphicalMusicSheet.MeasureList[measureIndex];
Function calculateMeasureNumberPlacement
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
protected calculateMeasureNumberPlacement(musicSystem: MusicSystem): void {
const staffLine: StaffLine = musicSystem.StaffLines[0];
if (!staffLine || !staffLine.Measures[0]) {
log.warn("calculateMeasureNumberPlacement: measure undefined for system.Id " + musicSystem.Id);
return; // TODO apparently happens in script sometimes (mp #70)
- 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 calculateXLayout
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
public calculateXLayout(graphicalMusicSheet: GraphicalMusicSheet, maxInstrNameLabelLength: number): void {
// for each inner List in big Measure List calculate new Positions for the StaffEntries
// and adjust Measures sizes
// calculate max measure length for maximum zoom in.
- 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 calculatePageLabels
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected calculatePageLabels(page: GraphicalMusicPage): void {
// The PositionAndShape child elements of page need to be manually connected to the lyricist, composer, subtitle, etc.
// because the page is only available now
// fix width of SVG, sheet and horizontal scroll bar being too long (~32767 = SheetMaximumWidth) for single line scores
Function setTieDirections
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
private setTieDirections(staffEntry: GraphicalStaffEntry): void {
if (!staffEntry) {
return;
}
const ties: Tie[] = staffEntry.ties;
- 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 calculateFingerings
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
public calculateFingerings(): void {
if (this.rules.FingeringPosition === PlacementEnum.Left ||
this.rules.FingeringPosition === PlacementEnum.Right) {
return;
}
Function handleVoiceEntry
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected handleVoiceEntry(voiceEntry: VoiceEntry, graphicalStaffEntry: GraphicalStaffEntry,
accidentalCalculator: AccidentalCalculator, openLyricWords: LyricWord[],
activeClef: ClefInstruction,
openTuplets: Tuplet[], openBeams: Beam[],
octaveShiftValue: OctaveEnum, staffIndex: number,
Function calculateTupletNumbers
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected calculateTupletNumbers(): void {
if (!this.rules.TupletNumberLimitConsecutiveRepetitions) {
return;
}
let currentTupletNumber: number = -1;
Function checkMeasuresForWholeRestNotes
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
protected checkMeasuresForWholeRestNotes(): void {
for (let idx2: number = 0, len2: number = this.musicSystems.length; idx2 < len2; ++idx2) {
const musicSystem: MusicSystem = this.musicSystems[idx2];
for (let idx3: number = 0, len3: number = musicSystem.StaffLines.length; idx3 < len3; ++idx3) {
const staffLine: StaffLine = musicSystem.StaffLines[idx3];
- 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 calculateTieCurves
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
private calculateTieCurves(): void {
for (const musicSystem of this.musicSystems) {
for (const staffLine of musicSystem.StaffLines) {
for (const measure of staffLine.Measures) {
for (const staffEntry of measure.staffEntries) {
- 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 calculateStaffEntryArticulationMarks
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
private calculateStaffEntryArticulationMarks(): void {
for (let idx2: number = 0, len2: number = this.musicSystems.length; idx2 < len2; ++idx2) {
const system: MusicSystem = this.musicSystems[idx2];
for (let idx3: number = 0, len3: number = system.StaffLines.length; idx3 < len3; ++idx3) {
const line: StaffLine = system.StaffLines[idx3];
- 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 calculateSingleStaffLineLyricsPosition
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected calculateSingleStaffLineLyricsPosition(staffLine: StaffLine, lyricVersesNumber: string[]): GraphicalStaffEntry[] {
let numberOfVerses: number = 0;
let lyricsStartYPosition: number = this.rules.StaffHeight; // Add offset to prevent collision
const relevantVerseNumbers: Map<string, boolean> = new Map<string, boolean>();
const lyricsStaffEntriesList: GraphicalStaffEntry[] = [];
Function optimizeRestNotePlacement
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
protected optimizeRestNotePlacement(graphicalStaffEntry: GraphicalStaffEntry, measure: GraphicalMeasure): void {
if (graphicalStaffEntry.graphicalVoiceEntries.length === 0) {
return;
}
const voice1Notes: GraphicalNote[] = graphicalStaffEntry.graphicalVoiceEntries[0].notes;
- 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 calculateDynamicExpressions
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
private calculateDynamicExpressions(): void {
const maxIndex: number = Math.min(this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length - 1, this.rules.MaxMeasureToDrawIndex);
const minIndex: number = Math.min(this.rules.MinMeasureToDrawIndex, this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length);
for (let i: number = minIndex; i <= maxIndex; i++) {
const sourceMeasure: SourceMeasure = this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures[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
Function calculatePageLabels
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
protected calculatePageLabels(page: GraphicalMusicPage): void {
// The PositionAndShape child elements of page need to be manually connected to the lyricist, composer, subtitle, etc.
// because the page is only available now
// fix width of SVG, sheet and horizontal scroll bar being too long (~32767 = SheetMaximumWidth) for single line scores
- 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 calculateOctaveShifts
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
private calculateOctaveShifts(): void {
for (let i: number = 0; i < this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length; i++) {
const sourceMeasure: SourceMeasure = this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures[i];
for (let j: number = 0; j < sourceMeasure.StaffLinkedExpressions.length; j++) {
if (!this.graphicalMusicSheet.MeasureList[i] || !this.graphicalMusicSheet.MeasureList[i][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 getRelativePositionInStaffLineFromTimestamp
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
protected getRelativePositionInStaffLineFromTimestamp(
timestamp: Fraction, verticalIndex: number, staffLine: StaffLine,
multiStaffInstrument: boolean, firstVisibleMeasureRelativeX: number = 0.0,
useLeftStaffEntryBorder: boolean = false
): PointF2D {
- 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 calculatePedals
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
private calculatePedals(): void {
for (let i: number = 0; i < this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length; i++) {
const sourceMeasure: SourceMeasure = this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures[i];
for (let j: number = 0; j < sourceMeasure.StaffLinkedExpressions.length; j++) {
if (!this.graphicalMusicSheet.MeasureList[i] || !this.graphicalMusicSheet.MeasureList[i][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 calculateLyricExtend
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
private calculateLyricExtend(lyricEntry: GraphicalLyricEntry): void {
let startY: number = lyricEntry.GraphicalLabel.PositionAndShape.RelativePosition.y;
const startStaffEntry: GraphicalStaffEntry = lyricEntry.StaffEntryParent;
const startStaffLine: StaffLine = startStaffEntry.parentMeasure.ParentStaffLine;
- 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 calculateMoodAndUnknownExpressions
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
private calculateMoodAndUnknownExpressions(): void {
for (let i: number = 0; i < this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length; i++) {
const sourceMeasure: SourceMeasure = this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures[i];
for (let j: number = 0; j < sourceMeasure.StaffLinkedExpressions.length; j++) {
if (!this.graphicalMusicSheet.MeasureList[i] || !this.graphicalMusicSheet.MeasureList[i][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 calculateRestNotePlacementWithCollisionDetectionFromGraphicalNote
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
private calculateRestNotePlacementWithCollisionDetectionFromGraphicalNote(graphicalStaffEntry: GraphicalStaffEntry): void {
let restNote: GraphicalNote;
let graphicalNotes: GraphicalNote[];
if (graphicalStaffEntry.graphicalVoiceEntries[0].notes[0].sourceNote.isRest()) {
restNote = graphicalStaffEntry.graphicalVoiceEntries[0].notes[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 calculateLyricExtend
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
private calculateLyricExtend(lyricEntry: GraphicalLyricEntry): void {
let startY: number = lyricEntry.GraphicalLabel.PositionAndShape.RelativePosition.y;
const startStaffEntry: GraphicalStaffEntry = lyricEntry.StaffEntryParent;
const startStaffLine: StaffLine = startStaffEntry.parentMeasure.ParentStaffLine;
Function calculateGraphicalInstantaneousDynamicExpression
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
protected calculateGraphicalInstantaneousDynamicExpression(graphicalInstantaneousDynamic: GraphicalInstantaneousDynamicExpression,
startPosInStaffline: PointF2D, timestamp: Fraction): void {
// get Margin Dimensions
const staffLine: StaffLine = graphicalInstantaneousDynamic.ParentStaffLine;
if (!staffLine) {
- 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 calculateSingleLyricWord
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
private calculateSingleLyricWord(lyricEntry: GraphicalLyricEntry): void {
// const skyBottomLineCalculator: SkyBottomLineCalculator = new SkyBottomLineCalculator (this.rules);
const graphicalLyricWord: GraphicalLyricWord = lyricEntry.ParentLyricWord;
const index: number = graphicalLyricWord.GraphicalLyricsEntries.indexOf(lyricEntry);
let nextLyricEntry: GraphicalLyricEntry = undefined;
Function calculateSheetLabelBoundingBoxes
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected calculateSheetLabelBoundingBoxes(): void {
const musicSheet: MusicSheet = this.graphicalMusicSheet.ParentMusicSheet;
const defaultColorTitle: string = this.rules.DefaultColorTitle; // can be undefined => black
if (musicSheet.Title !== undefined && this.rules.RenderTitle) {
const title: GraphicalLabel = new GraphicalLabel(musicSheet.Title, this.rules.SheetTitleHeight, TextAlignmentEnum.CenterBottom, this.rules);
Function calculateMoodAndUnknownExpression
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected calculateMoodAndUnknownExpression(multiExpression: MultiExpression, measureIndex: number, staffIndex: number): void {
// calculate absolute Timestamp
const absoluteTimestamp: Fraction = multiExpression.AbsoluteTimestamp;
const measures: GraphicalMeasure[] = this.graphicalMusicSheet.MeasureList[measureIndex];
let relative: PointF2D = new PointF2D();
Function createAccidentalCalculators
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private createAccidentalCalculators(): AccidentalCalculator[] {
const accidentalCalculators: AccidentalCalculator[] = [];
const firstSourceMeasure: SourceMeasure = this.graphicalMusicSheet.ParentMusicSheet.getFirstSourceMeasure();
if (firstSourceMeasure) {
for (let i: number = 0; i < firstSourceMeasure.CompleteNumberOfStaves; 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
Function getRelativePositionInStaffLineFromTimestamp
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected getRelativePositionInStaffLineFromTimestamp(
timestamp: Fraction, verticalIndex: number, staffLine: StaffLine,
multiStaffInstrument: boolean, firstVisibleMeasureRelativeX: number = 0.0,
useLeftStaffEntryBorder: boolean = false
): PointF2D {
Function calculateGraphicalInstantaneousDynamicExpression
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected calculateGraphicalInstantaneousDynamicExpression(graphicalInstantaneousDynamic: GraphicalInstantaneousDynamicExpression,
startPosInStaffline: PointF2D, timestamp: Fraction): void {
// get Margin Dimensions
const staffLine: StaffLine = graphicalInstantaneousDynamic.ParentStaffLine;
if (!staffLine) {
Function optimizeRestNotePlacement
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected optimizeRestNotePlacement(graphicalStaffEntry: GraphicalStaffEntry, measure: GraphicalMeasure): void {
if (graphicalStaffEntry.graphicalVoiceEntries.length === 0) {
return;
}
const voice1Notes: GraphicalNote[] = graphicalStaffEntry.graphicalVoiceEntries[0].notes;
Function calculateVerticalContainersList
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private calculateVerticalContainersList(): void {
const numberOfEntries: number = this.graphicalMusicSheet.MeasureList[0].length;
for (let i: number = 0; i < this.graphicalMusicSheet.MeasureList.length; i++) {
for (let j: number = 0; j < numberOfEntries; j++) {
const measure: GraphicalMeasure = this.graphicalMusicSheet.MeasureList[i][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 handleTie
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private handleTie(tie: Tie, startGraphicalStaffEntry: GraphicalStaffEntry, staffIndex: number, measureIndex: number): void {
if (!startGraphicalStaffEntry) {
// console.log('tie not found in measure number ' + measureIndex - 1);
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 clearSystemsAndMeasures
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected clearSystemsAndMeasures(): void {
for (let idx: number = 0, len: number = this.graphicalMusicSheet.MusicPages.length; idx < len; ++idx) {
const graphicalMusicPage: GraphicalMusicPage = this.graphicalMusicSheet.MusicPages[idx];
for (let idx2: number = 0, len2: number = graphicalMusicPage.MusicSystems.length; idx2 < len2; ++idx2) {
const musicSystem: MusicSystem = graphicalMusicPage.MusicSystems[idx2];
Function calculateMeasureNumberPlacement
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected calculateMeasureNumberPlacement(musicSystem: MusicSystem): void {
const staffLine: StaffLine = musicSystem.StaffLines[0];
if (!staffLine || !staffLine.Measures[0]) {
log.warn("calculateMeasureNumberPlacement: measure undefined for system.Id " + musicSystem.Id);
return; // TODO apparently happens in script sometimes (mp #70)
Function calculateRestNotePlacementWithCollisionDetectionFromGraphicalNote
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
private calculateRestNotePlacementWithCollisionDetectionFromGraphicalNote(graphicalStaffEntry: GraphicalStaffEntry): void {
let restNote: GraphicalNote;
let graphicalNotes: GraphicalNote[];
if (graphicalStaffEntry.graphicalVoiceEntries[0].notes[0].sourceNote.isRest()) {
restNote = graphicalStaffEntry.graphicalVoiceEntries[0].notes[0];
Function createGraphicalTies
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected createGraphicalTies(): void {
for (let measureIndex: number = 0; measureIndex < this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length; measureIndex++) {
const sourceMeasure: SourceMeasure = this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures[measureIndex];
for (let staffIndex: number = 0; staffIndex < sourceMeasure.CompleteNumberOfStaves; staffIndex++) {
for (let j: number = 0; j < sourceMeasure.VerticalSourceStaffEntryContainers.length; j++) {
Function calculateXLayout
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public calculateXLayout(graphicalMusicSheet: GraphicalMusicSheet, maxInstrNameLabelLength: number): void {
// for each inner List in big Measure List calculate new Positions for the StaffEntries
// and adjust Measures sizes
// calculate max measure length for maximum zoom in.
Function calculateSingleMeasureNumberPlacement
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
private calculateSingleMeasureNumberPlacement(measure: GraphicalMeasure, staffLine: StaffLine, musicSystem: MusicSystem,
labelOffsetX: number = 0): void {
const labelNumber: string = measure.parentSourceMeasure.getPrintedMeasureNumber().toString();
const label: Label = new Label(labelNumber);
// maybe give rules as argument instead of just setting fontStyle and maybe other settings manually afterwards
Function calculateLabel
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected calculateLabel(staffLine: StaffLine,
relative: PointF2D,
combinedString: string,
style: FontStyles,
placement: PlacementEnum,
Function calculateSingleLyricWord
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private calculateSingleLyricWord(lyricEntry: GraphicalLyricEntry): void {
// const skyBottomLineCalculator: SkyBottomLineCalculator = new SkyBottomLineCalculator (this.rules);
const graphicalLyricWord: GraphicalLyricWord = lyricEntry.ParentLyricWord;
const index: number = graphicalLyricWord.GraphicalLyricsEntries.indexOf(lyricEntry);
let nextLyricEntry: GraphicalLyricEntry = 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 calculateStemDirectionFromVoices
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private calculateStemDirectionFromVoices(voiceEntry: VoiceEntry): void {
// Stem direction calculation:
const hasLink: boolean = voiceEntry.ParentSourceStaffEntry.Link !== undefined;
if (hasLink) {
// in case of StaffEntryLink don't check mainVoice / linkedVoice
- 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 setBeamNotesWantedStemDirections
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private setBeamNotesWantedStemDirections(voiceEntry: VoiceEntry): void {
if (!(voiceEntry.Notes.length > 0)) {
return;
}
// don't just set direction if undefined. if there's a note in the beam with a different stem direction, Vexflow draws it with an unending stem.
- 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 setTieDirections
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
private setTieDirections(staffEntry: GraphicalStaffEntry): void {
if (!staffEntry) {
return;
}
const ties: Tie[] = staffEntry.ties;
Function calculateSheetLabelBoundingBoxes
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected calculateSheetLabelBoundingBoxes(): void {
const musicSheet: MusicSheet = this.graphicalMusicSheet.ParentMusicSheet;
const defaultColorTitle: string = this.rules.DefaultColorTitle; // can be undefined => black
if (musicSheet.Title !== undefined && this.rules.RenderTitle) {
const title: GraphicalLabel = new GraphicalLabel(musicSheet.Title, this.rules.SheetTitleHeight, TextAlignmentEnum.CenterBottom, this.rules);
- 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 calculateLyricsExtendsAndDashes
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected calculateLyricsExtendsAndDashes(lyricsStaffEntries: GraphicalStaffEntry[]): void {
// iterate again to create now the extend lines and dashes for words
for (let idx: number = 0, len: number = lyricsStaffEntries.length; idx < len; ++idx) {
const staffEntry: GraphicalStaffEntry = lyricsStaffEntries[idx];
// set LyricEntryLabel RelativePosition
- 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 optimizeRestPlacement
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private optimizeRestPlacement(): void {
for (let idx2: number = 0, len2: number = this.musicSystems.length; idx2 < len2; ++idx2) {
const system: MusicSystem = this.musicSystems[idx2];
for (let idx3: number = 0, len3: number = system.StaffLines.length; idx3 < len3; ++idx3) {
const line: StaffLine = system.StaffLines[idx3];
- 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 handleTie
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private handleTie(tie: Tie, startGraphicalStaffEntry: GraphicalStaffEntry, staffIndex: number, measureIndex: number): void {
if (!startGraphicalStaffEntry) {
// console.log('tie not found in measure number ' + measureIndex - 1);
return;
}
Function handleStaffEntries
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
private handleStaffEntries(staffIsPercussionArray: Array<boolean>): void {
for (let idx: number = 0, len: number = this.graphicalMusicSheet.MeasureList.length; idx < len; ++idx) {
const measures: GraphicalMeasure[] = this.graphicalMusicSheet.MeasureList[idx];
for (let idx2: number = 0, len2: number = measures.length; idx2 < len2; ++idx2) {
const measure: GraphicalMeasure = measures[idx2];
Function calculateLyricsPosition
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private calculateLyricsPosition(): void {
const lyricStaffEntriesDict: Dictionary<StaffLine, GraphicalStaffEntry[]> = new Dictionary<StaffLine, GraphicalStaffEntry[]>();
// sort the lyriceVerseNumbers for every Instrument that has Lyrics
for (let idx: number = 0, len: number = this.graphicalMusicSheet.ParentMusicSheet.Instruments.length; idx < len; ++idx) {
const instrument: Instrument = this.graphicalMusicSheet.ParentMusicSheet.Instruments[idx];
- 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 calculateSingleMeasureNumberPlacement
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private calculateSingleMeasureNumberPlacement(measure: GraphicalMeasure, staffLine: StaffLine, musicSystem: MusicSystem,
labelOffsetX: number = 0): void {
const labelNumber: string = measure.parentSourceMeasure.getPrintedMeasureNumber().toString();
const label: Label = new Label(labelNumber);
// maybe give rules as argument instead of just setting fontStyle and maybe other settings manually afterwards
- 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 (firstNote.NoteTuplet !== currentTuplet) {
if (disabledPerVoice[voice.VoiceId][firstNote.NoteTuplet.TupletLabelNumber]) {
if (disabledPerVoice[voice.VoiceId][firstNote.NoteTuplet.TupletLabelNumber][typeLength.RealValue]) {
firstNote.NoteTuplet.RenderTupletNumber = false;
skipTuplet = firstNote.NoteTuplet;
Avoid deeply nested control flow statements. Open
if (octaveShift.OctaveShiftStart) {
targetOctaveShift = octaveShift.OctaveShiftStart;
} else if (octaveShift.OctaveShiftEnd) {
targetOctaveShift = octaveShift.OctaveShiftEnd;
}
Avoid deeply nested control flow statements. Open
for (let idx6: number = 0, len6: number = graphicalStaffEntry.sourceStaffEntry.VoiceEntries.length; idx6 < len6; ++idx6) {
const voiceEntry: VoiceEntry = graphicalStaffEntry.sourceStaffEntry.VoiceEntries[idx6];
if (voiceEntry.OrnamentContainer) {
if (voiceEntry.hasTie() && !graphicalStaffEntry.relInMeasureTimestamp.Equals(voiceEntry.Timestamp)) {
continue;
Avoid deeply nested control flow statements. Open
for (const voiceEntry of gse.graphicalVoiceEntries) {
if (voiceEntry.parentVoiceEntry.IsGrace) {
continue;
}
// Sibelius: can have multiple fingerings per note, so we need to check voice entry instructions, not note.Fingering
Avoid deeply nested control flow statements. Open
if (!staffEntry.graphicalChordContainers || staffEntry.graphicalChordContainers.length === 0) {
continue;
}
Avoid deeply nested control flow statements. Open
if (!typeLength) {
// shouldn't happen, now that rest notes have TypeLength set too, see VoiceGenerator.addRestNote(), addSingleNote()
// see test_tuplets_starting_with_rests_layout.mxl (first measure bass)
log.warn("note missing TypeLength");
typeLength = firstNote.NoteTuplet.Fractions[0];
Avoid deeply nested control flow statements. Open
if (consecutiveTupletCount <= this.rules.TupletNumberMaxConsecutiveRepetitions) {
firstNote.NoteTuplet.RenderTupletNumber = true; // need to re-activate after re-render when it was set to false
}
Avoid deeply nested control flow statements. Open
if (placement === PlacementEnum.Below) {
fingerings.reverse();
}
Avoid deeply nested control flow statements. Open
if (startVerticalContainer) {
// withinCrossedBeam = this.areStaffEntriesWithinCrossedBeam(startVerticalContainer,
// endVerticalContainer, currentStaffLineIndex, formerStaffLineIndex);
}
Avoid deeply nested control flow statements. Open
if ((entry.Expression as InstantaneousTempoExpression).Enum === TempoEnum.metronomeMark) {
this.createMetronomeMark((entry.Expression as InstantaneousTempoExpression));
continue;
}
Avoid deeply nested control flow statements. Open
for (const graphicalTie of staffEntry.GraphicalTies) {
if (graphicalTie.StartNote !== undefined && graphicalTie.StartNote.parentVoiceEntry.parentStaffEntry === staffEntry) {
const tieIsAtSystemBreak: boolean = (
graphicalTie.StartNote.parentVoiceEntry.parentStaffEntry.parentMeasure.ParentStaffLine !==
graphicalTie.EndNote.parentVoiceEntry.parentStaffEntry.parentMeasure.ParentStaffLine
Avoid deeply nested control flow statements. Open
if ((sourceMeasure.StaffLinkedExpressions[j][k].PedalStart)) {
this.calculateSinglePedal(sourceMeasure, sourceMeasure.StaffLinkedExpressions[j][k], i, j);
}
Avoid deeply nested control flow statements. Open
if ((sourceMeasure.StaffLinkedExpressions[j][k].MoodList.length > 0) ||
(sourceMeasure.StaffLinkedExpressions[j][k].UnknownList.length > 0)) {
this.calculateMoodAndUnknownExpression(sourceMeasure.StaffLinkedExpressions[j][k], i, j);
}
Avoid deeply nested control flow statements. Open
if (abstractNotationInstruction instanceof KeyInstruction) {
const keyInstruction: KeyInstruction = <KeyInstruction>abstractNotationInstruction;
accidentalCalculator.ActiveKeyInstruction = keyInstruction;
}
Avoid deeply nested control flow statements. Open
for (const staffEntry of graphicalMeasure.staffEntries) {
for (const gve of staffEntry.graphicalVoiceEntries) {
gve.color();
}
}
Avoid deeply nested control flow statements. Open
if (consecutiveTupletCount > this.rules.TupletNumberMaxConsecutiveRepetitions) {
firstNote.NoteTuplet.RenderTupletNumber = false;
if (this.rules.TupletNumberAlwaysDisableAfterFirstMax) {
if (!disabledPerVoice[voice.VoiceId][currentTupletNumber]) {
disabledPerVoice[voice.VoiceId][currentTupletNumber] = {};
Avoid deeply nested control flow statements. Open
if (minSkyLineValueForExpressionLength < endIdealY) {
betweenIdealY = minSkyLineValueForExpressionLength;
}
Avoid deeply nested control flow statements. Open
if (gse.graphicalVoiceEntries.length > 0 && gse.graphicalVoiceEntries[0].notes.length === 1) {
const graphicalNote: GraphicalNote = gse.graphicalVoiceEntries[0].notes[0];
if (!graphicalNote.sourceNote.Pitch && (new Fraction(1, 2)).lt(graphicalNote.sourceNote.Length)) {
this.layoutMeasureWithWholeRest(graphicalNote, gse, measure);
}
Avoid deeply nested control flow statements. Open
if (sourceMeasure.StaffLinkedExpressions[j][k].InstantaneousDynamic !== undefined ||
(sourceMeasure.StaffLinkedExpressions[j][k].StartingContinuousDynamic !== undefined &&
sourceMeasure.StaffLinkedExpressions[j][k].StartingContinuousDynamic.StartMultiExpression ===
sourceMeasure.StaffLinkedExpressions[j][k] && sourceMeasure.StaffLinkedExpressions[j][k].UnknownList.length === 0)
) {
Avoid deeply nested control flow statements. Open
if (!firstNote.NoteTuplet ||
firstNote.NoteTuplet.shouldBeBracketed(
this.rules.TupletsBracketedUseXMLValue,
this.rules.TupletsBracketed,
this.rules.TripletsBracketed
Avoid deeply nested control flow statements. Open
for (let i: number = 0; i < fingerings.length; i++) {
const fingering: TechnicalInstruction = fingerings[i];
const alignment: TextAlignmentEnum =
placement === PlacementEnum.Above ? TextAlignmentEnum.CenterBottom : TextAlignmentEnum.CenterTop;
const label: Label = new Label(fingering.value, alignment);
Avoid deeply nested control flow statements. Open
if (targetOctaveShift?.ParentStartMultiExpression?.AbsoluteTimestamp.lte(sourceStaffEntry.AbsoluteTimestamp) &&
!targetOctaveShift.ParentEndMultiExpression?.AbsoluteTimestamp.lt(sourceStaffEntry.AbsoluteTimestamp)) {
octaveShiftValue = targetOctaveShift.Type;
break;
}
Avoid deeply nested control flow statements. Open
if ((sourceMeasure.StaffLinkedExpressions[j][k].OctaveShiftStart)) {
this.calculateSingleOctaveShift(sourceMeasure, sourceMeasure.StaffLinkedExpressions[j][k], i, j);
}
Avoid deeply nested control flow statements. Open
for (let idx2: number = 0; idx2 < measureList[idx].length; idx2++) {
measureList[idx][idx2] = undefined;
}
Avoid deeply nested control flow statements. Open
if (firstNote.NoteTuplet.TupletLabelNumber !== currentTupletNumber ||
!typeLength.Equals(currentTypeLength) ||
firstNote.NoteTuplet.Bracket) {
currentTupletNumber = firstNote.NoteTuplet.TupletLabelNumber;
currentTypeLength = typeLength;
Avoid deeply nested control flow statements. Open
if (nextNote.sourceNote.NoteBeam !== undefined && previousNote.sourceNote.NoteBeam === nextNote.sourceNote.NoteBeam) {
this.calculateRestNotePlacementWithinGraphicalBeam(
graphicalStaffEntry, voice1Note1, previousNote,
nextStaffEntry, nextNote
);
Avoid deeply nested control flow statements. Open
for (let idx6: number = 0, len6: number = graphicalStaffEntry.sourceStaffEntry.VoiceEntries.length; idx6 < len6; ++idx6) {
const voiceEntry: VoiceEntry = graphicalStaffEntry.sourceStaffEntry.VoiceEntries[idx6];
if (voiceEntry.Articulations.length > 0) {
this.layoutArticulationMarks(voiceEntry.Articulations, voiceEntry, graphicalStaffEntry);
}
Avoid deeply nested control flow statements. Open
for (let i: number = 0; i < staffEntry.graphicalChordContainers.length; i++) {
const graphicalChordContainer: GraphicalChordSymbolContainer = staffEntry.graphicalChordContainers[i];
// check for chord not over a note
if (staffEntry.graphicalVoiceEntries.length === 0 && staffEntry.relInMeasureTimestamp.RealValue > 0) {
// re-position (second chord symbol on whole measure rest)
Avoid deeply nested control flow statements. Open
if (firstNote.NoteTuplet === skipTuplet) {
continue;
}
Avoid deeply nested control flow statements. Open
if (this.rules.PercussionOneLineCutoff === -1 ||
MusicSheetCalculator.stafflineNoteCalculator.getStafflineUniquePositionCount(idx2) < this.rules.PercussionOneLineCutoff) {
measure.ParentStaff.StafflineCount = 1;
}
Avoid deeply nested control flow statements. Open
if (withinCrossedBeam) {
const formerStaffLine: StaffLine = musicSystem.StaffLines[formerStaffLineIndex];
const formerStaffLineMaxBottomLineValue: number = formerStaffLine.SkyBottomLineCalculator.
getBottomLineMaxInRange(upperStartX, upperEndX);
const distanceBetweenStaffLines: number = staffLine.PositionAndShape.RelativePosition.y -
Avoid deeply nested control flow statements. Open
for (const expr of staffLine.AbstractExpressions) {
if (expr instanceof GraphicalInstantaneousTempoExpression &&
(expr.SourceExpression as AbstractTempoExpression).Label === entry.Expression.Label) {
continue; // already added
}
Avoid deeply nested control flow statements. Open
if (graphicalMeasure.FirstInstructionStaffEntry) {
const index: number = graphicalMeasure.PositionAndShape.ChildElements.indexOf(
graphicalMeasure.FirstInstructionStaffEntry.PositionAndShape
);
if (index > -1) {
Avoid deeply nested control flow statements. Open
if (graphicalMeasure.LastInstructionStaffEntry) {
const index: number = graphicalMeasure.PositionAndShape.ChildElements.indexOf(
graphicalMeasure.LastInstructionStaffEntry.PositionAndShape
);
if (index > -1) {
Avoid deeply nested control flow statements. Open
if (startStaffEntry) {
startStaffEntry.GraphicalTies.clear(); // don't duplicate ties when calling render() again
startStaffEntry.ties.clear();
}
Avoid deeply nested control flow statements. Open
for (let idx: number = 0, len: number = sourceStaffEntry.VoiceEntries.length; idx < len; ++idx) {
const voiceEntry: VoiceEntry = sourceStaffEntry.VoiceEntries[idx];
for (let idx2: number = 0, len2: number = voiceEntry.Notes.length; idx2 < len2; ++idx2) {
const note: Note = voiceEntry.Notes[idx2];
if (note.NoteTie) {
Avoid deeply nested control flow statements. Open
if (relativeSkyLineHeight - this.rules.WedgeOpeningLength > this.rules.StaffHeight) {
idealY = relativeSkyLineHeight - this.rules.WedgeVerticalMargin;
} else {
idealY = this.rules.StaffHeight + this.rules.WedgeOpeningLength;
}
Avoid deeply nested control flow statements. Open
if (expr instanceof GraphicalInstantaneousTempoExpression &&
(expr.SourceExpression as AbstractTempoExpression).Label === entry.Expression.Label) {
//already added
continue;
}
Function maxInstrNameLabelLength
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected maxInstrNameLabelLength(): number {
let maxLabelLength: number = 0.0;
for (const instrument of this.graphicalMusicSheet.ParentMusicSheet.Instruments) {
if (instrument.NameLabel?.print && instrument.Voices.length > 0 && instrument.Voices[0].Visible) {
let renderedLabel: Label = instrument.NameLabel;
- 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 calculateAlignedChordSymbolsOffset
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected calculateAlignedChordSymbolsOffset(staffEntries: GraphicalStaffEntry[], sbc: SkyBottomLineCalculator): number {
let minimumOffset: number = Number.MAX_SAFE_INTEGER;
for (const staffEntry of staffEntries) {
for (const graphicalChordContainer of staffEntry.graphicalChordContainers) {
const gps: BoundingBox = graphicalChordContainer.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 calculateLabel
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected calculateLabel(staffLine: StaffLine,
relative: PointF2D,
combinedString: string,
style: FontStyles,
placement: PlacementEnum,
- 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 layoutVoiceEntries
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected layoutVoiceEntries(graphicalStaffEntry: GraphicalStaffEntry, staffIndex: number): void {
graphicalStaffEntry.PositionAndShape.RelativePosition = new PointF2D(0.0, 0.0);
if (!this.leadSheet) {
for (const gve of graphicalStaffEntry.graphicalVoiceEntries) {
const graphicalNotes: GraphicalNote[] = gve.notes;
- 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 calculateDashes
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private calculateDashes(staffLine: StaffLine, startX: number, endX: number, y: number): void {
let distance: number = endX - startX;
if (distance < this.rules.MinimumDistanceBetweenDashes * 3) {
this.calculateSingleDashForLyricWord(staffLine, startX, endX, y);
} else {
- 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
private calculateOctaveShifts(): void {
for (let i: number = 0; i < this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length; i++) {
const sourceMeasure: SourceMeasure = this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures[i];
for (let j: number = 0; j < sourceMeasure.StaffLinkedExpressions.length; j++) {
if (!this.graphicalMusicSheet.MeasureList[i] || !this.graphicalMusicSheet.MeasureList[i][j]) {
- 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 286.
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
private calculatePedals(): void {
for (let i: number = 0; i < this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length; i++) {
const sourceMeasure: SourceMeasure = this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures[i];
for (let j: number = 0; j < sourceMeasure.StaffLinkedExpressions.length; j++) {
if (!this.graphicalMusicSheet.MeasureList[i] || !this.graphicalMusicSheet.MeasureList[i][j]) {
- 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 286.
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 4 locations. Consider refactoring. Open
if (musicSheet.Copyright !== undefined && this.rules.RenderCopyright) {
const copyright: GraphicalLabel = new GraphicalLabel(
musicSheet.Copyright, this.rules.SheetCopyrightHeight, TextAlignmentEnum.CenterBottom, this.rules);
copyright.Label.IsCreditLabel = true;
copyright.Label.colorDefault = defaultColorTitle;
- 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 155.
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 4 locations. Consider refactoring. Open
if (musicSheet.Subtitle !== undefined && this.rules.RenderSubtitle) {
const subtitle: GraphicalLabel = new GraphicalLabel(
musicSheet.Subtitle, this.rules.SheetSubtitleHeight, TextAlignmentEnum.CenterCenter, this.rules);
subtitle.Label.IsCreditLabel = true;
subtitle.Label.colorDefault = defaultColorTitle;
- 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 155.
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 4 locations. Consider refactoring. Open
if (musicSheet.Composer !== undefined && this.rules.RenderComposer) {
const composer: GraphicalLabel = new GraphicalLabel(
musicSheet.Composer, this.rules.SheetComposerHeight, TextAlignmentEnum.RightCenter, this.rules);
composer.Label.IsCreditLabel = true;
composer.Label.colorDefault = defaultColorTitle;
- 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 155.
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 4 locations. Consider refactoring. Open
if (musicSheet.Lyricist !== undefined && this.rules.RenderLyricist) {
const lyricist: GraphicalLabel = new GraphicalLabel(
musicSheet.Lyricist, this.rules.SheetAuthorHeight, TextAlignmentEnum.LeftCenter, this.rules);
lyricist.Label.IsCreditLabel = true;
lyricist.Label.colorDefault = defaultColorTitle;
- 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 155.
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 (graphicalMeasure.LastInstructionStaffEntry) {
const index: number = graphicalMeasure.PositionAndShape.ChildElements.indexOf(
graphicalMeasure.LastInstructionStaffEntry.PositionAndShape
);
if (index > -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 101.
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
for (let idx2: number = 0, len2: number = this.musicSystems.length; idx2 < len2; ++idx2) {
const musicSystem: MusicSystem = this.musicSystems[idx2];
for (let idx3: number = 0, len3: number = musicSystem.StaffLines.length; idx3 < len3; ++idx3) {
const staffLine: StaffLine = musicSystem.StaffLines[idx3];
this.updateStaffLineBorders(staffLine);
- 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 101.
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
private calculateRepetitionEndings(): void {
const musicsheet: MusicSheet = this.graphicalMusicSheet.ParentMusicSheet;
for (let idx: number = 0, len: number = musicsheet.Repetitions.length; idx < len; ++idx) {
const repetition: Repetition = musicsheet.Repetitions[idx];
this.calcGraphicalRepetitionEndingsRecursively(repetition);
- 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 101.
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 (graphicalMeasure.FirstInstructionStaffEntry) {
const index: number = graphicalMeasure.PositionAndShape.ChildElements.indexOf(
graphicalMeasure.FirstInstructionStaffEntry.PositionAndShape
);
if (index > -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 101.
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 (this.rules.RenderMeasureNumbers) {
for (let idx: number = 0, len: number = this.musicSystems.length; idx < len; ++idx) {
const musicSystem: MusicSystem = this.musicSystems[idx];
this.calculateMeasureNumberPlacement(musicSystem);
}
- 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 80.
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 (this.rules.RenderMeasureNumbers) {
for (let idx: number = 0, len: number = this.musicSystems.length; idx < len; ++idx) {
const musicSystem: MusicSystem = this.musicSystems[idx];
this.calculateMeasureNumberSkyline(musicSystem);
}
- 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 80.
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
for (let idx: number = 0, len: number = sourceMeasure.FirstRepetitionInstructions.length; idx < len; ++idx) {
const instruction: RepetitionInstruction = sourceMeasure.FirstRepetitionInstructions[idx];
this.calculateWordRepetitionInstruction(instruction, i);
}
- 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 77.
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
for (let idx: number = 0, len: number = sourceMeasure.LastRepetitionInstructions.length; idx < len; ++idx) {
const instruction: RepetitionInstruction = sourceMeasure.LastRepetitionInstructions[idx];
this.calculateWordRepetitionInstruction(instruction, i);
}
- 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 77.
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
for (let idx5: number = 0, len5: number = measure.staffEntries.length; idx5 < len5; ++idx5) {
const graphicalStaffEntry: GraphicalStaffEntry = measure.staffEntries[idx5];
this.optimizeRestNotePlacement(graphicalStaffEntry, 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 77.
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
const endX: number = endStaffentry.parentMeasure.PositionAndShape.RelativePosition.x +
endStaffentry.PositionAndShape.RelativePosition.x +
lyricEntry.GraphicalLabel.PositionAndShape.RelativePosition.x +
nextLyricEntry.GraphicalLabel.PositionAndShape.BorderMarginLeft;
- 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
const startX: number = startStaffEntry.parentMeasure.PositionAndShape.RelativePosition.x +
startStaffEntry.PositionAndShape.RelativePosition.x +
lyricEntry.GraphicalLabel.PositionAndShape.RelativePosition.x +
lyricEntry.GraphicalLabel.PositionAndShape.BorderMarginRight -
- 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
const startX: number = startStaffEntry.parentMeasure.PositionAndShape.RelativePosition.x +
startStaffEntry.PositionAndShape.RelativePosition.x +
lyricEntry.GraphicalLabel.PositionAndShape.BorderMarginRight;
- 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 59.
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
const secondEndX: number = endStaffentry.parentMeasure.PositionAndShape.RelativePosition.x +
endStaffentry.PositionAndShape.RelativePosition.x +
nextLyricEntry.GraphicalLabel.PositionAndShape.BorderMarginLeft;
- 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 59.
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 {
throw new Error(this.abstractNotImplementedErrorMessage);
}
- 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
Identical blocks of code found in 2 locations. Consider refactoring. Open
for (let i: number = horizontalIndex + 1; i < this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers.length; i++) {
if (this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[i].StaffEntries[verticalIndex]) {
return this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[i].StaffEntries[verticalIndex];
}
}
- 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 54.
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
for (let i: number = horizontalIndex - 1; i >= 0; i--) {
if (this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[i].StaffEntries[verticalIndex]) {
return this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[i].StaffEntries[verticalIndex];
}
}
- 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 54.
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
const endX: number = endStaffEntry.parentMeasure.PositionAndShape.RelativePosition.x +
endStaffEntry.PositionAndShape.RelativePosition.x +
endStaffEntry.PositionAndShape.BorderMarginRight;
- 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 54.
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
const secondEndX: number = endStaffEntry.parentMeasure.PositionAndShape.RelativePosition.x +
endStaffEntry.PositionAndShape.RelativePosition.x +
endStaffEntry.PositionAndShape.BorderMarginRight;
- 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 54.
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
const distanceBetweenStaffLines: number = staffLine.PositionAndShape.RelativePosition.y -
previousStaffLine.PositionAndShape.RelativePosition.y -
this.rules.StaffHeight;
- 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 53.
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
for (let idx: number = 0, len: number = sourceStaffEntry.Instructions.length; idx < len; ++idx) {
const abstractNotationInstruction: AbstractNotationInstruction = sourceStaffEntry.Instructions[idx];
if (abstractNotationInstruction instanceof ClefInstruction) {
activeClefs[staffIndex] = <ClefInstruction>abstractNotationInstruction;
}
- 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 53.
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
const distanceBetweenStaffLines: number = nextStaffLine.PositionAndShape.RelativePosition.y -
staffLine.PositionAndShape.RelativePosition.y -
this.rules.StaffHeight;
- 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 53.
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
for (let idx: number = 0, len: number = lastStaffEntry.Instructions.length; idx < len; ++idx) {
const abstractNotationInstruction: AbstractNotationInstruction = lastStaffEntry.Instructions[idx];
if (abstractNotationInstruction instanceof ClefInstruction) {
activeClefs[staffIndex] = <ClefInstruction>abstractNotationInstruction;
}
- 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 53.
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
const difference: number = staffLine.PositionAndShape.RelativePosition.y -
formerStaffLine.PositionAndShape.RelativePosition.y - this.rules.StaffHeight;
- 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 53.
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
const maxIndex: number = Math.min(this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length - 1, this.rules.MaxMeasureToDrawIndex);
- 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 48.
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
const maxIndex: number = Math.min(this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length - 1, this.rules.MaxMeasureToDrawIndex);
- 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 48.
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 (nextStaffLine && // check for undefined objects e.g. when drawingRange given
nextStaffLine.Measures[0] &&
endStaffentry.parentMeasure.ParentStaffLine &&
!(endStaffentry === endStaffentry.parentMeasure.staffEntries[0] &&
endStaffentry.parentMeasure === endStaffentry.parentMeasure.ParentStaffLine.Measures[0])) {
- 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 48.
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 (endStaffEntry.parentMeasure.ParentStaffLine && endStaffEntry.parentMeasure.staffEntries &&
!(endStaffEntry === endStaffEntry.parentMeasure.staffEntries[0] &&
endStaffEntry.parentMeasure === endStaffEntry.parentMeasure.ParentStaffLine.Measures[0])) {
- 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 48.
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
protected handleTuplet(graphicalNote: GraphicalNote, tuplet: Tuplet, openTuplets: Tuplet[]): void {
throw new Error(this.abstractNotImplementedErrorMessage);
}
- 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
protected handleVoiceEntryLyrics(voiceEntry: VoiceEntry, graphicalStaffEntry: GraphicalStaffEntry,
openLyricWords: LyricWord[]): void {
throw new Error(this.abstractNotImplementedErrorMessage);
}
- 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
const formerStaffLine: StaffLine = staffLine.ParentMusicSystem.StaffLines[staffLine.ParentMusicSystem.StaffLines.indexOf(staffLine) - 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 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
graphicalTie.StartNote.parentVoiceEntry.parentStaffEntry.parentMeasure.ParentStaffLine !==
graphicalTie.EndNote.parentVoiceEntry.parentStaffEntry.parentMeasure.ParentStaffLine
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
const nextStaffLine: StaffLine = staffLine.ParentMusicSystem.StaffLines[staffLine.ParentMusicSystem.StaffLines.indexOf(staffLine) + 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 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