opensheetmusicdisplay/opensheetmusicdisplay

View on GitHub
src/MusicalScore/ScoreIO/VoiceGenerator.ts

Summary

Maintainability
F
3 wks
Test Coverage

Function addTuplet has a Cognitive Complexity of 252 (exceeds 5 allowed). Consider refactoring.
Open

  private addTuplet(node: IXmlElement, tupletNodeList: IXmlElement[]): number {
    let bracketed: boolean = false; // true if bracket=yes given, otherwise false
    let bracketedXmlValue: boolean = undefined; // Exact xml bracket value given: true for bracket=yes, false for bracket=no, undefined if not given.
    // TODO refactor this to not duplicate lots of code for the cases tupletNodeList.length == 1 and > 1
    if (tupletNodeList !== undefined && tupletNodeList.length > 1) {
Severity: Minor
Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts - About 5 days to fix

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 VoiceGenerator.ts has 934 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { LinkedVoice } from "../VoiceData/LinkedVoice";
import { Voice } from "../VoiceData/Voice";
import { MusicSheet } from "../MusicSheet";
import { VoiceEntry, StemDirectionType } from "../VoiceData/VoiceEntry";
import { Note, TremoloInfo } from "../VoiceData/Note";
Severity: Major
Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts - About 2 days to fix

    Function addSingleNote has a Cognitive Complexity of 89 (exceeds 5 allowed). Consider refactoring.
    Open

      private addSingleNote(node: IXmlElement, noteDuration: Fraction, noteTypeXml: NoteType, typeDuration: Fraction,
                            normalNotes: number, chord: boolean, octavePlusOne: boolean,
                            printObject: boolean, isCueNote: boolean, isGraceNote: boolean, stemDirectionXml: StemDirectionType, tremoloInfo: TremoloInfo,
                            stemColorXml: string, noteheadColorXml: string, vibratoStrokes: boolean): Note {
        //log.debug("addSingleNote called");
    Severity: Minor
    Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts - About 1 day to fix

    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 read has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring.
    Open

      public read(noteNode: IXmlElement, noteDuration: Fraction, typeDuration: Fraction, noteTypeXml: NoteType, normalNotes: number, restNote: boolean,
                  parentStaffEntry: SourceStaffEntry, parentMeasure: SourceMeasure,
                  measureStartAbsoluteTimestamp: Fraction, maxTieNoteFraction: Fraction, chord: boolean, octavePlusOne: boolean,
                  printObject: boolean, isCueNote: boolean, isGraceNote: boolean, stemDirectionXml: StemDirectionType, tremoloInfo: TremoloInfo,
                  stemColorXml: string, noteheadColorXml: string, vibratoStrokes: boolean,
    Severity: Minor
    Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts - About 1 day to fix

    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 addTuplet has 221 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      private addTuplet(node: IXmlElement, tupletNodeList: IXmlElement[]): number {
        let bracketed: boolean = false; // true if bracket=yes given, otherwise false
        let bracketedXmlValue: boolean = undefined; // Exact xml bracket value given: true for bracket=yes, false for bracket=no, undefined if not given.
        // TODO refactor this to not duplicate lots of code for the cases tupletNodeList.length == 1 and > 1
        if (tupletNodeList !== undefined && tupletNodeList.length > 1) {
    Severity: Major
    Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts - About 1 day to fix

      Function addSingleNote has 171 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        private addSingleNote(node: IXmlElement, noteDuration: Fraction, noteTypeXml: NoteType, typeDuration: Fraction,
                              normalNotes: number, chord: boolean, octavePlusOne: boolean,
                              printObject: boolean, isCueNote: boolean, isGraceNote: boolean, stemDirectionXml: StemDirectionType, tremoloInfo: TremoloInfo,
                              stemColorXml: string, noteheadColorXml: string, vibratoStrokes: boolean): Note {
          //log.debug("addSingleNote called");
      Severity: Major
      Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts - About 6 hrs to fix

        Function addTie has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
        Open

          private addTie(tieNodeList: IXmlElement[], measureStartAbsoluteTimestamp: Fraction, maxTieNoteFraction: Fraction, tieType: TieTypes): void {
            if (tieNodeList) {
              if (tieNodeList.length === 1) {
                const tieNode: IXmlElement = tieNodeList[0];
                if (tieNode !== undefined && tieNode.attributes()) {
        Severity: Minor
        Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts - About 5 hrs to fix

        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 read has 101 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          public read(noteNode: IXmlElement, noteDuration: Fraction, typeDuration: Fraction, noteTypeXml: NoteType, normalNotes: number, restNote: boolean,
                      parentStaffEntry: SourceStaffEntry, parentMeasure: SourceMeasure,
                      measureStartAbsoluteTimestamp: Fraction, maxTieNoteFraction: Fraction, chord: boolean, octavePlusOne: boolean,
                      printObject: boolean, isCueNote: boolean, isGraceNote: boolean, stemDirectionXml: StemDirectionType, tremoloInfo: TremoloInfo,
                      stemColorXml: string, noteheadColorXml: string, vibratoStrokes: boolean,
        Severity: Major
        Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts - About 4 hrs to fix

          Function createBeam has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
          Open

            private createBeam(node: IXmlElement, note: Note): void {
              try {
                const beamNode: IXmlElement = node.element("beam");
                let beamAttr: IXmlAttribute = undefined;
                if (beamNode !== undefined && beamNode.hasAttributes) {
          Severity: Minor
          Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts - About 3 hrs to fix

          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 handleOpenBeam has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
          Open

            private handleOpenBeam(): void {
              const openBeam: Beam = this.openBeams.last();
              if (openBeam.Notes.length === 0) {
                // TODO why is there such a beam? sample: test_percussion_display_step_from_xml
                this.endBeam(); // otherwise beamLastNote.ParentStaffEntry will throw an undefined error
          Severity: Minor
          Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts - About 3 hrs to fix

          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

          VoiceGenerator has 26 functions (exceeds 20 allowed). Consider refactoring.
          Open

          export class VoiceGenerator {
            constructor(pluginManager: ReaderPluginManager, staff: Staff, voiceId: number, slurReader: SlurReader, mainVoice: Voice = undefined) {
              this.staff = staff;
              this.instrument = staff.ParentInstrument;
              this.musicSheet = this.instrument.GetMusicSheet;
          Severity: Minor
          Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts - About 3 hrs to fix

            Function createBeam has 49 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              private createBeam(node: IXmlElement, note: Note): void {
                try {
                  const beamNode: IXmlElement = node.element("beam");
                  let beamAttr: IXmlAttribute = undefined;
                  if (beamNode !== undefined && beamNode.hasAttributes) {
            Severity: Minor
            Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts - About 1 hr to fix

              Function addTie has 45 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                private addTie(tieNodeList: IXmlElement[], measureStartAbsoluteTimestamp: Fraction, maxTieNoteFraction: Fraction, tieType: TieTypes): void {
                  if (tieNodeList) {
                    if (tieNodeList.length === 1) {
                      const tieNode: IXmlElement = tieNodeList[0];
                      if (tieNode !== undefined && tieNode.attributes()) {
              Severity: Minor
              Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts - About 1 hr to fix

                Function handleOpenBeam has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  private handleOpenBeam(): void {
                    const openBeam: Beam = this.openBeams.last();
                    if (openBeam.Notes.length === 0) {
                      // TODO why is there such a beam? sample: test_percussion_display_step_from_xml
                      this.endBeam(); // otherwise beamLastNote.ParentStaffEntry will throw an undefined error
                Severity: Minor
                Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts - About 1 hr to fix

                  Function findCurrentNoteInTieDict has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                    private findCurrentNoteInTieDict(candidateNote: Note): number {
                      const openTieDict: { [_: number]: Tie } = this.openTieDict;
                      for (const key in openTieDict) {
                        if (openTieDict.hasOwnProperty(key)) {
                          const tie: Tie = openTieDict[key];
                  Severity: Minor
                  Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts - About 1 hr to fix

                  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 handleTimeModificationNode has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    private handleTimeModificationNode(noteNode: IXmlElement): void {
                      if (this.tupletDict[this.openTupletNumber]) {
                        try {
                          // Tuplet should already be created
                          const tuplet: Tuplet = this.tupletDict[this.openTupletNumber];
                  Severity: Minor
                  Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts - About 1 hr to fix

                    Function handleTimeModificationNode has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                      private handleTimeModificationNode(noteNode: IXmlElement): void {
                        if (this.tupletDict[this.openTupletNumber]) {
                          try {
                            // Tuplet should already be created
                            const tuplet: Tuplet = this.tupletDict[this.openTupletNumber];
                    Severity: Minor
                    Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts - About 55 mins to fix

                    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 (timeModNode) {
                                tupletLabelNumber = parseInt(timeModNode.value, 10);
                                if (isNaN(tupletLabelNumber)) {
                                  const errorMsg: string = ITextTranslation.translateText(
                                    "ReaderErrorMessages/TupletNoteDurationError", "Invalid tuplet note duration."
                    Severity: Major
                    Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                  if (placementAttr) {
                                    if (placementAttr.value === "below") {
                                      tuplet.tupletLabelNumberPlacement = PlacementEnum.Below;
                                    }
                                    tuplet.PlacementFromXml = true;
                      Severity: Major
                      Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                    } else if (type === "stop") {
                                      const tieNumber: number = this.findCurrentNoteInTieDict(this.currentNote);
                                      const tie: Tie = this.openTieDict[tieNumber];
                                      if (tie) {
                                        tie.AddNote(this.currentNote);
                        Severity: Major
                        Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                    if (octave) {
                                      noteOctave = parseInt(octave.value, 10);
                                      displayOctaveUnpitched = noteOctave - 3;
                                      if (octavePlusOne) {
                                        noteOctave += 1;
                          Severity: Major
                          Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                          if (num < 0) {
                                            delete this.openTieDict[num];
                                          }
                            Severity: Major
                            Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                        if (placementAttr) {
                                          if (placementAttr.value === "below") {
                                            tuplet.tupletLabelNumberPlacement = PlacementEnum.Below;
                                          } else {
                                            //Just in case
                              Severity: Major
                              Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                        } else if (noteElement.name === "instrument") {
                                          if (noteElement.firstAttribute) {
                                            playbackInstrumentId = noteElement.firstAttribute.value;
                                          }
                                        } else if (noteElement.name === "notehead") {
                                Severity: Major
                                Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                            if (timeModNode) {
                                              timeModNode = timeModNode.element("actual-notes");
                                            }
                                  Severity: Major
                                  Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                            } else if (type === "stop") {
                                              if (noTupletNumbering) {
                                                tupletnumber = this.openTupletNumber;
                                              }
                                              const tuplet: Tuplet = this.tupletDict[this.openTupletNumber];
                                    Severity: Major
                                    Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts - About 45 mins to fix

                                      Avoid deeply nested control flow statements.
                                      Open

                                                      if (directionAttr) {
                                                        switch (directionAttr.value) {
                                                          case "up":
                                                            arpeggioType = ArpeggioType.ROLL_UP;
                                                            break;
                                      Severity: Major
                                      Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts - About 45 mins to fix

                                        Avoid deeply nested control flow statements.
                                        Open

                                                    if (voiceEntry.ParentVoice === this.voice) {
                                                      const candidateNote: Note = voiceEntry.Notes[0];
                                                      if (candidateNote.Length.lte(new Fraction(1, 8))) {
                                                        this.openBeams.last().addNoteToBeam(candidateNote);
                                                        this.endBeam();
                                        Severity: Major
                                        Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts - About 45 mins to fix

                                          Avoid deeply nested control flow statements.
                                          Open

                                                    if (displayStepElement) {
                                                      noteStep = NoteEnum[displayStepElement.value.toUpperCase()];
                                                      let octaveShift: number = 0;
                                                      let noteValueShift: number = this.musicSheet.Rules.PercussionXMLDisplayStepNoteValueShift;
                                                      if (this.instrument.Staves[0].StafflineCount === 1) {
                                          Severity: Major
                                          Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts - About 45 mins to fix

                                            Avoid deeply nested control flow statements.
                                            Open

                                                        if (tupletNode.attribute("number")) {
                                                          tupletNumber = parseInt(tupletNode.attribute("number").value, 10);
                                                        }
                                            Severity: Major
                                            Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts - About 45 mins to fix

                                              Function getTieDirection has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                                private getTieDirection(tieNode: IXmlElement): PlacementEnum {
                                                  let tieDirection: PlacementEnum = PlacementEnum.NotYetDefined;
                                                  // read tie direction/placement from XML
                                                  const placementAttr: IXmlAttribute = tieNode.attribute("placement");
                                                  if (placementAttr) {
                                              Severity: Minor
                                              Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts - About 45 mins to fix

                                              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

                                                        } else if (type.value === "stop") {
                                                          let tupletNumber: number = 1;
                                                          if (tupletNode.attribute("number")) {
                                                            tupletNumber = parseInt(tupletNode.attribute("number").value, 10);
                                                          }
                                              Severity: Major
                                              Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts - About 45 mins to fix

                                                Avoid deeply nested control flow statements.
                                                Open

                                                          if (noTupletNumbering) {
                                                            this.openTupletNumber++;
                                                            tupletnumber = this.openTupletNumber;
                                                          }
                                                Severity: Major
                                                Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts - About 45 mins to fix

                                                  Avoid deeply nested control flow statements.
                                                  Open

                                                            if (!tuplet) {
                                                              tuplet = this.tupletDict[tupletnumber] = new Tuplet(tupletLabelNumber, bracketed);
                                                              tuplet.BracketedXmlValue = bracketedXmlValue;
                                                              tuplet.ShowNumberNoneGivenInXml = showNumberNoneGiven;
                                                              //Default to above
                                                  Severity: Major
                                                  Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts - About 45 mins to fix

                                                    Avoid deeply nested control flow statements.
                                                    Open

                                                                  if (voiceEntry.Arpeggio) {
                                                                    arpeggioAlreadyExists = true;
                                                                    currentArpeggio = voiceEntry.Arpeggio;
                                                                    // TODO handle multiple arpeggios across multiple voices at same timestamp
                                                    
                                                    
                                                    Severity: Major
                                                    Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts - About 45 mins to fix

                                                      Avoid deeply nested control flow statements.
                                                      Open

                                                                for (const tieNode of tieNodeList) {
                                                                  const type: string = tieNode.attribute("type").value;
                                                                  if (type === "start") {
                                                                    const placement: PlacementEnum = this.getTieDirection(tieNode);
                                                                    tie.NoteIndexToTieDirection[tie.Notes.length - 1] = placement;
                                                      Severity: Major
                                                      Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts - About 45 mins to fix

                                                        Avoid deeply nested control flow statements.
                                                        Open

                                                                      } else if (pitchElement.name === "alter") {
                                                                        noteAlter = parseFloat(pitchElement.value);
                                                                        if (isNaN(noteAlter)) {
                                                                          const errorMsg: string = ITextTranslation.translateText(
                                                                            "ReaderErrorMessages/NoteAlterationError", "Invalid alteration while reading note."
                                                        Severity: Major
                                                        Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts - About 45 mins to fix

                                                          Avoid deeply nested control flow statements.
                                                          Open

                                                                          if (noteStep === undefined) { // don't replace undefined check
                                                                            const errorMsg: string = ITextTranslation.translateText(
                                                                              "ReaderErrorMessages/NotePitchError",
                                                                              "Invalid pitch while reading note."
                                                                            );
                                                          Severity: Major
                                                          Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts - About 45 mins to fix

                                                            Avoid deeply nested control flow statements.
                                                            Open

                                                                        if (timeModNode) {
                                                                          tupletLabelNumber = parseInt(timeModNode.value, 10);
                                                                          if (isNaN(tupletLabelNumber)) {
                                                                            const errorMsg: string = ITextTranslation.translateText(
                                                                              "ReaderErrorMessages/TupletNoteDurationError", "Invalid tuplet note duration."
                                                            Severity: Major
                                                            Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts - About 45 mins to fix

                                                              Avoid deeply nested control flow statements.
                                                              Open

                                                                          if (this.tupletDict[tupletNumber]) {
                                                                            delete this.tupletDict[tupletNumber];
                                                                            if (Object.keys(this.tupletDict).length === 0) {
                                                                              this.openTupletNumber = 0;
                                                                            } else if (Object.keys(this.tupletDict).length > 1) {
                                                              Severity: Major
                                                              Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts - About 45 mins to fix

                                                                Function checkOpenTies has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                Open

                                                                  public checkOpenTies(): void {
                                                                    const openTieDict: { [key: number]: Tie } = this.openTieDict;
                                                                    for (const key in openTieDict) {
                                                                      if (openTieDict.hasOwnProperty(key)) {
                                                                        const tie: Tie = openTieDict[key];
                                                                Severity: Minor
                                                                Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts - About 25 mins to fix

                                                                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 getTupletNoteDurationFromType has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                Open

                                                                  private getTupletNoteDurationFromType(xmlNode: IXmlElement): Fraction {
                                                                    if (xmlNode.element("type")) {
                                                                      const typeNode: IXmlElement = xmlNode.element("type");
                                                                      if (typeNode) {
                                                                        const type: string = typeNode.value;
                                                                Severity: Minor
                                                                Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts - About 25 mins to fix

                                                                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

                                                                Identical blocks of code found in 2 locations. Consider refactoring.
                                                                Open

                                                                              if (!tuplet.PlacementFromXml) {
                                                                                let foundNonRest: boolean = false;
                                                                                for (const subList of tuplet.Notes) {
                                                                                  for (const note of subList) {
                                                                                    if (!note.isRest()) {
                                                                Severity: Major
                                                                Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts and 1 other location - About 5 hrs to fix
                                                                src/MusicalScore/ScoreIO/VoiceGenerator.ts on lines 901..919

                                                                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 142.

                                                                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

                                                                Further Reading

                                                                Identical blocks of code found in 2 locations. Consider refactoring.
                                                                Open

                                                                            if (!tuplet.PlacementFromXml) {
                                                                              let foundNonRest: boolean = false;
                                                                              for (const subList of tuplet.Notes) {
                                                                                for (const note of subList) {
                                                                                  if (!note.isRest()) {
                                                                Severity: Major
                                                                Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts and 1 other location - About 5 hrs to fix
                                                                src/MusicalScore/ScoreIO/VoiceGenerator.ts on lines 785..803

                                                                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 142.

                                                                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

                                                                Further Reading

                                                                Similar blocks of code found in 2 locations. Consider refactoring.
                                                                Open

                                                                              } else if (pitchElement.name === "octave") {
                                                                                noteOctave = parseInt(pitchElement.value, 10);
                                                                                if (isNaN(noteOctave)) {
                                                                                  const errorMsg: string = ITextTranslation.translateText(
                                                                                    "ReaderErrorMessages/NoteOctaveError", "Invalid octave value while reading note."
                                                                Severity: Major
                                                                Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts and 1 other location - About 2 hrs to fix
                                                                src/MusicalScore/ScoreIO/VoiceGenerator.ts on lines 724..734

                                                                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 78.

                                                                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

                                                                Further Reading

                                                                Similar blocks of code found in 2 locations. Consider refactoring.
                                                                Open

                                                                            if (timeModNode) {
                                                                              tupletLabelNumber = parseInt(timeModNode.value, 10);
                                                                              if (isNaN(tupletLabelNumber)) {
                                                                                const errorMsg: string = ITextTranslation.translateText(
                                                                                  "ReaderErrorMessages/TupletNoteDurationError", "Invalid tuplet note duration."
                                                                Severity: Major
                                                                Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts and 1 other location - About 2 hrs to fix
                                                                src/MusicalScore/ScoreIO/VoiceGenerator.ts on lines 388..397

                                                                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 78.

                                                                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

                                                                Further Reading

                                                                Identical blocks of code found in 3 locations. Consider refactoring.
                                                                Open

                                                                              if (Object.keys(this.tupletDict).length === 0) {
                                                                                this.openTupletNumber = 0;
                                                                              } else if (Object.keys(this.tupletDict).length > 1) {
                                                                                this.openTupletNumber--;
                                                                              }
                                                                Severity: Major
                                                                Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts and 2 other locations - About 2 hrs to fix
                                                                src/MusicalScore/ScoreIO/VoiceGenerator.ts on lines 751..755
                                                                src/MusicalScore/ScoreIO/VoiceGenerator.ts on lines 922..926

                                                                Duplicated Code

                                                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                Tuning

                                                                This issue has a mass of 75.

                                                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                Refactorings

                                                                Further Reading

                                                                Identical blocks of code found in 3 locations. Consider refactoring.
                                                                Open

                                                                            if (Object.keys(this.tupletDict).length === 0) {
                                                                              this.openTupletNumber = 0;
                                                                            } else if (Object.keys(this.tupletDict).length > 1) {
                                                                              this.openTupletNumber--;
                                                                            }
                                                                Severity: Major
                                                                Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts and 2 other locations - About 2 hrs to fix
                                                                src/MusicalScore/ScoreIO/VoiceGenerator.ts on lines 751..755
                                                                src/MusicalScore/ScoreIO/VoiceGenerator.ts on lines 807..811

                                                                Duplicated Code

                                                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                Tuning

                                                                This issue has a mass of 75.

                                                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                Refactorings

                                                                Further Reading

                                                                Identical blocks of code found in 3 locations. Consider refactoring.
                                                                Open

                                                                              if (Object.keys(this.tupletDict).length === 0) {
                                                                                this.openTupletNumber = 0;
                                                                              } else if (Object.keys(this.tupletDict).length > 1) {
                                                                                this.openTupletNumber--;
                                                                              }
                                                                Severity: Major
                                                                Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts and 2 other locations - About 2 hrs to fix
                                                                src/MusicalScore/ScoreIO/VoiceGenerator.ts on lines 807..811
                                                                src/MusicalScore/ScoreIO/VoiceGenerator.ts on lines 922..926

                                                                Duplicated Code

                                                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                Tuning

                                                                This issue has a mass of 75.

                                                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                Refactorings

                                                                Further Reading

                                                                Identical blocks of code found in 2 locations. Consider refactoring.
                                                                Open

                                                                              if (placementAttr) {
                                                                                if (placementAttr.value === "below") {
                                                                                  tuplet.tupletLabelNumberPlacement = PlacementEnum.Below;
                                                                                }  else {
                                                                                  tuplet.tupletLabelNumberPlacement = PlacementEnum.Above;
                                                                Severity: Major
                                                                Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts and 1 other location - About 1 hr to fix
                                                                src/MusicalScore/ScoreIO/VoiceGenerator.ts on lines 888..895

                                                                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 67.

                                                                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

                                                                Further Reading

                                                                Identical blocks of code found in 2 locations. Consider refactoring.
                                                                Open

                                                                            if (placementAttr) {
                                                                              if (placementAttr.value === "below") {
                                                                                tuplet.tupletLabelNumberPlacement = PlacementEnum.Below;
                                                                              } else {
                                                                                tuplet.tupletLabelNumberPlacement = PlacementEnum.Above;
                                                                Severity: Major
                                                                Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts and 1 other location - About 1 hr to fix
                                                                src/MusicalScore/ScoreIO/VoiceGenerator.ts on lines 772..779

                                                                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 67.

                                                                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

                                                                Further Reading

                                                                Identical blocks of code found in 2 locations. Consider refactoring.
                                                                Open

                                                                          if (bracketAttr && bracketAttr.value === "yes") {
                                                                            bracketed = true;
                                                                            bracketedXmlValue = true;
                                                                          } else if (bracketAttr && bracketAttr.value === "no") {
                                                                            bracketedXmlValue = false;
                                                                Severity: Major
                                                                Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts and 1 other location - About 1 hr to fix
                                                                src/MusicalScore/ScoreIO/VoiceGenerator.ts on lines 828..833

                                                                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

                                                                Further Reading

                                                                Identical blocks of code found in 2 locations. Consider refactoring.
                                                                Open

                                                                        if (bracketAttr && bracketAttr.value === "yes") {
                                                                          bracketed = true;
                                                                          bracketedXmlValue = true;
                                                                        } else if (bracketAttr && bracketAttr.value === "no") {
                                                                          bracketedXmlValue = false;
                                                                Severity: Major
                                                                Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts and 1 other location - About 1 hr to fix
                                                                src/MusicalScore/ScoreIO/VoiceGenerator.ts on lines 708..713

                                                                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

                                                                Further Reading

                                                                Similar blocks of code found in 2 locations. Consider refactoring.
                                                                Open

                                                                    if (orientationAttr) {
                                                                      if (orientationAttr.value === "over") {
                                                                        tieDirection = PlacementEnum.Above;
                                                                      } else if (orientationAttr.value === "under") {
                                                                        tieDirection = PlacementEnum.Below;
                                                                Severity: Major
                                                                Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts and 1 other location - About 1 hr to fix
                                                                src/MusicalScore/ScoreIO/InstrumentReader.ts on lines 921..927

                                                                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

                                                                Further Reading

                                                                Similar blocks of code found in 2 locations. Consider refactoring.
                                                                Open

                                                                    try {
                                                                      const beamNode: IXmlElement = node.element("beam");
                                                                      let beamAttr: IXmlAttribute = undefined;
                                                                      if (beamNode !== undefined && beamNode.hasAttributes) {
                                                                        beamAttr = beamNode.attribute("number");
                                                                Severity: Major
                                                                Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts and 1 other location - About 1 hr to fix
                                                                src/MusicalScore/ScoreIO/VoiceGenerator.ts on lines 1110..1116

                                                                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 55.

                                                                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

                                                                Further Reading

                                                                Similar blocks of code found in 2 locations. Consider refactoring.
                                                                Open

                                                                        try {
                                                                          return NoteTypeHandler.getNoteDurationFromType(type);
                                                                        } catch (e) {
                                                                          const errorMsg: string = ITextTranslation.translateText("ReaderErrorMessages/NoteDurationError", "Invalid note duration.");
                                                                          this.musicSheet.SheetErrors.pushMeasureError(errorMsg);
                                                                Severity: Major
                                                                Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts and 1 other location - About 1 hr to fix
                                                                src/MusicalScore/ScoreIO/VoiceGenerator.ts on lines 582..633

                                                                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 55.

                                                                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

                                                                Further Reading

                                                                Similar blocks of code found in 2 locations. Consider refactoring.
                                                                Open

                                                                          try {
                                                                            if (type === "start") {
                                                                              const num: number = this.findCurrentNoteInTieDict(this.currentNote);
                                                                              if (num < 0) {
                                                                                delete this.openTieDict[num];
                                                                Severity: Minor
                                                                Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts and 1 other location - About 35 mins to fix
                                                                src/MusicalScore/ScoreIO/MusicSymbolModules/SlurReader.ts on lines 17..91

                                                                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 47.

                                                                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

                                                                Further Reading

                                                                Similar blocks of code found in 3 locations. Consider refactoring.
                                                                Open

                                                                          } else if (accidentalValue === "sori") {
                                                                            noteAccidental = AccidentalEnum.SORI;
                                                                          } else if (accidentalValue === "koron") {
                                                                            noteAccidental = AccidentalEnum.KORON;
                                                                          }
                                                                Severity: Minor
                                                                Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts and 2 other locations - About 30 mins to fix
                                                                src/MusicalScore/ScoreIO/MusicSymbolModules/ArticulationReader.ts on lines 80..84
                                                                src/MusicalScore/ScoreIO/MusicSymbolModules/ArticulationReader.ts on lines 319..323

                                                                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

                                                                Further Reading

                                                                There are no issues that match your filters.

                                                                Category
                                                                Status