opensheetmusicdisplay/opensheetmusicdisplay

View on GitHub
src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts

Summary

Maintainability
F
2 wks
Test Coverage

Function StaveNote has a Cognitive Complexity of 245 (exceeds 5 allowed). Consider refactoring.
Open

    public static StaveNote(gve: GraphicalVoiceEntry): VF.StaveNote {
        // if (gve.octaveShiftValue !== OctaveEnum.NONE) { // gves with accidentals in octave shift brackets can be unsorted
        gve.sortForVexflow(); // also necessary for some other cases, see test_sorted_notes... sample
        //   sort and reverse replace the array anyways, so we might as well directly sort them reversely for now.
        //   otherwise we should copy the array, see the commented GraphicalVoiceEntry.sortedNotesCopyForVexflow()
Severity: Minor
Found in src/MusicalScore/Graphical/VexFlow/VexFlowConverter.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 VexFlowConverter.ts has 974 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import Vex from "vexflow";
import VF = Vex.Flow;
import {ClefEnum} from "../../VoiceData/Instructions/ClefInstruction";
import {ClefInstruction} from "../../VoiceData/Instructions/ClefInstruction";
import {Pitch} from "../../../Common/DataObjects/Pitch";
Severity: Major
Found in src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts - About 2 days to fix

    Function StaveNote has 341 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static StaveNote(gve: GraphicalVoiceEntry): VF.StaveNote {
            // if (gve.octaveShiftValue !== OctaveEnum.NONE) { // gves with accidentals in octave shift brackets can be unsorted
            gve.sortForVexflow(); // also necessary for some other cases, see test_sorted_notes... sample
            //   sort and reverse replace the array anyways, so we might as well directly sort them reversely for now.
            //   otherwise we should copy the array, see the commented GraphicalVoiceEntry.sortedNotesCopyForVexflow()
    Severity: Major
    Found in src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts - About 1 day to fix

      Function durations has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
      Open

          public static durations(fraction: Fraction, isTuplet: boolean): string[] {
              const durations: string[] = [];
              const remainingFraction: Fraction = fraction.clone();
              while (remainingFraction.RealValue > 0.0001) { // essentially > 0, but using a small delta to prevent infinite loop
                  const dur: number = remainingFraction.RealValue;
      Severity: Minor
      Found in src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts - About 6 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 generateArticulations has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
      Open

          public static generateArticulations(vfnote: VF.StemmableNote, gNote: GraphicalNote,
                                              rules: EngravingRules): void {
              if (!vfnote || vfnote.getAttribute("type") === "GhostNote") {
                  return;
              }
      Severity: Minor
      Found in src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts - About 6 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 generateArticulations has 121 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static generateArticulations(vfnote: VF.StemmableNote, gNote: GraphicalNote,
                                              rules: EngravingRules): void {
              if (!vfnote || vfnote.getAttribute("type") === "GhostNote") {
                  return;
              }
      Severity: Major
      Found in src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts - About 4 hrs to fix

        Function Clef has 71 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static Clef(clef: ClefInstruction, size: string = "default"): { type: string, size: string, annotation: string } {
                let type: string;
                let annotation: string;
        
                // Make sure size is either "default" or "small"
        Severity: Major
        Found in src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts - About 2 hrs to fix

          Function CreateTabNote has 67 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static CreateTabNote(gve: GraphicalVoiceEntry): VF.TabNote {
                  const tabPositions: {str: number, fret: number}[] = [];
                  const notes: GraphicalNote[] = gve.notes.reverse();
                  const tabPhrases: { type: number, text: string, width: number }[] = [];
                  const frac: Fraction = gve.notes[0].graphicalNoteLength;
          Severity: Major
          Found in src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts - About 2 hrs to fix

            Function durations has 62 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static durations(fraction: Fraction, isTuplet: boolean): string[] {
                    const durations: string[] = [];
                    const remainingFraction: Fraction = fraction.clone();
                    while (remainingFraction.RealValue > 0.0001) { // essentially > 0, but using a small delta to prevent infinite loop
                        const dur: number = remainingFraction.RealValue;
            Severity: Major
            Found in src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts - About 2 hrs to fix

              Function generateOrnaments has 56 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static generateOrnaments(vfnote: VF.StemmableNote, oContainer: OrnamentContainer): void {
                      let vfPosition: number = VF.Modifier.Position.ABOVE;
                      if (oContainer.placement === PlacementEnum.Below) {
                          vfPosition = VF.Modifier.Position.BELOW;
                      }
              Severity: Major
              Found in src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts - About 2 hrs to fix

                Function CreateTabNote has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static CreateTabNote(gve: GraphicalVoiceEntry): VF.TabNote {
                        const tabPositions: {str: number, fret: number}[] = [];
                        const notes: GraphicalNote[] = gve.notes.reverse();
                        const tabPhrases: { type: number, text: string, width: number }[] = [];
                        const frac: Fraction = gve.notes[0].graphicalNoteLength;
                Severity: Minor
                Found in src/MusicalScore/Graphical/VexFlow/VexFlowConverter.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 Clef has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static Clef(clef: ClefInstruction, size: string = "default"): { type: string, size: string, annotation: string } {
                        let type: string;
                        let annotation: string;
                
                        // Make sure size is either "default" or "small"
                Severity: Minor
                Found in src/MusicalScore/Graphical/VexFlow/VexFlowConverter.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 font has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public static font(fontSize: number, fontStyle: FontStyles = FontStyles.Regular,
                                       font: Fonts = Fonts.TimesNewRoman, rules: EngravingRules, fontFamily: string = undefined): string {
                        let style: string = "normal";
                        let weight: string = "normal";
                        let family: string = `'${rules.DefaultFontFamily}'`; // default "'Times New Roman'"
                Severity: Minor
                Found in src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts - About 1 hr to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if (pauseVEIndex >= 1 && (neighborGSEs.length - 1) >= (pauseVEIndex + 1)) {
                                              previousVoiceEntry = neighborGSEs[pauseVEIndex - 1]?.graphicalVoiceEntries[0]?.parentVoiceEntry;
                                              followingVoiceEntry = neighborGSEs[pauseVEIndex + 1]?.graphicalVoiceEntries[0]?.parentVoiceEntry;
                                              if (previousVoiceEntry && followingVoiceEntry) {
                                                  const previousNote: Note = previousVoiceEntry.Notes[0];
                  Severity: Major
                  Found in src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                            if (!hasShortNotes) {
                                                extraExistingPadding += rules.LyricsXPaddingReductionForLongNotes; // quarter or longer notes need less padding
                                            }
                    Severity: Major
                    Found in src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                      if (isTuplet && dur > 0.125) {
                                          return ["q"];
                                      } else {
                                          durations.push("8");
                                          remainingFraction.Sub(new Fraction(1, 8));
                      Severity: Major
                      Found in src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                for (const gveNote of staffGve.notes) {
                                                    if (gveNote === note || gveNote.sourceNote.isRest() || !gveNote.sourceNote.PrintObject) {
                                                        continue;
                                                    }
                                                    // unfortunately, we don't have functional note bounding boxes at this point,
                        Severity: Major
                        Found in src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                  switch (restClefInstruction.ClefType) {
                                                      case ClefEnum.F:
                                                          octaveOffset = 5;
                                                          break;
                                                      case ClefEnum.C:
                          Severity: Major
                          Found in src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                    if (isLastNoteInMeasure) {
                                                        extraExistingPadding += rules.LyricsXPaddingReductionForLastNoteInMeasure; // need less padding
                                                    }
                            Severity: Major
                            Found in src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                      for (let i: number = 0; i < neighborGSEs.length; i++) {
                                                          if (neighborGSEs[i]?.graphicalVoiceEntries[0].parentVoiceEntry === pauseVoiceEntry) {
                                                              pauseVEIndex = i;
                                                              break;
                                                          }
                              Severity: Major
                              Found in src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                            } else if (dur < 0.125 && dur >= 0.0625) {
                                                // change to the next higher straight note to get the correct note display type
                                                if (isTuplet && dur > 0.0625) {
                                                    return ["8"];
                                                } else {
                                Severity: Major
                                Found in src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                              if (slur.PlacementXml === PlacementEnum.Above) {
                                                                  vfArt.setYShift(-rules.SlurStartArticulationYOffsetOfArticulation * 10);
                                                              } else if (slur.PlacementXml === PlacementEnum.Below) {
                                                                  vfArt.setYShift(rules.SlurStartArticulationYOffsetOfArticulation * 10);
                                                              }
                                  Severity: Major
                                  Found in src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                                            if (rules.LyricsXPaddingForLastNoteInMeasure || !isLastNoteInMeasure) {
                                                                if (currentLyricsWidth > widthThreshold + extraExistingPadding) {
                                                                    addPadding = true;
                                                                    padding -= extraExistingPadding; // we don't need to add the e.g. 1.2 we already get from measure end padding
                                                                    // for last note in the measure, this is usually not necessary,
                                    Severity: Major
                                    Found in src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts - About 45 mins to fix

                                      Function pitch has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                          public static pitch(pitch: Pitch, isRest: boolean, clef: ClefInstruction,
                                                              notehead: Notehead = undefined, octaveOffsetGiven: number = undefined): [string, string, ClefInstruction] {
                                              //FIXME: The octave seems to need a shift of three?
                                              //FIXME: Also rests seem to use different offsets depending on the clef.
                                              let octaveOffset: number = octaveOffsetGiven;
                                      Severity: Minor
                                      Found in src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts - About 35 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 generateOrnaments has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                          public static generateOrnaments(vfnote: VF.StemmableNote, oContainer: OrnamentContainer): void {
                                              let vfPosition: number = VF.Modifier.Position.ABOVE;
                                              if (oContainer.placement === PlacementEnum.Below) {
                                                  vfPosition = VF.Modifier.Position.BELOW;
                                              }
                                      Severity: Minor
                                      Found in src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts - About 35 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 too many return statements within this function.
                                      Open

                                                          return ["32"];
                                      Severity: Major
                                      Found in src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts - About 30 mins to fix

                                        Avoid too many return statements within this function.
                                        Open

                                                            return ["16"];
                                        Severity: Major
                                        Found in src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts - About 30 mins to fix

                                          Avoid too many return statements within this function.
                                          Open

                                                              return ["64"];
                                          Severity: Major
                                          Found in src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts - About 30 mins to fix

                                            Avoid too many return statements within this function.
                                            Open

                                                    return durations;
                                            Severity: Major
                                            Found in src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts - About 30 mins to fix

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

                                                  private static minorMap: {[_: number]: string } = {
                                                      "-1": "D", "-2": "G", "-3": "C", "-4": "F", "-5": "Bb", "-6": "Eb", "-7": "Ab", "-8": "Db",
                                                      "0": "A", "1": "E", "2": "B", "3": "F#", "4": "C#", "5": "G#", "6": "D#", "7": "A#", "8": "E#"
                                                  };
                                              Severity: Major
                                              Found in src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts and 1 other location - About 3 hrs to fix
                                              src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts on lines 46..49

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

                                              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

                                                  private static majorMap: {[_: number]: string } = {
                                                      "-1": "F", "-2": "Bb", "-3": "Eb", "-4": "Ab", "-5": "Db", "-6": "Gb", "-7": "Cb", "-8": "Fb",
                                                      "0": "C", "1": "G", "2": "D", "3": "A", "4": "E", "5": "B", "6": "F#", "7": "C#", "8": "G#"
                                                  };
                                              Severity: Major
                                              Found in src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts and 1 other location - About 3 hrs to fix
                                              src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts on lines 54..57

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

                                              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

                                                              case ArticulationEnum.downbow: {
                                                                  vfArt = new VF.Articulation("am");
                                                                  if (articulation.placement === undefined) { // downbow/upbow should be above by default
                                                                      vfArtPosition = VF.Modifier.Position.ABOVE;
                                                                      articulation.placement = PlacementEnum.Above;
                                              Severity: Major
                                              Found in src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts and 1 other location - About 2 hrs to fix
                                              src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts on lines 817..824

                                              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

                                                              case ArticulationEnum.upbow: {
                                                                  vfArt = new VF.Articulation("a|");
                                                                  if (articulation.placement === undefined) { // downbow/upbow should be above by default
                                                                      vfArtPosition = VF.Modifier.Position.ABOVE;
                                                                      articulation.placement = PlacementEnum.Above;
                                              Severity: Major
                                              Found in src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts and 1 other location - About 2 hrs to fix
                                              src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts on lines 742..749

                                              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 6 locations. Consider refactoring.
                                              Open

                                                          } else if (dur < 0.5 && dur >= 0.25) {
                                                              // change to the next higher straight note to get the correct note display type
                                                              if (isTuplet && dur > 0.25) {
                                                                  return ["h"];
                                                              } else {
                                              Severity: Major
                                              Found in src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts and 5 other locations - About 1 hr to fix
                                              src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts on lines 84..139
                                              src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts on lines 100..139
                                              src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts on lines 108..139
                                              src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts on lines 116..139
                                              src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts on lines 124..139

                                              Duplicated Code

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

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

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

                                              Tuning

                                              This issue has a mass of 57.

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

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

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

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

                                              Refactorings

                                              Further Reading

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

                                                          } else if (dur < 0.125 && dur >= 0.0625) {
                                                              // change to the next higher straight note to get the correct note display type
                                                              if (isTuplet && dur > 0.0625) {
                                                                  return ["8"];
                                                              } else {
                                              Severity: Major
                                              Found in src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts and 5 other locations - About 1 hr to fix
                                              src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts on lines 84..139
                                              src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts on lines 92..139
                                              src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts on lines 100..139
                                              src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts on lines 116..139
                                              src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts on lines 124..139

                                              Duplicated Code

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

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

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

                                              Tuning

                                              This issue has a mass of 57.

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

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

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

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

                                              Refactorings

                                              Further Reading

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

                                                          } else if (dur < 1 && dur >= 0.5) {
                                                              // change to the next higher straight note to get the correct note display type
                                                              if (isTuplet && dur > 0.5) {
                                                                  return ["w"];
                                                              } else {
                                              Severity: Major
                                              Found in src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts and 5 other locations - About 1 hr to fix
                                              src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts on lines 92..139
                                              src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts on lines 100..139
                                              src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts on lines 108..139
                                              src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts on lines 116..139
                                              src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts on lines 124..139

                                              Duplicated Code

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

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

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

                                              Tuning

                                              This issue has a mass of 57.

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

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

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

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

                                              Refactorings

                                              Further Reading

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

                                                          } else if (dur < 0.0625 && dur >= 0.03125) {
                                                              // change to the next higher straight note to get the correct note display type
                                                              if (isTuplet && dur > 0.03125) {
                                                                  return ["16"];
                                                              } else {
                                              Severity: Major
                                              Found in src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts and 5 other locations - About 1 hr to fix
                                              src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts on lines 84..139
                                              src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts on lines 92..139
                                              src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts on lines 100..139
                                              src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts on lines 108..139
                                              src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts on lines 124..139

                                              Duplicated Code

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

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

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

                                              Tuning

                                              This issue has a mass of 57.

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

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

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

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

                                              Refactorings

                                              Further Reading

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

                                                          } else if (dur < 0.25 && dur >= 0.125) {
                                                              // change to the next higher straight note to get the correct note display type
                                                              if (isTuplet && dur > 0.125) {
                                                                  return ["q"];
                                                              } else {
                                              Severity: Major
                                              Found in src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts and 5 other locations - About 1 hr to fix
                                              src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts on lines 84..139
                                              src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts on lines 92..139
                                              src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts on lines 108..139
                                              src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts on lines 116..139
                                              src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts on lines 124..139

                                              Duplicated Code

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

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

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

                                              Tuning

                                              This issue has a mass of 57.

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

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

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

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

                                              Refactorings

                                              Further Reading

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

                                                          } else if (dur < 0.03125 && dur >= 0.015625) {
                                                              // change to the next higher straight note to get the correct note display type
                                                              if (isTuplet && dur > 0.015625) {
                                                                  return ["32"];
                                                              } else {
                                              Severity: Major
                                              Found in src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts and 5 other locations - About 1 hr to fix
                                              src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts on lines 84..139
                                              src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts on lines 92..139
                                              src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts on lines 100..139
                                              src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts on lines 108..139
                                              src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts on lines 116..139

                                              Duplicated Code

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

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

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

                                              Tuning

                                              This issue has a mass of 57.

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

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

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

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

                                              Refactorings

                                              Further Reading

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

                                                                default:
                                                                    type = "bass";
                                                                    log.error(`Clef ${ClefEnum[clef.ClefType]} on line ${clef.Line} not supported by VexFlow. Using default value "${type}".`);
                                              Severity: Major
                                              Found in src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts and 2 other locations - About 40 mins to fix
                                              src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts on lines 1038..1040
                                              src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts on lines 1077..1079

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

                                              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

                                                                default:
                                                                    type = "alto";
                                                                    log.error(`Clef ${ClefEnum[clef.ClefType]} on line ${clef.Line} not supported by VexFlow. Using default value "${type}".`);
                                              Severity: Major
                                              Found in src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts and 2 other locations - About 40 mins to fix
                                              src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts on lines 1038..1040
                                              src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts on lines 1056..1058

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

                                              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

                                                                  default:
                                                                      type = "treble";
                                                                      log.error(`Clef ${ClefEnum[clef.ClefType]} on line ${clef.Line} not supported by VexFlow. Using default value "${type}".`);
                                              Severity: Major
                                              Found in src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts and 2 other locations - About 40 mins to fix
                                              src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts on lines 1056..1058
                                              src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts on lines 1077..1079

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

                                              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 (accidentals[i] === "bbs") { // triple flat
                                                                  vfnote.addAccidental(i, new VF.Accidental("bb"));
                                                                  vfnote.addAccidental(i, new VF.Accidental("b"));
                                                                  continue;
                                                              }
                                              Severity: Minor
                                              Found in src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts and 1 other location - About 35 mins to fix
                                              src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts on lines 662..670

                                              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 2 locations. Consider refactoring.
                                              Open

                                                              if (accidentals[i] === "###") { // triple sharp
                                                                  vfnote.addAccidental(i, new VF.Accidental("##"));
                                                                  vfnote.addAccidental(i, new VF.Accidental("#"));
                                                                  continue;
                                                              } else if (accidentals[i] === "bbs") { // triple flat
                                              Severity: Minor
                                              Found in src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts and 1 other location - About 35 mins to fix
                                              src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts on lines 666..670

                                              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 2 locations. Consider refactoring.
                                              Open

                                                              case(StemDirectionType.Up):
                                                                  vfnote.setStemDirection(VF.Stem.UP);
                                                                  gve.parentVoiceEntry.StemDirection = StemDirectionType.Up;
                                                                  break;
                                              Severity: Minor
                                              Found in src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts and 1 other location - About 35 mins to fix
                                              src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts on lines 650..653

                                              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 2 locations. Consider refactoring.
                                              Open

                                                              case (StemDirectionType.Down):
                                                                  vfnote.setStemDirection(VF.Stem.DOWN);
                                                                  gve.parentVoiceEntry.StemDirection = StemDirectionType.Down;
                                                                  break;
                                              Severity: Minor
                                              Found in src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts and 1 other location - About 35 mins to fix
                                              src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts on lines 646..649

                                              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

                                              There are no issues that match your filters.

                                              Category
                                              Status