opensheetmusicdisplay/opensheetmusicdisplay

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

Summary

Maintainability
B
6 hrs
Test Coverage

Function calculateXPosition has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    public calculateXPosition(): void {
        const stave: VF.Stave = (this.parentMeasure as VexFlowMeasure).getVFStave();

        // sets the vexflow x positions back into the bounding boxes of the staff entries in the osmd object model.
        // The positions are needed for cursor placement and mouse/tap interactions
Severity: Minor
Found in src/MusicalScore/Graphical/VexFlow/VexFlowStaffEntry.ts - About 3 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 calculateXPosition has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public calculateXPosition(): void {
        const stave: VF.Stave = (this.parentMeasure as VexFlowMeasure).getVFStave();

        // sets the vexflow x positions back into the bounding boxes of the staff entries in the osmd object model.
        // The positions are needed for cursor placement and mouse/tap interactions
Severity: Minor
Found in src/MusicalScore/Graphical/VexFlow/VexFlowStaffEntry.ts - About 1 hr to fix

    Function calculateModifierXOffsets has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        private calculateModifierXOffsets(staffLines: number[], collisionDistance: number): number[] {
            const offsets: number[] = [];
            for (let i: number = 0; i < staffLines.length; i++) {
                let offset: number = 0;
                let collisionFound: boolean = true;
    Severity: Minor
    Found in src/MusicalScore/Graphical/VexFlow/VexFlowStaffEntry.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 setMaxAccidentals has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public setMaxAccidentals(): number {
            for (const gve of this.graphicalVoiceEntries) {
                for (const note of gve.notes) {
                    if (note.DrawnAccidental !== AccidentalEnum.NONE) {
                        //TODO continue checking for double accidentals in other notes?
    Severity: Minor
    Found in src/MusicalScore/Graphical/VexFlow/VexFlowStaffEntry.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

    There are no issues that match your filters.

    Category
    Status