opensheetmusicdisplay/opensheetmusicdisplay

View on GitHub

Showing 1,026 of 1,574 total issues

Function readExpressionParameters has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
Open

    public readExpressionParameters(xmlNode: IXmlElement, currentInstrument: Instrument, divisions: number,
                                    inSourceMeasureCurrentFraction: Fraction,
                                    inSourceMeasureFormerFraction: Fraction,
                                    currentMeasureIndex: number,
                                    ignoreDivisionsOffset: boolean): void {
Severity: Minor
Found in src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.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 read has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring.
Open

  public read(noteNode: IXmlElement, noteDuration: Fraction, typeDuration: Fraction, noteTypeXml: NoteType, normalNotes: number, restNote: boolean,
              parentStaffEntry: SourceStaffEntry, parentMeasure: SourceMeasure,
              measureStartAbsoluteTimestamp: Fraction, maxTieNoteFraction: Fraction, chord: boolean, octavePlusOne: boolean,
              printObject: boolean, isCueNote: boolean, isGraceNote: boolean, stemDirectionXml: StemDirectionType, tremoloInfo: TremoloInfo,
              stemColorXml: string, noteheadColorXml: string, vibratoStrokes: boolean,
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

Function setTempoAndTempoType has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring.
Open

    private setTempoAndTempoType(soundTempo: number): void {
        if (!this.label) {
            this.tempoInBpm = soundTempo;
            this.tempoEnum = TempoEnum.metronomeMark;
            return;

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

StaveNote has 64 functions (exceeds 20 allowed). Consider refactoring.
Open

export class StaveNote extends StemmableNote {
  static get CATEGORY() { return 'stavenotes'; }
  static get STEM_UP() { return Stem.UP; }
  static get STEM_DOWN() { return Stem.DOWN; }
  static get DEFAULT_LEDGER_LINE_OFFSET() { return 3; }
Severity: Major
Found in src/VexFlowPatch/src/stavenote.js - About 1 day to fix

    File BoundingBox.ts has 555 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import log from "loglevel";
    import {ArgumentOutOfRangeException} from "../Exceptions";
    import {PointF2D} from "../../Common/DataObjects/PointF2D";
    import {SizeF2D} from "../../Common/DataObjects/SizeF2D";
    import {RectangleF2D} from "../../Common/DataObjects/RectangleF2D";
    Severity: Major
    Found in src/MusicalScore/Graphical/BoundingBox.ts - About 1 day to fix

      File MusicPartManagerIterator.ts has 552 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import {Fraction} from "../../Common/DataObjects/Fraction";
      import {Repetition} from "../MusicSource/Repetition";
      import {DynamicsContainer} from "../VoiceData/HelperObjects/DynamicsContainer";
      import {MappingSourceMusicPart} from "../MusicSource/MappingSourceMusicPart";
      import {SourceMeasure} from "../VoiceData/SourceMeasure";
      Severity: Major
      Found in src/MusicalScore/MusicParts/MusicPartManagerIterator.ts - About 1 day to fix

        File MusicSheetDrawer.ts has 541 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import {EngravingRules} from "./EngravingRules";
        import {ITextMeasurer} from "../Interfaces/ITextMeasurer";
        import {GraphicalMusicSheet} from "./GraphicalMusicSheet";
        import {BoundingBox} from "./BoundingBox";
        import {GraphicalLayers, OutlineAndFillStyleEnum} from "./DrawingEnums";
        Severity: Major
        Found in src/MusicalScore/Graphical/MusicSheetDrawer.ts - About 1 day to fix

          Function calculateCurve has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
          Open

              public calculateCurve(rules: EngravingRules): void {
          
                  // single GraphicalSlur means a single Curve, eg each GraphicalSlurObject is meant to be on the same StaffLine
                  // a Slur can span more than one GraphicalSlurObjects
                  const startStaffEntry: GraphicalStaffEntry = this.staffEntries[0];
          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 addTuplet has 221 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            private addTuplet(node: IXmlElement, tupletNodeList: IXmlElement[]): number {
              let bracketed: boolean = false; // true if bracket=yes given, otherwise false
              let bracketedXmlValue: boolean = undefined; // Exact xml bracket value given: true for bracket=yes, false for bracket=no, undefined if not given.
              // TODO refactor this to not duplicate lots of code for the cases tupletNodeList.length == 1 and > 1
              if (tupletNodeList !== undefined && tupletNodeList.length > 1) {
          Severity: Major
          Found in src/MusicalScore/ScoreIO/VoiceGenerator.ts - About 1 day to fix

            Function calculateMusicSystems has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
            Open

                protected calculateMusicSystems(): void {
                    if (!this.graphicalMusicSheet.MeasureList) {
                        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 graphicalMeasureCreatedCalculations has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
            Open

                public graphicalMeasureCreatedCalculations(): void {
                    for (let idx: number = 0, len: number = this.staffEntries.length; idx < len; ++idx) {
                        const graphicalStaffEntry: VexFlowStaffEntry = (this.staffEntries[idx] as VexFlowStaffEntry);
            
                        // create vex flow Notes:
            Severity: Minor
            Found in src/MusicalScore/Graphical/VexFlow/VexFlowTabMeasure.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 removeRedundantInstructions has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
            Open

              public removeRedundantInstructions(): void {
                let segnoCount: number = 0;
                let codaCount: number = 0;
                //const fineCount: number = 0;
                let toCodaCount: number = 0;

            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

            BoundingBox has 60 functions (exceeds 20 allowed). Consider refactoring.
            Open

            export class BoundingBox {
                protected isSymbol: boolean = false;
                protected relativePositionHasBeenSet: boolean = false;
                protected xBordersHaveBeenSet: boolean = false;
                protected yBordersHaveBeenSet: boolean = false;
            Severity: Major
            Found in src/MusicalScore/Graphical/BoundingBox.ts - About 1 day to fix

              Function calculateCurve has 216 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public calculateCurve(rules: EngravingRules): void {
              
                      // single GraphicalSlur means a single Curve, eg each GraphicalSlurObject is meant to be on the same StaffLine
                      // a Slur can span more than one GraphicalSlurObjects
                      const startStaffEntry: GraphicalStaffEntry = this.staffEntries[0];
              Severity: Major
              Found in src/MusicalScore/Graphical/GraphicalSlur.ts - About 1 day to fix

                Function addAbstractInstruction has 214 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  private addAbstractInstruction(attrNode: IXmlElement, guitarPro: boolean, previousNode: IXmlElement, currentFraction: Fraction): void {
                    if (attrNode.element("divisions")) {
                      if (attrNode.elements().length === 1) {
                        return;
                      }
                Severity: Major
                Found in src/MusicalScore/ScoreIO/InstrumentReader.ts - About 1 day to fix

                  Function addArticulationExpression has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
                  Open

                    public addArticulationExpression(node: IXmlElement, currentVoiceEntry: VoiceEntry): void {
                      if (node !== undefined && node.elements().length > 0) {
                        const childNodes: IXmlElement[] = node.elements();
                        for (let idx: number = 0, len: number = childNodes.length; idx < len; ++idx) {
                          const childNode: IXmlElement = childNodes[idx];
                  Severity: Minor
                  Found in src/MusicalScore/ScoreIO/MusicSymbolModules/ArticulationReader.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 svgcontext.js has 505 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  // [VexFlow](http://vexflow.com) - Copyright (c) Mohit Muthanna 2010.
                  // @author Gregory Ristow (2015)
                  
                  import { Vex } from './vex';
                  
                  
                  Severity: Major
                  Found in src/VexFlowPatch/src/svgcontext.js - About 1 day to fix

                    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

                    File SourceMeasure.ts has 503 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import {Fraction} from "../../Common/DataObjects/Fraction";
                    import {VerticalSourceStaffEntryContainer} from "./VerticalSourceStaffEntryContainer";
                    import {SourceStaffEntry} from "./SourceStaffEntry";
                    import {RepetitionInstruction, RepetitionInstructionEnum, AlignmentType} from "./Instructions/RepetitionInstruction";
                    import {Staff} from "./Staff";
                    Severity: Major
                    Found in src/MusicalScore/VoiceData/SourceMeasure.ts - About 1 day to fix

                      Note has 56 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      export class Note {
                      
                          constructor(voiceEntry: VoiceEntry, parentStaffEntry: SourceStaffEntry, length: Fraction, pitch: Pitch, sourceMeasure: SourceMeasure, isRest?: boolean) {
                              this.voiceEntry = voiceEntry;
                              this.parentStaffEntry = parentStaffEntry;
                      Severity: Major
                      Found in src/MusicalScore/VoiceData/Note.ts - About 1 day to fix
                        Severity
                        Category
                        Status
                        Source
                        Language