Function createInstrumentGroups
has a Cognitive Complexity of 131 (exceeds 5 allowed). Consider refactoring. Open
private createInstrumentGroups(entryList: IXmlElement[]): { [_: string]: Instrument } {
let instrumentId: number = 0;
const instrumentDict: { [_: string]: Instrument } = {};
let currentGroup: InstrumentalGroup;
try {
- 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 MusicSheetReader.ts
has 917 lines of code (exceeds 250 allowed). Consider refactoring. Open
import {MusicSheet} from "../MusicSheet";
import {SourceMeasure} from "../VoiceData/SourceMeasure";
import {Fraction} from "../../Common/DataObjects/Fraction";
import {InstrumentReader} from "./InstrumentReader";
import {IXmlElement} from "../../Common/FileIO/Xml";
Function readTitleAndComposerFromCreditsLegacy
has a Cognitive Complexity of 104 (exceeds 5 allowed). Consider refactoring. Open
private readTitleAndComposerFromCreditsLegacy(root: IXmlElement): void {
const systemYCoordinates: number = this.computeSystemYCoordinates(root);
if (systemYCoordinates === 0) {
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 readTitleAndComposerFromCredits
has a Cognitive Complexity of 89 (exceeds 5 allowed). Consider refactoring. Open
private readTitleAndComposerFromCredits(root: IXmlElement): void {
if (this.rules.SheetComposerSubtitleUseLegacyParsing) {
this.readTitleAndComposerFromCreditsLegacy(root);
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 checkIfRhythmInstructionsAreSetAndEqual
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
private checkIfRhythmInstructionsAreSetAndEqual(instrumentReaders: InstrumentReader[]): void {
const rhythmInstructions: RhythmInstruction[] = [];
for (let i: number = 0; i < this.completeNumberOfStaves; i++) {
if (this.currentMeasure.FirstInstructionsStaffEntries[i]) {
const last: AbstractNotationInstruction = this.currentMeasure.FirstInstructionsStaffEntries[i].Instructions[
- 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 createInstrumentGroups
has 132 lines of code (exceeds 25 allowed). Consider refactoring. Open
private createInstrumentGroups(entryList: IXmlElement[]): { [_: string]: Instrument } {
let instrumentId: number = 0;
const instrumentDict: { [_: string]: Instrument } = {};
let currentGroup: InstrumentalGroup;
try {
Function checkSourceMeasureForNullEntries
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
private checkSourceMeasureForNullEntries(): void {
for (let i: number = this.currentMeasure.VerticalSourceStaffEntryContainers.length - 1; i >= 0; i--) {
for (let j: number = this.currentMeasure.VerticalSourceStaffEntryContainers[i].StaffEntries.length - 1; j >= 0; j--) {
const sourceStaffEntry: SourceStaffEntry = this.currentMeasure.VerticalSourceStaffEntryContainers[i].StaffEntries[j];
if (sourceStaffEntry) {
- 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 _createMusicSheet
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
private _createMusicSheet(root: IXmlElement, path: string): MusicSheet {
const instrumentReaders: InstrumentReader[] = [];
let sourceMeasureCounter: number = 0;
this.musicSheet = new MusicSheet();
this.musicSheet.Path = path;
- 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 readTitleAndComposerFromCredits
has 93 lines of code (exceeds 25 allowed). Consider refactoring. Open
private readTitleAndComposerFromCredits(root: IXmlElement): void {
if (this.rules.SheetComposerSubtitleUseLegacyParsing) {
this.readTitleAndComposerFromCreditsLegacy(root);
return;
}
MusicSheetReader
has 29 functions (exceeds 20 allowed). Consider refactoring. Open
export class MusicSheetReader /*implements IMusicSheetReader*/ {
constructor(afterSheetReadingModules: IAfterSheetReadingModule[] = undefined, rules: EngravingRules = new EngravingRules()) {
if (!afterSheetReadingModules) {
this.afterSheetReadingModules = [];
Function readTitleAndComposerFromCreditsLegacy
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
private readTitleAndComposerFromCreditsLegacy(root: IXmlElement): void {
const systemYCoordinates: number = this.computeSystemYCoordinates(root);
if (systemYCoordinates === 0) {
return;
}
Function computeSystemYCoordinates
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
private computeSystemYCoordinates(root: IXmlElement): number {
if (!root.element("defaults")) {
return 0;
}
let paperHeight: number = 0;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function setSourceMeasureDuration
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
private setSourceMeasureDuration(instrumentReaders: InstrumentReader[], sourceMeasureCounter: number): number {
let activeRhythm: Fraction = new Fraction(0, 1);
const instrumentsMaxTieNoteFractions: Fraction[] = [];
for (const instrumentReader of instrumentReaders) {
instrumentsMaxTieNoteFractions.push(instrumentReader.MaxTieNoteFraction);
- 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 _createMusicSheet
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
private _createMusicSheet(root: IXmlElement, path: string): MusicSheet {
const instrumentReaders: InstrumentReader[] = [];
let sourceMeasureCounter: number = 0;
this.musicSheet = new MusicSheet();
this.musicSheet.Path = path;
Function checkIfRhythmInstructionsAreSetAndEqual
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
private checkIfRhythmInstructionsAreSetAndEqual(instrumentReaders: InstrumentReader[]): void {
const rhythmInstructions: RhythmInstruction[] = [];
for (let i: number = 0; i < this.completeNumberOfStaves; i++) {
if (this.currentMeasure.FirstInstructionsStaffEntries[i]) {
const last: AbstractNotationInstruction = this.currentMeasure.FirstInstructionsStaffEntries[i].Instructions[
Function readTitle
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
private readTitle(root: IXmlElement): void {
const titleNode: IXmlElement = root.element("work");
let titleNodeChild: IXmlElement = undefined;
if (titleNode) {
titleNodeChild = titleNode.element("work-title");
- 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 getCompleteNumberOfStavesFromXml
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
private getCompleteNumberOfStavesFromXml(partInst: IXmlElement[]): number {
let num: number = 0;
for (const partNode of partInst) {
const xmlMeasureList: IXmlElement[] = partNode.elements("measure");
if (xmlMeasureList.length > 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 setSourceMeasureDuration
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
private setSourceMeasureDuration(instrumentReaders: InstrumentReader[], sourceMeasureCounter: number): number {
let activeRhythm: Fraction = new Fraction(0, 1);
const instrumentsMaxTieNoteFractions: Fraction[] = [];
for (const instrumentReader of instrumentReaders) {
instrumentsMaxTieNoteFractions.push(instrumentReader.MaxTieNoteFraction);
Function computeSystemYCoordinates
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
private computeSystemYCoordinates(root: IXmlElement): number {
if (!root.element("defaults")) {
return 0;
}
let paperHeight: number = 0;
Function readComposer
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private readComposer(root: IXmlElement): void {
const identificationNode: IXmlElement = root.element("identification");
if (identificationNode) {
const creators: IXmlElement[] = identificationNode.elements("creator");
for (let idx: number = 0, len: number = creators.length; idx < len; ++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 readTitle
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
private readTitle(root: IXmlElement): void {
const titleNode: IXmlElement = root.element("work");
let titleNodeChild: IXmlElement = undefined;
if (titleNode) {
titleNodeChild = titleNode.element("work-title");
Function initializeReading
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
private initializeReading(partList: IXmlElement[], partInst: IXmlElement[], instrumentReaders: InstrumentReader[]): void {
const instrumentDict: { [_: string]: Instrument } = this.createInstrumentGroups(partList);
this.completeNumberOfStaves = this.getCompleteNumberOfStavesFromXml(partInst);
if (partInst.length !== 0) {
this.repetitionInstructionReader.MusicSheet = this.musicSheet;
Function checkSourceMeasureForNullEntries
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
private checkSourceMeasureForNullEntries(): void {
for (let i: number = this.currentMeasure.VerticalSourceStaffEntryContainers.length - 1; i >= 0; i--) {
for (let j: number = this.currentMeasure.VerticalSourceStaffEntryContainers[i].StaffEntries.length - 1; j >= 0; j--) {
const sourceStaffEntry: SourceStaffEntry = this.currentMeasure.VerticalSourceStaffEntryContainers[i].StaffEntries[j];
if (sourceStaffEntry) {
Function initializeReading
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private initializeReading(partList: IXmlElement[], partInst: IXmlElement[], instrumentReaders: InstrumentReader[]): void {
const instrumentDict: { [_: string]: Instrument } = this.createInstrumentGroups(partList);
this.completeNumberOfStaves = this.getCompleteNumberOfStavesFromXml(partInst);
if (partInst.length !== 0) {
this.repetitionInstructionReader.MusicSheet = this.musicSheet;
- 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 readCopyright
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private readCopyright(root: IXmlElement): void {
const idElements: IXmlElement[] = root.elements("identification");
if(idElements.length > 0){
const idElement: IXmlElement = idElements[0];
const rightElements: IXmlElement[] = idElement.elements("rights");
- 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 (partElement.attribute("print-object") &&
partElement.attribute("print-object").value === "no") {
instrument.NameLabel.print = false;
}
Avoid deeply nested control flow statements. Open
if (creditJustify === "right") {
isComposer = true;
isSubtitleOrComposer = true;
} else if (creditJustify === "center" && finalTitle) {
isSubtitle = true;
Avoid deeply nested control flow statements. Open
if ((creditYGiven && creditYInfo > systemYCoordinates) || isSubtitleOrComposer) {
if (!finalTitle && !isSubtitleOrComposer) {
// only take largest font size label
// const creditSize: string = creditChild.attribute("font-size")?.value;
// if (creditSize) {
Avoid deeply nested control flow statements. Open
if (creditChildValue === "Copyright ©") {
continue; // this seems to be a MuseScore default, useless
}
Avoid deeply nested control flow statements. Open
if (voiceEntry.Notes.length === 0) {
this._removeFromArray(voiceEntry.ParentVoice.VoiceEntries, voiceEntry);
this._removeFromArray(sourceStaffEntry.VoiceEntries, voiceEntry);
}
Avoid deeply nested control flow statements. Open
} else if (partElement.name === "part-abbreviation") {
instrument.PartAbbreviation = partElement.value;
} else if (partElement.name === "score-instrument") {
const subInstrument: SubInstrument = new SubInstrument(instrument);
subInstrument.idString = partElement.firstAttribute.value;
Avoid deeply nested control flow statements. Open
if (syslab.element("top-system-distance")) {
const topSystemDistanceString: string = syslab.element("top-system-distance").value;
topSystemDistance = parseFloat(topSystemDistanceString);
found = true;
break;
Avoid deeply nested control flow statements. Open
if (!this.musicSheet.Subtitle) {
if (creditJustify !== "right" && creditJustify !== "left" || isSubtitle) {
if (largestCreditYInfo < creditYInfo) {
largestCreditYInfo = creditYInfo;
if (possibleTitle) {
Avoid deeply nested control flow statements. Open
if (currentGroup) {
if (currentGroup.InstrumentalGroups.length === 1) {
const instr: InstrumentalGroup = currentGroup.InstrumentalGroups[0];
if (currentGroup.Parent) {
currentGroup.Parent.InstrumentalGroups.push(instr);
Avoid deeply nested control flow statements. Open
switch (creditJustify) {
case "right":
if (!this.musicSheet.Composer) {
this.musicSheet.Composer = new Label(this.trimString(creditChild.value));
}
Avoid deeply nested control flow statements. Open
if (!this.musicSheet.Title && !isSubtitle) {
const creditSize: string = creditChild.attribute("font-size")?.value;
if (creditSize) {
const titleCreditSizeInt: number = parseFloat(creditSize);
if (largestTitleCreditSize < titleCreditSizeInt) {
Function getInstrumentNumberOfStavesFromXml
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private getInstrumentNumberOfStavesFromXml(partNode: IXmlElement): number {
let num: number = 0;
const xmlMeasure: IXmlElement = partNode.element("measure");
if (xmlMeasure) {
const attributes: IXmlElement = xmlMeasure.element("attributes");
- 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 3 locations. Consider refactoring. Open
for (let idx: number = 0, len: number = instrumentReaders.length; idx < len; ++idx) {
const instrumentReader: InstrumentReader = instrumentReaders[idx];
instrumentReader.ActiveRhythm = rhythmInstruction;
}
- 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 68.
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 = instrumentReaders.length; idx < len; ++idx) {
const instrumentReader: InstrumentReader = instrumentReaders[idx];
instrumentReader.ActiveRhythm = rhythmInstruction;
}
- 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 68.
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
} else if (instrumentElement.name === "volume") {
try {
const result: number = parseFloat(instrumentElement.value);
subInstrument.volume = result / 127.0;
} catch (ex) {
- 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 64.
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
} else if (instrumentElement.name === "pan") {
try {
const result: number = parseFloat(instrumentElement.value);
subInstrument.pan = result / 64.0;
} catch (ex) {
- 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 64.
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
case "left":
if (!this.musicSheet.Lyricist) {
this.musicSheet.Lyricist = new Label(this.trimString(creditChild.value));
}
break;
- 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
if (syslay.element("top-system-distance")) {
const topSystemDistanceString: string = root.element("defaults").element("system-layout").element("top-system-distance").value;
topSystemDistance = parseFloat(topSystemDistanceString);
}
- 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
try {
const defi: string = root.element("defaults").element("page-layout").element("page-height").value;
paperHeight = parseFloat(defi);
} catch (e) {
- 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
case "right":
if (!this.musicSheet.Composer) {
this.musicSheet.Composer = new Label(this.trimString(creditChild.value));
}
break;
- 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 4 locations. Consider refactoring. Open
if (!this.musicSheet.Title && finalTitle) {
this.musicSheet.Title = new Label(this.trimString(finalTitle));
}
- 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 4 locations. Consider refactoring. Open
if (!this.musicSheet.Title && finalTitle) {
this.musicSheet.Title = new Label(this.trimString(finalTitle));
}
- 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 4 locations. Consider refactoring. Open
if (!this.musicSheet.Subtitle && finalSubtitle) {
this.musicSheet.Subtitle = new Label(this.trimString(finalSubtitle));
}
- 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 4 locations. Consider refactoring. Open
if (!this.musicSheet.Subtitle && finalSubtitle) {
this.musicSheet.Subtitle = new Label(this.trimString(finalSubtitle));
}
- 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 (isNaN(num) || num <= 0) {
const errorMsg: string = ITextTranslation.translateText(
"ReaderErrorMessages/StaffError", "Invalid number of staves."
);
throw new MusicSheetReadingException(errorMsg);
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 46.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (isNaN(num) || num <= 0) {
const errorMsg: string = ITextTranslation.translateText(
"ReaderErrorMessages/StaffError", "Invalid number of Staves."
);
throw new MusicSheetReadingException(errorMsg);
- 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