opensheetmusicdisplay/opensheetmusicdisplay

View on GitHub

Showing 1,025 of 1,573 total issues

File MusicSheetReader.ts has 917 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {MusicSheet} from "../MusicSheet";
import {SourceMeasure} from "../VoiceData/SourceMeasure";
import {Fraction} from "../../Common/DataObjects/Fraction";
import {InstrumentReader} from "./InstrumentReader";
import {IXmlElement} from "../../Common/FileIO/Xml";
Severity: Major
Found in src/MusicalScore/ScoreIO/MusicSheetReader.ts - About 2 days to fix

    Function autoBeamNotes has a Cognitive Complexity of 109 (exceeds 5 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: Minor
    Found in src/MusicalScore/Graphical/VexFlow/VexFlowMeasure.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

    File EngravingRules.ts has 892 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { PagePlacementEnum } from "./GraphicalMusicPage";
    //import {MusicSymbol} from "./MusicSymbol";
    import log from "loglevel";
    import { TextAlignmentEnum } from "../../Common/Enums/TextAlignment";
    import { PlacementEnum } from "../VoiceData/Expressions/AbstractExpression";
    Severity: Major
    Found in src/MusicalScore/Graphical/EngravingRules.ts - About 2 days to fix

      File stavenote.js has 876 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      // [VexFlow](http://vexflow.com) - Copyright (c) Mohit Muthanna 2010.
      //
      // ## Description
      // This file implements notes for standard notation. This consists of one or
      // more `NoteHeads`, an optional stem, and an optional flag.
      Severity: Major
      Found in src/VexFlowPatch/src/stavenote.js - About 2 days to fix

        Function readTitleAndComposerFromCreditsLegacy has a Cognitive Complexity of 104 (exceeds 5 allowed). Consider refactoring.
        Open

            private readTitleAndComposerFromCreditsLegacy(root: IXmlElement): void {
                const systemYCoordinates: number = this.computeSystemYCoordinates(root);
                if (systemYCoordinates === 0) {
                    return;
                }
        Severity: Minor
        Found in src/MusicalScore/ScoreIO/MusicSheetReader.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

        MusicSheetCalculator has 108 functions (exceeds 20 allowed). Consider refactoring.
        Open

        export abstract class MusicSheetCalculator {
            public static symbolFactory: IGraphicalSymbolFactory;
            public static transposeCalculator: ITransposeCalculator;
            public static stafflineNoteCalculator: IStafflineNoteCalculator;
            protected static textMeasurer: ITextMeasurer;
        Severity: Major
        Found in src/MusicalScore/Graphical/MusicSheetCalculator.ts - About 2 days to fix

          File GraphicalMusicSheet.ts has 852 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import {MusicSheet} from "../MusicSheet";
          import {SourceMeasure} from "../VoiceData/SourceMeasure";
          import {GraphicalMeasure} from "./GraphicalMeasure";
          import {GraphicalMusicPage} from "./GraphicalMusicPage";
          import {VerticalGraphicalStaffEntryContainer} from "./VerticalGraphicalStaffEntryContainer";
          Severity: Major
          Found in src/MusicalScore/Graphical/GraphicalMusicSheet.ts - About 2 days to fix

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

                private createGraphicalMeasure(sourceMeasure: SourceMeasure, openTuplets: Tuplet[], openBeams: Beam[],
                                               accidentalCalculator: AccidentalCalculator, activeClefs: ClefInstruction[],
                                               openOctaveShifts: OctaveShiftParams[], openLyricWords: LyricWord[], staffIndex: number,
                                               staffEntryLinks: StaffEntryLink[]): GraphicalMeasure {
                    const staff: Staff = this.graphicalMusicSheet.ParentMusicSheet.getStaffFromIndex(staffIndex);
            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 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 readNextXmlMeasure has 380 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              public readNextXmlMeasure(currentMeasure: SourceMeasure, measureStartAbsoluteTimestamp: Fraction, octavePlusOne: boolean): boolean {
                if (this.currentXmlMeasureIndex >= this.xmlMeasureList.length) {
                  return false;
                }
                this.currentMeasure = currentMeasure;
            Severity: Major
            Found in src/MusicalScore/ScoreIO/InstrumentReader.ts - About 1 day to fix

              File OpenSheetMusicDisplay.ts has 795 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import { IXmlElement } from "./../Common/FileIO/Xml";
              import { VexFlowMusicSheetCalculator } from "./../MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator";
              import { VexFlowBackend } from "./../MusicalScore/Graphical/VexFlow/VexFlowBackend";
              import { MusicSheetReader } from "./../MusicalScore/ScoreIO/MusicSheetReader";
              import { GraphicalMusicSheet } from "./../MusicalScore/Graphical/GraphicalMusicSheet";
              Severity: Major
              Found in src/OpenSheetMusicDisplay/OpenSheetMusicDisplay.ts - About 1 day to fix

                File ExpressionReader.ts has 785 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import {MusicSheet} from "../../MusicSheet";
                import {Fraction} from "../../../Common/DataObjects/Fraction";
                import {MultiTempoExpression} from "../../VoiceData/Expressions/MultiTempoExpression";
                import {ContDynamicEnum, ContinuousDynamicExpression} from "../../VoiceData/Expressions/ContinuousExpressions/ContinuousDynamicExpression";
                import {ContinuousTempoExpression} from "../../VoiceData/Expressions/ContinuousExpressions/ContinuousTempoExpression";
                Severity: Major
                Found in src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts - About 1 day to fix

                  Function setOptions has a Cognitive Complexity of 90 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public setOptions(options: IOSMDOptions): void {
                          if (!this.rules) {
                              this.rules = new EngravingRules();
                          }
                          if (!this.drawingParameters && !options.drawingParameters) {
                  Severity: Minor
                  Found in src/OpenSheetMusicDisplay/OpenSheetMusicDisplay.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 calculateFingerings has a Cognitive Complexity of 90 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public calculateFingerings(): void {
                          if (this.rules.FingeringPosition === PlacementEnum.Left ||
                              this.rules.FingeringPosition === PlacementEnum.Right) {
                                  return;
                          }
                  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 readTitleAndComposerFromCredits has a Cognitive Complexity of 89 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private readTitleAndComposerFromCredits(root: IXmlElement): void {
                          if (this.rules.SheetComposerSubtitleUseLegacyParsing) {
                              this.readTitleAndComposerFromCreditsLegacy(root);
                              return;
                          }
                  Severity: Minor
                  Found in src/MusicalScore/ScoreIO/MusicSheetReader.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 addSingleNote has a Cognitive Complexity of 89 (exceeds 5 allowed). Consider refactoring.
                  Open

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

                  Cognitive Complexity

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

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

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

                  Further reading

                  File index.js has 759 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import { OpenSheetMusicDisplay } from '../src/OpenSheetMusicDisplay/OpenSheetMusicDisplay';
                  import { BackendType } from '../src/OpenSheetMusicDisplay/OSMDOptions';
                  import * as jsPDF  from '../node_modules/jspdf/dist/jspdf.es.min';
                  import * as svg2pdf from '../node_modules/svg2pdf.js/dist/svg2pdf.umd.min';
                  import { TransposeCalculator } from '../src/Plugins/Transpose/TransposeCalculator';
                  Severity: Major
                  Found in demo/index.js - About 1 day to fix

                    Function finalizeBeams has a Cognitive Complexity of 87 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public finalizeBeams(): void {
                            // The following line resets the created Vex.Flow Beams and
                            // created them brand new. Is this needed? And more importantly,
                            // should the old beams be removed manually by the notes?
                            this.vfbeams = {};
                    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

                    Function loadDefaultValues has 347 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public loadDefaultValues(): void {
                            // global variables
                            this.SamplingUnit = EngravingRules.unit * 3;
                    
                            // Page Label Variables
                    Severity: Major
                    Found in src/MusicalScore/Graphical/EngravingRules.ts - About 1 day to fix
                      Severity
                      Category
                      Status
                      Source
                      Language