opensheetmusicdisplay/opensheetmusicdisplay

View on GitHub

Showing 1,025 of 1,573 total issues

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

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

    Function init has 333 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function init() {
            var name, option;
    
            // Handle window parameter
            var paramEmbedded = findGetParameter('embedded');
    Severity: Major
    Found in demo/index.js - About 1 day to fix

      MusicSheet has 86 functions (exceeds 20 allowed). Consider refactoring.
      Open

      export class MusicSheet /*implements ISettableMusicSheet, IComparable<MusicSheet>*/ {
          constructor() {
              this.playbackSettings = new PlaybackSettings();
              // FIXME?
              // initialize SheetPlaybackSetting with default values
      Severity: Major
      Found in src/MusicalScore/MusicSheet.ts - About 1 day to fix

        Function calculateStartAndEnd has a Cognitive Complexity of 80 (exceeds 5 allowed). Consider refactoring.
        Open

            private calculateStartAndEnd(   slurStartNote: GraphicalNote,
                                            slurEndNote: GraphicalNote,
                                            staffLine: StaffLine,
                                            rules: EngravingRules,
                                            skyBottomLineCalculator: SkyBottomLineCalculator): {startX: number, startY: number, endX: number, endY: number} {
        Severity: Minor
        Found in src/MusicalScore/Graphical/GraphicalSlur.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 calculateTupletNumbers has a Cognitive Complexity of 72 (exceeds 5 allowed). Consider refactoring.
        Open

            protected calculateTupletNumbers(): void {
                if (!this.rules.TupletNumberLimitConsecutiveRepetitions) {
                    return;
                }
                let currentTupletNumber: number = -1;
        Severity: Minor
        Found in src/MusicalScore/Graphical/MusicSheetCalculator.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 calculateTempoExpressionsForMultiTempoExpression has a Cognitive Complexity of 71 (exceeds 5 allowed). Consider refactoring.
        Open

            protected calculateTempoExpressionsForMultiTempoExpression(sourceMeasure: SourceMeasure, multiTempoExpression: MultiTempoExpression,
                                                                       measureIndex: number): void {
                // calculate absolute Timestamp
                const absoluteTimestamp: Fraction = Fraction.plus(sourceMeasure.AbsoluteTimestamp, multiTempoExpression.Timestamp);
                const measures: GraphicalMeasure[] = this.graphicalMusicSheet.MeasureList[measureIndex];
        Severity: Minor
        Found in src/MusicalScore/Graphical/MusicSheetCalculator.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

        File beam.js has 634 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        // [VexFlow](http://vexflow.com) - Copyright (c) Mohit Muthanna 2010.
        //
        // ## Description
        //
        // This file implements `Beams` that span over a set of `StemmableNotes`.
        Severity: Major
        Found in src/VexFlowPatch/src/beam.js - About 1 day to fix

          Function color has a Cognitive Complexity of 70 (exceeds 5 allowed). Consider refactoring.
          Open

              public color(): void {
                  const defaultColorNotehead: string = this.rules.DefaultColorNotehead;
                  const defaultColorRest: string = this.rules.DefaultColorRest;
                  const defaultColorStem: string = this.rules.DefaultColorStem;
                  const transparentColor: string = "#00000000"; // transparent color in vexflow
          Severity: Minor
          Found in src/MusicalScore/Graphical/VexFlow/VexFlowVoiceEntry.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 calculateGraphicalContinuousDynamic has 275 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public calculateGraphicalContinuousDynamic(graphicalContinuousDynamic: GraphicalContinuousDynamicExpression, startPosInStaffline: PointF2D): void {
                  const isSoftAccent: boolean = graphicalContinuousDynamic.IsSoftAccent;
                  const staffIndex: number = graphicalContinuousDynamic.ParentStaffLine.ParentStaff.idInMusicSheet;
                  // TODO: Previously the staffIndex was passed down. BUT you can (and this function actually does this) get it from
                  // the musicSystem OR from the ParentStaffLine. Is this the same index?
          Severity: Major
          Found in src/MusicalScore/Graphical/MusicSheetCalculator.ts - About 1 day to fix

            Function handleLineRepetitionInstructions has a Cognitive Complexity of 69 (exceeds 5 allowed). Consider refactoring.
            Open

              public handleLineRepetitionInstructions(barlineNode: IXmlElement): boolean {
                let pieceEndingDetected: boolean = false;
                if (barlineNode.elements().length > 0) {
                  let location: string = "";
                  let hasRepeat: boolean = false;

            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

            GraphicalMusicSheet has 73 functions (exceeds 20 allowed). Consider refactoring.
            Open

            export class GraphicalMusicSheet {
                constructor(musicSheet: MusicSheet, calculator: MusicSheetCalculator) {
                    this.musicSheet = musicSheet;
                    this.numberOfStaves = this.musicSheet.Staves.length;
                    this.calculator = calculator;
            Severity: Major
            Found in src/MusicalScore/Graphical/GraphicalMusicSheet.ts - About 1 day to fix

              Function createGraphicalTies has a Cognitive Complexity of 68 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected createGraphicalTies(): void {
                      for (let measureIndex: number = 0; measureIndex < this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length; measureIndex++) {
                          const sourceMeasure: SourceMeasure = this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures[measureIndex];
                          for (let staffIndex: number = 0; staffIndex < sourceMeasure.CompleteNumberOfStaves; staffIndex++) {
                              for (let j: number = 0; j < sourceMeasure.VerticalSourceStaffEntryContainers.length; j++) {
              Severity: Minor
              Found in src/MusicalScore/Graphical/MusicSheetCalculator.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 addSlur has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
              Open

                  public addSlur(slurNodes: IXmlElement[], currentNote: Note): void {
                      try {
                          if (slurNodes) {
                              for (const slurNode of slurNodes) {
                                  if (slurNode.attributes().length > 0) {
              Severity: Minor
              Found in src/MusicalScore/ScoreIO/MusicSymbolModules/SlurReader.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

              File GraphicalSlur.ts has 604 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              
              import { PointF2D } from "../../Common/DataObjects/PointF2D";
              import { GraphicalNote } from "./GraphicalNote";
              import { GraphicalCurve } from "./GraphicalCurve";
              import { Slur } from "../VoiceData/Expressions/ContinuousExpressions/Slur";
              Severity: Major
              Found in src/MusicalScore/Graphical/GraphicalSlur.ts - About 1 day to fix

                Function graphicalMeasureCreatedCalculations has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring.
                Open

                    public graphicalMeasureCreatedCalculations(): void {
                        let graceSlur: boolean;
                        let graceGVoiceEntriesBefore: GraphicalVoiceEntry[] = [];
                        const graveGVoiceEntriesAdded: GraphicalVoiceEntry[] = [];
                        for (const graphicalStaffEntry of this.staffEntries as VexFlowStaffEntry[]) {
                Severity: Minor
                Found in src/MusicalScore/Graphical/VexFlow/VexFlowMeasure.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

                Stave has 67 functions (exceeds 20 allowed). Consider refactoring.
                Open

                export class Stave extends Element {
                  constructor(x, y, width, options) {
                    super();
                    this.setAttribute('type', 'Stave');
                
                
                Severity: Major
                Found in src/VexFlowPatch/src/stave.js - About 1 day to fix

                  Function setOptions has 244 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public setOptions(options: IOSMDOptions): void {
                          if (!this.rules) {
                              this.rules = new EngravingRules();
                          }
                          if (!this.drawingParameters && !options.drawingParameters) {
                  Severity: Major
                  Found in src/OpenSheetMusicDisplay/OpenSheetMusicDisplay.ts - About 1 day to fix

                    File stave.js has 573 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    // [VexFlow](http://vexflow.com) - Copyright (c) Mohit Muthanna 2010.
                    
                    import { Vex } from './vex';
                    import { Element } from './element';
                    import { Flow } from './tables';
                    Severity: Major
                    Found in src/VexFlowPatch/src/stave.js - About 1 day to fix

                      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

                      Severity
                      Category
                      Status
                      Source
                      Language