opensheetmusicdisplay/opensheetmusicdisplay

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

Summary

Maintainability
F
1 mo
Test Coverage

File VexFlowMusicSheetCalculator.ts has 1432 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { MusicSheetCalculator } from "../MusicSheetCalculator";
import { VexFlowGraphicalSymbolFactory } from "./VexFlowGraphicalSymbolFactory";
import { GraphicalMeasure } from "../GraphicalMeasure";
import { StaffLine } from "../StaffLine";
import { SkyBottomLineBatchCalculator } from "../SkyBottomLineBatchCalculator";
Severity: Major
Found in src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts - About 3 days to fix

    Function calculateMeasureXLayout has a Cognitive Complexity of 129 (exceeds 5 allowed). Consider refactoring.
    Open

      protected calculateMeasureXLayout(measures: GraphicalMeasure[]): number {
        const visibleMeasures: GraphicalMeasure[] = [];
        for (const measure of measures) {
          if (measure?.isVisible()) { // if we don't check for visibility, invisible parts affect layout (#1444)
            visibleMeasures.push(measure);
    Severity: Minor
    Found in src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts - About 2 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

    Function calculateGlissandi has a Cognitive Complexity of 116 (exceeds 5 allowed). Consider refactoring.
    Open

      public calculateGlissandi(): void {
        const openGlissDict: { [staffId: number]: GraphicalGlissando[] } = {};
        for (const graphicalMeasure of this.graphicalMusicSheet.MeasureList[0]) { //let i: number = 0; i < this.graphicalMusicSheet.MeasureList[0].length; i++) {
          openGlissDict[graphicalMeasure.ParentStaff.idInMusicSheet] = [];
        }
    Severity: Minor
    Found in src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts - About 2 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

    Function calculateSingleOctaveShift has a Cognitive Complexity of 101 (exceeds 5 allowed). Consider refactoring.
    Open

      protected calculateSingleOctaveShift(sourceMeasure: SourceMeasure, multiExpression: MultiExpression, measureIndex: number, staffIndex: number): void {
        // calculate absolute Timestamp and startStaffLine (and EndStaffLine if needed)
        const octaveShift: OctaveShift = multiExpression.OctaveShiftStart;
    
        const startTimeStamp: Fraction = octaveShift.ParentStartMultiExpression.Timestamp;
    Severity: Minor
    Found in src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts - About 2 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

    Function calculateSlurs has a Cognitive Complexity of 97 (exceeds 5 allowed). Consider refactoring.
    Open

      protected calculateSlurs(): void {
        const openSlursDict: { [staffId: number]: GraphicalSlur[] } = {};
        for (const graphicalMeasure of this.graphicalMusicSheet.MeasureList[0]) { //let i: number = 0; i < this.graphicalMusicSheet.MeasureList[0].length; i++) {
          openSlursDict[graphicalMeasure.ParentStaff.idInMusicSheet] = [];
        }
    Severity: Minor
    Found in src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.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 calculateSinglePedal has a Cognitive Complexity of 74 (exceeds 5 allowed). Consider refactoring.
    Open

      protected calculateSinglePedal(sourceMeasure: SourceMeasure, multiExpression: MultiExpression, measureIndex: number, staffIndex: number): void {
        // calculate absolute Timestamp and startStaffLine (and EndStaffLine if needed)
        const pedal: Pedal = multiExpression.PedalStart;
    
        const startTimeStamp: Fraction = pedal.ParentStartMultiExpression.Timestamp;
    Severity: Minor
    Found in src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.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 calculateElongationFactor has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
    Open

      private calculateElongationFactor(containers: (GraphicalLyricEntry|GraphicalChordSymbolContainer)[], staffEntry: GraphicalStaffEntry, lastEntryDict: any,
                                        oldMinimumStaffEntriesWidth: number, elongationFactorForMeasureWidth: number,
                                        measureNumber: number, oldMinSpacing: number, nextMeasureOverlap: number): number {
        let newElongationFactorForMeasureWidth: number = elongationFactorForMeasureWidth;
        let currentContainerIndex: number = 0;
    Severity: Minor
    Found in src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.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 calculatePedalSkyBottomLine has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
    Open

      private calculatePedalSkyBottomLine(startVfVoiceEntry: VexFlowVoiceEntry, endVfVoiceEntry: VexFlowVoiceEntry,
        vfPedal: VexFlowPedal, parentStaffline: StaffLine): void {
          let endBbox: BoundingBox = endVfVoiceEntry?.PositionAndShape;
          if (!endBbox) {
            endBbox = vfPedal.endMeasure.PositionAndShape;
    Severity: Minor
    Found in src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.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 calculateMeasureXLayout has 158 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      protected calculateMeasureXLayout(measures: GraphicalMeasure[]): number {
        const visibleMeasures: GraphicalMeasure[] = [];
        for (const measure of measures) {
          if (measure?.isVisible()) { // if we don't check for visibility, invisible parts affect layout (#1444)
            visibleMeasures.push(measure);
    Severity: Major
    Found in src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts - About 6 hrs to fix

      Function calculateSingleOctaveShift has 151 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        protected calculateSingleOctaveShift(sourceMeasure: SourceMeasure, multiExpression: MultiExpression, measureIndex: number, staffIndex: number): void {
          // calculate absolute Timestamp and startStaffLine (and EndStaffLine if needed)
          const octaveShift: OctaveShift = multiExpression.OctaveShiftStart;
      
          const startTimeStamp: Fraction = octaveShift.ParentStartMultiExpression.Timestamp;
      Severity: Major
      Found in src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts - About 6 hrs to fix

        Function calculateSinglePedal has 149 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          protected calculateSinglePedal(sourceMeasure: SourceMeasure, multiExpression: MultiExpression, measureIndex: number, staffIndex: number): void {
            // calculate absolute Timestamp and startStaffLine (and EndStaffLine if needed)
            const pedal: Pedal = multiExpression.PedalStart;
        
            const startTimeStamp: Fraction = pedal.ParentStartMultiExpression.Timestamp;
        Severity: Major
        Found in src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts - About 5 hrs to fix

          Function calculatePedalSkyBottomLine has 125 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            private calculatePedalSkyBottomLine(startVfVoiceEntry: VexFlowVoiceEntry, endVfVoiceEntry: VexFlowVoiceEntry,
              vfPedal: VexFlowPedal, parentStaffline: StaffLine): void {
                let endBbox: BoundingBox = endVfVoiceEntry?.PositionAndShape;
                if (!endBbox) {
                  endBbox = vfPedal.endMeasure.PositionAndShape;
          Severity: Major
          Found in src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts - About 5 hrs to fix

            VexFlowMusicSheetCalculator has 37 functions (exceeds 20 allowed). Consider refactoring.
            Open

            export class VexFlowMusicSheetCalculator extends MusicSheetCalculator {
              /** space needed for a dash for lyrics spacing, calculated once */
              private dashSpace: number;
              public beamsNeedUpdate: boolean = false;
            
            
            Severity: Minor
            Found in src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts - About 4 hrs to fix

              Function layoutGraphicalTie has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
              Open

                protected layoutGraphicalTie(tie: GraphicalTie, tieIsAtSystemBreak: boolean, isTab: boolean): void {
                  const startNote: VexFlowGraphicalNote = (tie.StartNote as VexFlowGraphicalNote);
                  const endNote: VexFlowGraphicalNote = (tie.EndNote as VexFlowGraphicalNote);
              
                  let vfStartNote: VF.StemmableNote  = undefined;
              Severity: Minor
              Found in src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts - About 4 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 calculateGlissandi has 99 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                public calculateGlissandi(): void {
                  const openGlissDict: { [staffId: number]: GraphicalGlissando[] } = {};
                  for (const graphicalMeasure of this.graphicalMusicSheet.MeasureList[0]) { //let i: number = 0; i < this.graphicalMusicSheet.MeasureList[0].length; i++) {
                    openGlissDict[graphicalMeasure.ParentStaff.idInMusicSheet] = [];
                  }
              Severity: Major
              Found in src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts - About 3 hrs to fix

                Function calculateElongationFactor has 99 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  private calculateElongationFactor(containers: (GraphicalLyricEntry|GraphicalChordSymbolContainer)[], staffEntry: GraphicalStaffEntry, lastEntryDict: any,
                                                    oldMinimumStaffEntriesWidth: number, elongationFactorForMeasureWidth: number,
                                                    measureNumber: number, oldMinSpacing: number, nextMeasureOverlap: number): number {
                    let newElongationFactorForMeasureWidth: number = elongationFactorForMeasureWidth;
                    let currentContainerIndex: number = 0;
                Severity: Major
                Found in src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts - About 3 hrs to fix

                  Function layoutGraphicalTie has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    protected layoutGraphicalTie(tie: GraphicalTie, tieIsAtSystemBreak: boolean, isTab: boolean): void {
                      const startNote: VexFlowGraphicalNote = (tie.StartNote as VexFlowGraphicalNote);
                      const endNote: VexFlowGraphicalNote = (tie.EndNote as VexFlowGraphicalNote);
                  
                      let vfStartNote: VF.StemmableNote  = undefined;
                  Severity: Major
                  Found in src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts - About 3 hrs to fix

                    Function calculateSlurs has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      protected calculateSlurs(): void {
                        const openSlursDict: { [staffId: number]: GraphicalSlur[] } = {};
                        for (const graphicalMeasure of this.graphicalMusicSheet.MeasureList[0]) { //let i: number = 0; i < this.graphicalMusicSheet.MeasureList[0].length; i++) {
                          openSlursDict[graphicalMeasure.ParentStaff.idInMusicSheet] = [];
                        }
                    Severity: Major
                    Found in src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts - About 2 hrs to fix

                      Function calculateOctaveShiftSkyBottomLine has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                      Open

                        private calculateOctaveShiftSkyBottomLine(startStaffEntry: GraphicalStaffEntry, endStaffEntry: GraphicalStaffEntry,
                                                                  vfOctaveShift: VexFlowOctaveShift, parentStaffline: StaffLine): void {
                          if (!endStaffEntry) {
                            log.warn("octaveshift: no endStaffEntry");
                            return;
                      Severity: Minor
                      Found in src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts - About 2 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 calculateOctaveShiftSkyBottomLine has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        private calculateOctaveShiftSkyBottomLine(startStaffEntry: GraphicalStaffEntry, endStaffEntry: GraphicalStaffEntry,
                                                                  vfOctaveShift: VexFlowOctaveShift, parentStaffline: StaffLine): void {
                          if (!endStaffEntry) {
                            log.warn("octaveshift: no endStaffEntry");
                            return;
                      Severity: Minor
                      Found in src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts - About 2 hrs to fix

                        Function calculateDynamicExpressionsForMultiExpression has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          protected calculateDynamicExpressionsForMultiExpression(multiExpression: MultiExpression, measureIndex: number, staffIndex: number): void {
                            if (measureIndex < this.rules.MinMeasureToDrawIndex || measureIndex > this.rules.MaxMeasureToDrawIndex) {
                              return;
                              // we do already use the min/max in MusicSheetCalculator.calculateDynamicsExpressions,
                              // but this may be necessary for StaffLinkedExpressions, not tested.
                        Severity: Minor
                        Found in src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts - About 1 hr to fix

                          Function calculateElongationFactorFromStaffEntries has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            public calculateElongationFactorFromStaffEntries(staffEntries: GraphicalStaffEntry[], oldMinimumStaffEntriesWidth: number,
                                                                            elongationFactorForMeasureWidth: number, measureNumber: number): number {
                              interface EntryInfo {
                                cumulativeOverlap: number;
                                extend: boolean;
                          Severity: Minor
                          Found in src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts - About 1 hr to fix

                            Function createMetronomeMark has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              protected createMetronomeMark(metronomeExpression: InstantaneousTempoExpression): void {
                                // note: sometimes MeasureNumber is 0 here, e.g. in Christbaum, maybe because of pickup measure (auftakt)
                                const measureNumber: number = Math.max(metronomeExpression.ParentMultiTempoExpression.SourceMeasureParent.MeasureNumber - 1, 0);
                                const staffNumber: number = Math.max(metronomeExpression.StaffNumber - 1, 0);
                                const firstMetronomeMark: boolean = measureNumber === 0 && staffNumber === 0;
                            Severity: Minor
                            Found in src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts - About 1 hr to fix

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

                                protected formatMeasures(): void {
                                  // let totalFinalizeBeamsTime: number = 0;
                                  for (const verticalMeasureList of this.graphicalMusicSheet.MeasureList) {
                                    if (!verticalMeasureList || !verticalMeasureList[0]) {
                                      continue;
                              Severity: Minor
                              Found in src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.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 calculateDynamicExpressionsForMultiExpression has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                              Open

                                protected calculateDynamicExpressionsForMultiExpression(multiExpression: MultiExpression, measureIndex: number, staffIndex: number): void {
                                  if (measureIndex < this.rules.MinMeasureToDrawIndex || measureIndex > this.rules.MaxMeasureToDrawIndex) {
                                    return;
                                    // we do already use the min/max in MusicSheetCalculator.calculateDynamicsExpressions,
                                    // but this may be necessary for StaffLinkedExpressions, not tested.
                              Severity: Minor
                              Found in src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.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 calculateSkyBottomLines has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                              Open

                                protected calculateSkyBottomLines(): void {
                                  const staffLines: StaffLine[] = CollectionUtil.flat(this.musicSystems.map(musicSystem => musicSystem.StaffLines));
                                  //const numMeasures: number = staffLines.map(staffLine => staffLine.Measures.length).reduce((a, b) => a + b, 0);
                                  let numMeasures: number = 0; // number of graphical measures that are rendered
                                  for (const staffline of staffLines) {
                              Severity: Minor
                              Found in src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.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 handleVoiceEntryLyrics has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                protected handleVoiceEntryLyrics(voiceEntry: VoiceEntry, graphicalStaffEntry: GraphicalStaffEntry, lyricWords: LyricWord[]): void {
                                  voiceEntry.LyricsEntries.forEach((key: string, lyricsEntry: LyricsEntry) => {
                                    const graphicalLyricEntry: GraphicalLyricEntry = new GraphicalLyricEntry(lyricsEntry,
                                                                                                             graphicalStaffEntry,
                                                                                                             this.rules.LyricsHeight,
                              Severity: Minor
                              Found in src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts - About 1 hr to fix

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

                                  protected createMetronomeMark(metronomeExpression: InstantaneousTempoExpression): void {
                                    // note: sometimes MeasureNumber is 0 here, e.g. in Christbaum, maybe because of pickup measure (auftakt)
                                    const measureNumber: number = Math.max(metronomeExpression.ParentMultiTempoExpression.SourceMeasureParent.MeasureNumber - 1, 0);
                                    const staffNumber: number = Math.max(metronomeExpression.StaffNumber - 1, 0);
                                    const firstMetronomeMark: boolean = measureNumber === 0 && staffNumber === 0;
                                Severity: Minor
                                Found in src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.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

                                              for (const graphicalVoiceEntry of graphicalStaffEntry.graphicalVoiceEntries) {
                                                for (const graphicalNote of graphicalVoiceEntry.notes) {
                                                  for (const slur of graphicalNote.sourceNote.NoteSlurs) {
                                                    // extra check for some MusicSheets that have openSlurs (because only the first Page is available -> Recordare files)
                                                    if (!slur.EndNote || !slur.StartNote) {
                                Severity: Major
                                Found in src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                for (const gGliss of openGlissandi) {
                                                  if (gGliss.staffEntries.indexOf(graphicalStaffEntry) === -1) {
                                                    gGliss.staffEntries.push(graphicalStaffEntry);
                                                  }
                                                }
                                  Severity: Major
                                  Found in src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                                if (startMeasure) {
                                                  startMeasure.vfTies.push(vfTie);
                                                  (gGliss as VexFlowGlissando).vfTie = vfTie;
                                                }
                                    Severity: Major
                                    Found in src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts - About 45 mins to fix

                                      Avoid deeply nested control flow statements.
                                      Open

                                                  for (const voiceEntry of staffEntry.graphicalVoiceEntries) {
                                                    if (!voiceEntry.parentVoiceEntry.IsGrace) {
                                                      if (voiceEntry && voiceEntry.notes && voiceEntry.notes[0] && voiceEntry.notes[0].sourceNote) {// TODO null chaining, TS 3.7
                                                        if (voiceEntry.notes[0].sourceNote.PrintObject) { // only respect collision when not invisible
                                                          collidableVoiceEntries++;
                                      Severity: Major
                                      Found in src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts - About 45 mins to fix

                                        Avoid deeply nested control flow statements.
                                        Open

                                                    if (i < systemsInBetweenCount - 1) {
                                                      // if not - 1, the last octaveshift will always go to the end of the staffline
                                                      nextOctaveShift.endsOnDifferentStaffLine = true;
                                                      nextOctaveShift.graphicalEndAtMeasureEnd = true;
                                                      nextOctaveShift.endMeasure = nextShiftLastMeasure;
                                        Severity: Major
                                        Found in src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts - About 45 mins to fix

                                          Avoid deeply nested control flow statements.
                                          Open

                                                      if (endMeasure.ParentStaffLine === nextShiftStaffline) {
                                                        nextShiftLastMeasure = endMeasure;
                                                        lastNote = endStaffEntry;
                                                      }
                                          Severity: Major
                                          Found in src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts - About 45 mins to fix

                                            Avoid deeply nested control flow statements.
                                            Open

                                                        if (startNote.FretNumber > endNote.FretNumber) {
                                                          slideDirection = -1;
                                                        }
                                            Severity: Major
                                            Found in src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts - About 45 mins to fix

                                              Avoid deeply nested control flow statements.
                                              Open

                                                            for (const graphicalVoiceEntry of graphicalStaffEntry.graphicalVoiceEntries) {
                                                              for (const graphicalNote of graphicalVoiceEntry.notes) {
                                                                const gliss: Glissando = graphicalNote.sourceNote.NoteGlissando;
                                                                // extra check for some MusicSheets that have openSlurs (because only the first Page is available -> Recordare files)
                                                                if (!gliss?.EndNote || !gliss?.StartNote) {
                                              Severity: Major
                                              Found in src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts - About 45 mins to fix

                                                Avoid deeply nested control flow statements.
                                                Open

                                                            for (let i: number = startStaffLine.ParentMusicSystem.Id; i < endStaffLine.ParentMusicSystem.Id; i++) {
                                                              const nextPedalMusicSystem: MusicSystem = this.musicSystems[i + 1];
                                                              const nextPedalStaffline: StaffLine = nextPedalMusicSystem.StaffLines[staffIndex];
                                                              const nextPedalFirstMeasure: GraphicalMeasure = nextPedalStaffline.Measures[0];
                                                              let nextOpenEnd: boolean = false;
                                                Severity: Major
                                                Found in src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts - About 45 mins to fix

                                                  Avoid deeply nested control flow statements.
                                                  Open

                                                              if (endingBarStyleEnum === SystemLinesEnum.ThinBold ||
                                                                  endingBarStyleEnum === SystemLinesEnum.DotsThinBold
                                                              ) {
                                                                barlineSpacing = this.rules.PickupMeasureRepetitionSpacing;
                                                                break;
                                                  Severity: Major
                                                  Found in src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts - About 45 mins to fix

                                                    Avoid deeply nested control flow statements.
                                                    Open

                                                                if (!lastNote) {
                                                                  log.warn(logPrefix + "no lastNote found");
                                                                }
                                                    Severity: Major
                                                    Found in src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts - About 45 mins to fix

                                                      Avoid deeply nested control flow statements.
                                                      Open

                                                                  for (const staffline of nextShiftMusicSystem.StaffLines) {
                                                                    if (staffline.ParentStaff.idInMusicSheet === staffIndex) {
                                                                      nextShiftStaffline = staffline;
                                                                      break;
                                                                    }
                                                      Severity: Major
                                                      Found in src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts - About 45 mins to fix

                                                        Avoid deeply nested control flow statements.
                                                        Open

                                                                      switch (pedalMarking.style) {
                                                                        case PEDAL_STYLES_ENUM.BRACKET_OPEN_END:
                                                                        case PEDAL_STYLES_ENUM.BRACKET_OPEN_BOTH:
                                                                        case PEDAL_STYLES_ENUM.MIXED_OPEN_END:
                                                                          otherPedalStopX = otherPedalEndBBox.AbsolutePosition.x + otherPedalEndBBox.BorderRight - otherPedalMarkingMarginXOffset;
                                                        Severity: Major
                                                        Found in src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts - About 45 mins to fix

                                                          Avoid deeply nested control flow statements.
                                                          Open

                                                                        for (const gSlur of openGraphicalSlurs) {
                                                                          if (gSlur.staffEntries.indexOf(graphicalStaffEntry) === -1) {
                                                                            gSlur.staffEntries.push(graphicalStaffEntry);
                                                                          }
                                                                        }
                                                          Severity: Major
                                                          Found in src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts - About 45 mins to fix

                                                            Avoid deeply nested control flow statements.
                                                            Open

                                                                        if (!firstNote) {
                                                                          log.warn(logPrefix + "no firstNote found");
                                                                        }
                                                            Severity: Major
                                                            Found in src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts - About 45 mins to fix

                                                              Avoid deeply nested control flow statements.
                                                              Open

                                                                          if (vfStartNote && vfStartNote.vfnote && vfStartNote.vfnote.length >= 2) {
                                                                            startStemmableNote = vfStartNote.vfnote[0]; // otherwise needs to be undefined in TabSlide constructor!
                                                                            first_indices = [0];
                                                                            // startNoteIndexInTie = vfStartNote.vfnote[1];
                                                                          }
                                                              Severity: Major
                                                              Found in src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts - About 45 mins to fix

                                                                Avoid deeply nested control flow statements.
                                                                Open

                                                                            if (alignRests) {
                                                                              break;
                                                                            }
                                                                Severity: Major
                                                                Found in src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts - About 45 mins to fix

                                                                  Avoid deeply nested control flow statements.
                                                                  Open

                                                                              if (!nextShiftStaffline) { // shouldn't happen
                                                                                continue;
                                                                              }
                                                                  Severity: Major
                                                                  Found in src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts - About 45 mins to fix

                                                                    Avoid deeply nested control flow statements.
                                                                    Open

                                                                                if (endMeasure) {
                                                                                  endMeasure.vfTies.push(vfTie);
                                                                                  (gGliss as VexFlowGlissando).vfTie = vfTie;
                                                                                }
                                                                    Severity: Major
                                                                    Found in src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts - About 45 mins to fix

                                                                      Avoid deeply nested control flow statements.
                                                                      Open

                                                                                  if (startTieNote.FretNumber > endTieNote.FretNumber) {
                                                                                    slideDirection = -1;
                                                                                  }
                                                                      Severity: Major
                                                                      Found in src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts - About 45 mins to fix

                                                                        Avoid deeply nested control flow statements.
                                                                        Open

                                                                                    if (this.dashSpace === undefined) { // don't replace undefined check
                                                                                      this.dashSpace = 1.5;
                                                                                      // better method, doesn't work:
                                                                                      // this.dashLength = new GraphicalLabel(new Label("-"), this.rules.LyricsHeight, TextAlignmentEnum.CenterBottom)
                                                                                      //   .PositionAndShape.Size.width; // always returns 0
                                                                        Severity: Major
                                                                        Found in src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts - About 45 mins to fix

                                                                          Avoid deeply nested control flow statements.
                                                                          Open

                                                                                      if (lastNote.graphicalVoiceEntries.length === 1 &&
                                                                                        lastNote.graphicalVoiceEntries[0].notes.length === 1 &&
                                                                                        lastNote.graphicalVoiceEntries[0].notes[0].sourceNote.isWholeMeasureNote()
                                                                                      ) {
                                                                                        // also draw octaveshift until end of measure if we have a whole note that goes over the whole measure
                                                                          Severity: Major
                                                                          Found in src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts - About 45 mins to fix

                                                                            Avoid deeply nested control flow statements.
                                                                            Open

                                                                                        if (!vfStartNote && !vfEndNote) {
                                                                                          return; // otherwise causes Vexflow error
                                                                                        }
                                                                            Severity: Major
                                                                            Found in src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts - About 45 mins to fix

                                                                              Avoid deeply nested control flow statements.
                                                                              Open

                                                                                          if (vfEndNote && vfEndNote.vfnote && vfEndNote.vfnote.length >= 2) {
                                                                                            endStemmableNote = vfEndNote.vfnote[0];
                                                                                            last_indices = [0];
                                                                                            // endNoteIndexInTie = vfEndNote.vfnote[1];
                                                                                          }
                                                                              Severity: Major
                                                                              Found in src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts - About 45 mins to fix

                                                                                Avoid too many return statements within this function.
                                                                                Open

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

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

                                                                                    protected calculateExpressionAlignements(): void {
                                                                                      for (const musicSystem of this.musicSystems) {
                                                                                        for (const staffLine of musicSystem.StaffLines) {
                                                                                          try {
                                                                                            (<VexFlowStaffLine>staffLine).AlignmentManager.alignDynamicExpressions();
                                                                                  Severity: Minor
                                                                                  Found in src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.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

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

                                                                                          if(pedalMarking.EndsStave){
                                                                                            if(endVfVoiceEntry){
                                                                                              stopX = endVfVoiceEntry.parentStaffEntry.parentMeasure.PositionAndShape.AbsolutePosition.x +
                                                                                                endVfVoiceEntry.parentStaffEntry.parentMeasure.PositionAndShape.Size.width - pedalMarkingMarginXOffset;
                                                                                  
                                                                                  
                                                                                  src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts on lines 1377..1390

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

                                                                                  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(otherPedalMarking.EndsStave){
                                                                                                  otherPedalStopX = otherPedalEndBBox.AbsolutePosition.x + otherPedalEndBBox.Size.width - otherPedalMarkingMarginXOffset;
                                                                                              } else {
                                                                                                switch (pedalMarking.style) {
                                                                                                  case PEDAL_STYLES_ENUM.BRACKET_OPEN_END:
                                                                                  src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts on lines 1308..1327

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

                                                                                  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 (this.rules.DefaultVexFlowNoteFont?.toLowerCase() === "petaluma") {
                                                                                        (Vex.Flow as any).DEFAULT_FONT_STACK = [(Vex.Flow as any).Fonts?.Petaluma, (Vex.Flow as any).Fonts?.Gonville, (Vex.Flow as any).Fonts?.Bravura];
                                                                                      }
                                                                                  src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts on lines 85..89
                                                                                  src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetDrawer.ts on lines 61..63

                                                                                  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

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

                                                                                      if (this.rules.DefaultVexFlowNoteFont?.toLowerCase() === "gonville") {
                                                                                        (Vex.Flow as any).DEFAULT_FONT_STACK = [(Vex.Flow as any).Fonts?.Gonville, (Vex.Flow as any).Fonts?.Bravura, (Vex.Flow as any).Fonts?.Custom];
                                                                                      } else if (this.rules.DefaultVexFlowNoteFont?.toLowerCase() === "petaluma") {
                                                                                        (Vex.Flow as any).DEFAULT_FONT_STACK = [(Vex.Flow as any).Fonts?.Petaluma, (Vex.Flow as any).Fonts?.Gonville, (Vex.Flow as any).Fonts?.Bravura];
                                                                                      }
                                                                                  src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts on lines 87..89
                                                                                  src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetDrawer.ts on lines 61..63

                                                                                  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

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

                                                                                                      if (index >= 0) {
                                                                                                        // save Voice Entry in gliss and then remove it from array of open glissandi
                                                                                                        const gGliss: GraphicalGlissando = openGlissandi[index];
                                                                                                        if (gGliss.staffEntries.indexOf(graphicalStaffEntry) === -1) {
                                                                                                          gGliss.staffEntries.push(graphicalStaffEntry);
                                                                                  src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts on lines 1763..1771

                                                                                  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

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

                                                                                                        if (index >= 0) {
                                                                                                          // save Voice Entry in VFSlur and then remove it from array of open VFSlurs
                                                                                                          const gSlur: GraphicalSlur = openGraphicalSlurs[index];
                                                                                                          if (gSlur.staffEntries.indexOf(graphicalStaffEntry) === -1) {
                                                                                                            gSlur.staffEntries.push(graphicalStaffEntry);
                                                                                  src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts on lines 1859..1866

                                                                                  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

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

                                                                                        if (staffEntry.LyricsEntries.length > 0 && this.rules.RenderLyrics) {
                                                                                          newElongationFactorForMeasureWidth =
                                                                                            this.calculateElongationFactor(
                                                                                              staffEntry.LyricsEntries,
                                                                                              staffEntry,
                                                                                  src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts on lines 535..547

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

                                                                                  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 (staffEntry.graphicalChordContainers.length > 0 && this.rules.RenderChordSymbols) {
                                                                                          newElongationFactorForMeasureWidth =
                                                                                            this.calculateElongationFactor(
                                                                                              staffEntry.graphicalChordContainers,
                                                                                              staffEntry,
                                                                                  src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts on lines 522..534

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

                                                                                  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 (lastNote.graphicalVoiceEntries.length === 1 &&
                                                                                                lastNote.graphicalVoiceEntries[0].notes.length === 1 &&
                                                                                                lastNote.graphicalVoiceEntries[0].notes[0].sourceNote.isWholeMeasureNote()
                                                                                              ) {
                                                                                                // also draw octaveshift until end of measure if we have a whole note that goes over the whole measure
                                                                                  src/MusicalScore/Graphical/VexFlow/VexFlowGraphicalSymbolFactory.ts on lines 195..204

                                                                                  Duplicated Code

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

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

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

                                                                                  Tuning

                                                                                  This issue has a mass of 69.

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

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

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

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

                                                                                  Refactorings

                                                                                  Further Reading

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

                                                                                    public indexOfGraphicalGlissFromGliss(gGlissandi: GraphicalGlissando[], glissando: Glissando): number {
                                                                                      for (let glissIndex: number = 0; glissIndex < gGlissandi.length; glissIndex++) {
                                                                                        if (gGlissandi[glissIndex].Glissando === glissando) {
                                                                                          return glissIndex;
                                                                                        }
                                                                                  src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts on lines 1657..1664

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

                                                                                  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

                                                                                    public findIndexGraphicalSlurFromSlur(gSlurs: GraphicalSlur[], slur: Slur): number {
                                                                                      for (let slurIndex: number = 0; slurIndex < gSlurs.length; slurIndex++) {
                                                                                        if (gSlurs[slurIndex].slur === slur) {
                                                                                          return slurIndex;
                                                                                        }
                                                                                  src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts on lines 1665..1672

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

                                                                                  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 (startNote && startNote.vfnote && startNote.vfnote.length >= 2) {
                                                                                        vfStartNote = startNote.vfnote[0];
                                                                                        startNoteIndexInTie = startNote.vfnote[1];
                                                                                      }
                                                                                  src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts on lines 659..662

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

                                                                                  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 (endNote && endNote.vfnote && endNote.vfnote.length >= 2) {
                                                                                        vfEndNote = endNote.vfnote[0];
                                                                                        endNoteIndexInTie = endNote.vfnote[1];
                                                                                      }
                                                                                  src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts on lines 652..655

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

                                                                                  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

                                                                                    protected handleTiedGraphicalNote(tiedGraphicalNote: GraphicalNote, beams: Beam[], activeClef: ClefInstruction,
                                                                                                                      octaveShiftValue: OctaveEnum, graphicalStaffEntry: GraphicalStaffEntry, duration: Fraction,
                                                                                                                      openTie: Tie, isLastTieNote: boolean): void {
                                                                                      return;
                                                                                    }
                                                                                  src/MusicalScore/Graphical/MusicSheetCalculator.ts on lines 402..406

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

                                                                                      if (startMeasure.MeasureNumber < minMeasureToDrawIndex + 1) { // octaveshift starts before range of measures selected to render
                                                                                        startMeasure = this.graphicalMusicSheet.MeasureList[minMeasureToDrawIndex][staffIndex]; // first rendered measure
                                                                                      }
                                                                                  src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts on lines 1120..1122

                                                                                  Duplicated Code

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

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

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

                                                                                  Tuning

                                                                                  This issue has a mass of 46.

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

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

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

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

                                                                                  Refactorings

                                                                                  Further Reading

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

                                                                                      if (startMeasure.MeasureNumber < minMeasureToDrawIndex + 1) { //  starts before range of measures selected to render
                                                                                        startMeasure = this.graphicalMusicSheet.MeasureList[minMeasureToDrawIndex][staffIndex]; // first rendered measure
                                                                                      }
                                                                                  src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts on lines 923..925

                                                                                  Duplicated Code

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

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

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

                                                                                  Tuning

                                                                                  This issue has a mass of 46.

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

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

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

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

                                                                                  Refactorings

                                                                                  Further Reading

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

                                                                                              stopX = endVfVoiceEntry.parentStaffEntry.parentMeasure.PositionAndShape.AbsolutePosition.x +
                                                                                                endVfVoiceEntry.parentStaffEntry.parentMeasure.PositionAndShape.Size.width - pedalMarkingMarginXOffset;
                                                                                  src/MusicalScore/Graphical/MusicSheetCalculator.ts on lines 3242..3243

                                                                                  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