Function readNextXmlMeasure
has a Cognitive Complexity of 268 (exceeds 5 allowed). Consider refactoring. Open
public readNextXmlMeasure(currentMeasure: SourceMeasure, measureStartAbsoluteTimestamp: Fraction, octavePlusOne: boolean): boolean {
if (this.currentXmlMeasureIndex >= this.xmlMeasureList.length) {
return false;
}
this.currentMeasure = currentMeasure;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
File InstrumentReader.ts
has 1248 lines of code (exceeds 250 allowed). Consider refactoring. Open
import {Instrument} from "../Instrument";
import {MusicSheet} from "../MusicSheet";
import {VoiceGenerator} from "./VoiceGenerator";
import {Staff} from "../VoiceData/Staff";
import {SourceMeasure} from "../VoiceData/SourceMeasure";
Function saveAbstractInstructionList
has a Cognitive Complexity of 151 (exceeds 5 allowed). Consider refactoring. Open
private saveAbstractInstructionList(numberOfStaves: number, beginOfMeasure: boolean): void {
for (let i: number = this.abstractInstructions.length - 1; i >= 0; i--) {
const instruction: [number, AbstractNotationInstruction, Fraction] = this.abstractInstructions[i];
const key: number = instruction[0]; // staffNumber
const value: AbstractNotationInstruction = instruction[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 addAbstractInstruction
has a Cognitive Complexity of 119 (exceeds 5 allowed). Consider refactoring. Open
private addAbstractInstruction(attrNode: IXmlElement, guitarPro: boolean, previousNode: IXmlElement, currentFraction: Fraction): void {
if (attrNode.element("divisions")) {
if (attrNode.elements().length === 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 readNextXmlMeasure
has 380 lines of code (exceeds 25 allowed). Consider refactoring. Open
public readNextXmlMeasure(currentMeasure: SourceMeasure, measureStartAbsoluteTimestamp: Fraction, octavePlusOne: boolean): boolean {
if (this.currentXmlMeasureIndex >= this.xmlMeasureList.length) {
return false;
}
this.currentMeasure = currentMeasure;
Function addAbstractInstruction
has 214 lines of code (exceeds 25 allowed). Consider refactoring. Open
private addAbstractInstruction(attrNode: IXmlElement, guitarPro: boolean, previousNode: IXmlElement, currentFraction: Fraction): void {
if (attrNode.element("divisions")) {
if (attrNode.elements().length === 1) {
return;
}
Function saveAbstractInstructionList
has 166 lines of code (exceeds 25 allowed). Consider refactoring. Open
private saveAbstractInstructionList(numberOfStaves: number, beginOfMeasure: boolean): void {
for (let i: number = this.abstractInstructions.length - 1; i >= 0; i--) {
const instruction: [number, AbstractNotationInstruction, Fraction] = this.abstractInstructions[i];
const key: number = instruction[0]; // staffNumber
const value: AbstractNotationInstruction = instruction[1];
Function readDivisionsFromNotes
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
private readDivisionsFromNotes(): number {
let divisionsFromNote: number = 0;
let xmlMeasureIndex: number = this.currentXmlMeasureIndex;
let read: boolean = false;
while (!read) {
- 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
InstrumentReader
has 29 functions (exceeds 20 allowed). Consider refactoring. Open
export class InstrumentReader {
constructor(pluginManager: ReaderPluginManager, repetitionInstructionReader: RepetitionInstructionReader,
xmlMeasureList: IXmlElement[], instrument: Instrument) {
this.repetitionInstructionReader = repetitionInstructionReader;
Function readDivisionsFromNotes
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
private readDivisionsFromNotes(): number {
let divisionsFromNote: number = 0;
let xmlMeasureIndex: number = this.currentXmlMeasureIndex;
let read: boolean = false;
while (!read) {
Consider simplifying this complex logical expression. Open
if (!this.currentVoiceGenerator.hasVoiceEntry()
|| (!isChord && !isGraceNote && !lastNoteWasGrace)
|| (isGraceNote && !lastNoteWasGrace)
|| (isGraceNote && !isChord)
|| (!isGraceNote && lastNoteWasGrace)
Function getTremoloInfo
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private getTremoloInfo(ornamentsNode: IXmlElement): TremoloInfo {
let tremoloStrokes: number;
let tremoloUnmeasured: boolean;
const tremoloNode: IXmlElement = ornamentsNode.element("tremolo");
if (tremoloNode) {
- 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 getNoteDurationForTuplet
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private getNoteDurationForTuplet(xmlNode: IXmlElement): Fraction {
let duration: Fraction = new Fraction(0, 1);
const typeDuration: Fraction = this.getNoteDurationFromTypeNode(xmlNode);
if (xmlNode.element("time-modification")) {
const time: IXmlElement = xmlNode.element("time-modification");
- 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 createDefaultKeyInstruction
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private createDefaultKeyInstruction(): void {
let first: SourceMeasure;
if (this.musicSheet.SourceMeasures.length > 0) {
first = this.musicSheet.SourceMeasures[0];
} 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
Consider simplifying this complex logical expression. Open
} else if (xmlNode.name === "note") {
let printObject: boolean = true;
if (xmlNode.attribute("print-object")?.value === "no") {
printObject = false; // note will not be rendered, but still parsed for Playback etc.
// if (xmlNode.attribute("print-spacing")) {
Avoid deeply nested control flow statements. Open
if (xmlNode.element("voice")) {
const noteVoice: number = parseInt(xmlNode.element("voice").value, 10);
this.currentVoiceGenerator = this.getOrCreateVoiceGenerator(noteVoice, noteStaff - 1);
} else {
if (!isChord || !this.currentVoiceGenerator) {
Avoid deeply nested control flow statements. Open
if (this.currentXmlMeasureIndex > 0) {
sourceMeasure = this.musicSheet.SourceMeasures[0];
} else {
sourceMeasure = this.currentMeasure;
}
Avoid deeply nested control flow statements. Open
} else if (beginOfMeasure) {
if (instructionTimestamp.RealValue !== 0) {
continue;
}
let firstStaffEntry: SourceStaffEntry;
Avoid deeply nested control flow statements. Open
if (isNaN(this.divisions)) {
const errorMsg: string = ITextTranslation.translateText("ReaderErrorMessages/DivisionError",
"Invalid divisions value at Instrument: ");
log.debug("InstrumentReader.readNextXmlMeasure", errorMsg);
this.divisions = this.readDivisionsFromNotes();
Avoid deeply nested control flow statements. Open
if (staffLinesNode) {
let staffNumber: number = 1;
const staffNumberAttr: Attr = staffDetailsNode.attribute("number");
if (staffNumberAttr) {
staffNumber = parseInt(staffNumberAttr.value, 10);
Avoid deeply nested control flow statements. Open
if (this.activeRhythm) {
// (*) this.musicSheet.SheetPlaybackSetting.Rhythm = this.activeRhythm.Rhythm;
}
Avoid deeply nested control flow statements. Open
if (fractions[i].Denominator === maxDenom) {
num += fractions[i].Numerator;
} else {
num += (maxDenom / fractions[i].Denominator) * fractions[i].Numerator;
}
Avoid deeply nested control flow statements. Open
if (xmlNode.attribute("print-object")?.value === "no") {
printObject = false; // note will not be rendered, but still parsed for Playback etc.
// if (xmlNode.attribute("print-spacing")) {
// if (xmlNode.attribute("print-spacing").value === "yes" {
// // TODO give spacing for invisible notes even when not displayed. might be hard with Vexflow formatting
Avoid deeply nested control flow statements. Open
} else if (xmlNode.name === "forward") {
const forFraction: number = parseInt(xmlNode.element("duration").value, 10);
currentFraction.Add(new Fraction(forFraction, 4 * this.divisions));
} else if (xmlNode.name === "backup") {
const backFraction: number = parseInt(xmlNode.element("duration").value, 10);
Avoid deeply nested control flow statements. Open
if (xmlNode.element("duration")) {
noteDivisions = parseInt(xmlNode.element("duration").value, 10);
if (!isNaN(noteDivisions)) {
noteDuration = new Fraction(noteDivisions, 4 * this.divisions);
if (noteDivisions === 0) {
Avoid deeply nested control flow statements. Open
for (let j: number = this.inSourceMeasureInstrumentIndex; j < this.inSourceMeasureInstrumentIndex + numberOfStaves; j++) {
const newKeyInstruction: KeyInstruction = keyInstruction;
if (!sourceMeasure.FirstInstructionsStaffEntries[j]) {
const firstStaffEntry: SourceStaffEntry = new SourceStaffEntry(undefined, undefined);
sourceMeasure.FirstInstructionsStaffEntries[j] = firstStaffEntry;
Avoid deeply nested control flow statements. Open
if (
isChord &&
this.currentStaffEntry !== undefined &&
this.currentStaffEntry.ParentStaff !== this.currentStaff
) {
Avoid deeply nested control flow statements. Open
if (!this.currentVoiceGenerator.hasVoiceEntry()
|| (!isChord && !isGraceNote && !lastNoteWasGrace)
|| (isGraceNote && !lastNoteWasGrace)
|| (isGraceNote && !isChord)
|| (!isGraceNote && lastNoteWasGrace)
Avoid deeply nested control flow statements. Open
if (s.indexOf("+") !== -1) {
const numbers: string[] = s.split("+");
for (let idx: number = 0, len: number = numbers.length; idx < len; ++idx) {
n += parseInt(numbers[idx], 10);
}
Avoid deeply nested control flow statements. Open
if (instructionTimestamp && Math.abs(instructionTimestamp.RealValue - staffEntry.Timestamp.RealValue) > 0.01) {
continue; // this instruction should be at a different staffentry/timestamp.
}
Avoid deeply nested control flow statements. Open
if (!isGraceNote && !isChord) {
previousFraction = currentFraction.clone();
currentFraction.Add(noteDuration);
}
Avoid deeply nested control flow statements. Open
switch (type) {
case "1024th":
divisionsFromNote = (noteDuration / 4) * 1024;
break;
case "512th":
Avoid deeply nested control flow statements. Open
if (!isTuplet && !isGraceNote) {
noteDuration = new Fraction(noteDivisions, 4 * this.divisions);
}
Avoid deeply nested control flow statements. Open
if (multipleRest) {
// TODO: save multirest per staff info a dictionary, to display a partial multirest if multirest values across staffs differ.
// this makes the code bulkier though, and for now we only draw multirests if the staffs have the same multirest lengths.
// if (!currentMeasure.multipleRestMeasuresPerStaff) {
// currentMeasure.multipleRestMeasuresPerStaff = new Dictionary<number, number>();
Avoid deeply nested control flow statements. Open
if (notationsNode) {
const ornamentsNode: IXmlElement = notationsNode.element("ornaments");
if (ornamentsNode) {
tremoloInfo = this.getTremoloInfo(ornamentsNode);
vibratoStrokes = this.getVibratoStrokes(ornamentsNode);
Avoid deeply nested control flow statements. Open
if (isGraceNote) {
const graceNode: IXmlElement = xmlNode.element("grace");
if (graceNode && graceNode.attributes()) {
if (graceNode.attribute("slash")) {
const slash: string = graceNode.attribute("slash").value;
Avoid deeply nested control flow statements. Open
if (notationsNode !== undefined && notationsNode.element("dynamics")) {
const expressionReader: ExpressionReader = this.expressionReaders[this.readExpressionStaffNumber(xmlNode) - 1];
if (expressionReader) {
expressionReader.readExpressionParameters(
xmlNode, this.instrument, this.divisions, currentFraction, previousFraction, this.currentMeasure.MeasureNumber, false
Avoid deeply nested control flow statements. Open
if (this.divisions > 0) {
this.musicSheet.SheetErrors.push(errorMsg + this.instrument.Name);
} else {
divisionsException = true;
throw new MusicSheetReadingException(errorMsg + this.instrument.Name);
Avoid deeply nested control flow statements. Open
for (let j: number = this.inSourceMeasureInstrumentIndex; j < this.inSourceMeasureInstrumentIndex + numberOfStaves; j++) {
const newRhythmInstruction: RhythmInstruction = rhythmInstruction;
let firstStaffEntry: SourceStaffEntry;
if (!this.currentMeasure.FirstInstructionsStaffEntries[j]) {
firstStaffEntry = new SourceStaffEntry(undefined, undefined);
Function getOrCreateVoiceGenerator
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private getOrCreateVoiceGenerator(voiceId: number, staffId: number): VoiceGenerator {
const staff: Staff = this.instrument.Staves[staffId];
let voiceGenerator: VoiceGenerator = this.voiceGeneratorsDict[voiceId];
if (voiceGenerator) {
if (staff.Voices.indexOf(voiceGenerator.GetVoice) === -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 isAttributesNodeAtEndOfMeasure
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private isAttributesNodeAtEndOfMeasure(parentNode: IXmlElement, attributesNode: IXmlElement, currentFraction: Fraction): boolean {
if (currentFraction.Equals(this.ActiveRhythm?.Rhythm)) {
return true;
// when the MusicXML uses a lot of <backup> nodes (e.g. Sibelius), we sometimes only detect measure end like this, not like below.
// because below code assumes the attributes node is the last one in the measure, just by order in the XML,
- 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 saveClefInstructionAtEndOfMeasure
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private saveClefInstructionAtEndOfMeasure(): void {
for (let i: number = this.abstractInstructions.length - 1; i >= 0; i--) {
const key: number = this.abstractInstructions[i][0];
const value: AbstractNotationInstruction = this.abstractInstructions[i][1];
if (value instanceof ClefInstruction) {
- 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 getNoteStaff
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private getNoteStaff(xmlNode: IXmlElement): number {
let noteStaff: number = 1;
if (this.instrument.Staves.length > 1) {
if (xmlNode.element("staff")) {
noteStaff = parseInt(xmlNode.element("staff").value, 10);
- 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 readExpressionStaffNumber
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private readExpressionStaffNumber(xmlNode: IXmlElement): number {
let directionStaffNumber: number = 1;
if (xmlNode.element("staff")) {
const staffNode: IXmlElement = xmlNode.element("staff");
if (staffNode) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (staffNode) {
try {
directionStaffNumber = parseInt(staffNode.value, 10);
} catch (ex) {
const errorMsg: string = ITextTranslation.translateText(
- 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 95.
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 (keyNode) {
try {
key = parseInt(keyNode.value, 10);
} catch (ex) {
errorMsg = ITextTranslation.translateText(
- 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 91.
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 (lineNode) {
try {
line = parseInt(lineNode.value, 10);
} catch (ex) {
errorMsg = ITextTranslation.translateText(
- 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 91.
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
if (this.divisions > 0) {
this.musicSheet.SheetErrors.push(errorMsg + this.instrument.Name);
} else {
divisionsException = true;
throw new MusicSheetReadingException(errorMsg + this.instrument.Name);
- 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 76.
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
if (this.divisions > 0) {
this.musicSheet.SheetErrors.push(errorMsg + this.instrument.Name);
} else {
divisionsException = true;
throw new MusicSheetReadingException(errorMsg + this.instrument.Name);
- 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 76.
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 (!first.FirstInstructionsStaffEntries[j]) {
const firstStaffEntry: SourceStaffEntry = new SourceStaffEntry(undefined, undefined);
first.FirstInstructionsStaffEntries[j] = firstStaffEntry;
keyInstruction.Parent = firstStaffEntry;
firstStaffEntry.Instructions.push(keyInstruction);
- 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 63.
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 (!sourceMeasure.FirstInstructionsStaffEntries[j]) {
const firstStaffEntry: SourceStaffEntry = new SourceStaffEntry(undefined, undefined);
sourceMeasure.FirstInstructionsStaffEntries[j] = firstStaffEntry;
newKeyInstruction.Parent = firstStaffEntry;
firstStaffEntry.Instructions.push(newKeyInstruction);
- 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 63.
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 (symbolAttribute) {
if (symbolAttribute.value === "common") {
symbolEnum = RhythmSymbolEnum.COMMON;
} else if (symbolAttribute.value === "cut") {
symbolEnum = RhythmSymbolEnum.CUT;
- 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 60.
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
if (this.musicSheet.SourceMeasures.length > 0) {
first = this.musicSheet.SourceMeasures[0];
} else {
first = this.currentMeasure;
}
- 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
if (this.musicSheet.SourceMeasures.length > 0) {
first = this.musicSheet.SourceMeasures[0];
} else {
first = this.currentMeasure;
}
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 57.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (firstStaffEntry.Instructions[0] instanceof ClefInstruction) {
firstStaffEntry.Instructions.splice(1, 0, newKeyInstruction);
} else {
firstStaffEntry.Instructions.splice(0, 0, newKeyInstruction);
}
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 57.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (firstStaffEntry.Instructions[0] instanceof ClefInstruction) {
firstStaffEntry.Instructions.splice(1, 0, keyInstruction);
} else {
firstStaffEntry.Instructions.splice(0, 0, keyInstruction);
}
- 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