opensheetmusicdisplay/opensheetmusicdisplay

View on GitHub

Showing 1,026 of 1,574 total issues

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

    public finalizeTuplets(): void {
        // The following line resets the created VF Tuplets and
        // created them brand new. Is this needed? And more importantly,
        // should the old tuplets be removed manually from the notes?
        this.vftuplets = {};
Severity: Minor
Found in src/MusicalScore/Graphical/VexFlow/VexFlowMeasure.ts - About 6 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

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

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

    private checkIfRhythmInstructionsAreSetAndEqual(instrumentReaders: InstrumentReader[]): void {
        const rhythmInstructions: RhythmInstruction[] = [];
        for (let i: number = 0; i < this.completeNumberOfStaves; i++) {
            if (this.currentMeasure.FirstInstructionsStaffEntries[i]) {
                const last: AbstractNotationInstruction = this.currentMeasure.FirstInstructionsStaffEntries[i].Instructions[
Severity: Minor
Found in src/MusicalScore/ScoreIO/MusicSheetReader.ts - About 6 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

    public canBeReducedToMultiRest(): boolean {
        if (this.firstRepetitionInstructions.length > 0 || this.lastRepetitionInstructions.length > 0) {
            return false;
        }
        let allRestsOrInvisible: boolean = true;
Severity: Minor
Found in src/MusicalScore/VoiceData/SourceMeasure.ts - About 6 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

File formatter.js has 424 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// [VexFlow](http://vexflow.com) - Copyright (c) Mohit Muthanna 2010.
//
// ## Description
//
// This file implements the formatting and layout algorithms that are used
Severity: Minor
Found in src/VexFlowPatch/src/formatter.js - About 6 hrs to fix

    Function handleVoiceEntry has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
    Open

        protected handleVoiceEntry(voiceEntry: VoiceEntry, graphicalStaffEntry: GraphicalStaffEntry,
                                   accidentalCalculator: AccidentalCalculator, openLyricWords: LyricWord[],
                                   activeClef: ClefInstruction,
                                   openTuplets: Tuplet[], openBeams: Beam[],
                                   octaveShiftValue: OctaveEnum, staffIndex: number,
    Severity: Minor
    Found in src/MusicalScore/Graphical/MusicSheetCalculator.ts - About 6 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function positionNote has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
    Open

        public positionNote(graphicalNote: GraphicalNote): GraphicalNote {
            const staffIndex: number =
                    graphicalNote.parentVoiceEntry.parentStaffEntry.sourceStaffEntry.ParentStaff.idInMusicSheet;
    
            if (!(graphicalNote instanceof VexFlowGraphicalNote) || graphicalNote.sourceNote.isRest()
    Severity: Minor
    Found in src/MusicalScore/Graphical/VexFlow/VexflowStafflineNoteCalculator.ts - About 6 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function generateArticulations has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
    Open

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

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

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

          private autoBeamNotes(beamedNotes: StemmableNote[]): void {
              if (!this.rules.AutoBeamTabs && this.isTabMeasure) { // could also use an option tabBeams to disable beams there completely
                  return;
              }
              let autoBeamId: number = 60; // start with 60 to not collide (ids) with xml beams
      Severity: Major
      Found in src/MusicalScore/Graphical/VexFlow/VexFlowMeasure.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 drawMusicSystemComponents has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
          Open

              protected drawMusicSystemComponents(musicSystem: MusicSystem, systemBoundingBoxInPixels: RectangleF2D,
                                                  absBoundingRectWithMargin: RectangleF2D): void {
                  const selectStartSymb: SelectionStartSymbol = this.graphicalMusicSheet.SelectionStartSymbol;
                  const selectEndSymb: SelectionEndSymbol = this.graphicalMusicSheet.SelectionEndSymbol;
                  if (this.drawingParameters.drawSelectionStartSymbol) {
          Severity: Minor
          Found in src/MusicalScore/Graphical/MusicSheetDrawer.ts - About 5 hrs to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function createExpressionFromString has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
          Open

              private createExpressionFromString(prefix: string, stringTrimmed: string,
                                                 currentMeasure: SourceMeasure, inSourceMeasureCurrentFraction, inputString: string,
                                                 fontStyle: FontStyles,
                                                 fontColor: string,
                                                 defaultYXml: number = undefined): boolean {
          Severity: Minor
          Found in src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts - About 5 hrs to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function addOctaveShift has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
          Open

              public addOctaveShift(directionNode: IXmlElement, currentMeasure: SourceMeasure, endTimestamp: Fraction): void {
                  let octaveStaffNumber: number = 1;
                  const staffNode: IXmlElement = directionNode.element("staff");
                  if (staffNode) {
                      try {
          Severity: Minor
          Found in src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts - About 5 hrs to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          MusicPartManagerIterator has 43 functions (exceeds 20 allowed). Consider refactoring.
          Open

          export class MusicPartManagerIterator {
              constructor(musicSheet: MusicSheet, startTimestamp?: Fraction, endTimestamp?: Fraction) {
                  try {
                      this.frontReached = true;
                      this.musicSheet = musicSheet;
          Severity: Minor
          Found in src/MusicalScore/MusicParts/MusicPartManagerIterator.ts - About 5 hrs to fix

            OpenSheetMusicDisplay has 43 functions (exceeds 20 allowed). Consider refactoring.
            Open

            export class OpenSheetMusicDisplay {
                protected version: string = "1.8.8-dev"; // getter: this.Version
                // at release, bump version and change to -release, afterwards to -dev again
            
                /**
            Severity: Minor
            Found in src/OpenSheetMusicDisplay/OpenSheetMusicDisplay.ts - About 5 hrs to fix

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

                  public static readChordSymbol(xmlNode: IXmlElement, musicSheet: MusicSheet, activeKey: KeyInstruction): ChordSymbolContainer {
                      const root: IXmlElement = xmlNode.element("root");
                      const kind: IXmlElement = xmlNode.element("kind");
                      const kindText: IXmlAttribute = kind.attribute("text");
              
              
              Severity: Minor
              Found in src/MusicalScore/ScoreIO/MusicSymbolModules/ChordSymbolReader.ts - About 5 hrs to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

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

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

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

              File VoiceEntry.ts has 406 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import {Fraction} from "../../Common/DataObjects/Fraction";
              import {Voice} from "./Voice";
              import {SourceStaffEntry} from "./SourceStaffEntry";
              import {Note} from "./Note";
              import {Pitch} from "../../Common/DataObjects/Pitch";
              Severity: Minor
              Found in src/MusicalScore/VoiceData/VoiceEntry.ts - About 5 hrs to fix

                MusicSystemBuilder has 42 functions (exceeds 20 allowed). Consider refactoring.
                Open

                export class MusicSystemBuilder {
                    protected measureList: GraphicalMeasure[][];
                    protected graphicalMusicSheet: GraphicalMusicSheet;
                    protected currentSystemParams: SystemBuildParameters;
                    protected numberOfVisibleStaffLines: number;
                Severity: Minor
                Found in src/MusicalScore/Graphical/MusicSystemBuilder.ts - About 5 hrs to fix
                  Severity
                  Category
                  Status
                  Source
                  Language