opensheetmusicdisplay/opensheetmusicdisplay

View on GitHub

Showing 1,025 of 1,573 total issues

Function hasOnlyRests has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public get hasOnlyRests(): boolean {
        for (const voiceEntry of this.voiceEntries) {
            for (const note of voiceEntry.Notes) {
                if (!note.isRest()) {
                    return false;
Severity: Minor
Found in src/MusicalScore/VoiceData/SourceStaffEntry.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

Function getNoteIndex has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public getNoteIndex(note: Note): number {
        for (let i: number = this.notes.length - 1; i >= 0; i--) {
            for (let j: number = 0; j < this.notes[i].length; j++) {
                if (note === this.notes[i][j]) {
                    return i;
Severity: Minor
Found in src/MusicalScore/VoiceData/Tuplet.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

Function getPlacementOfFirstEntry has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public getPlacementOfFirstEntry(): PlacementEnum {
        let placement: PlacementEnum = PlacementEnum.Above;
        if (this.expressions.length > 0) {
            if (this.expressions[0].expression instanceof InstantaneousDynamicExpression) {
                placement = (<InstantaneousDynamicExpression>(this.expressions[0].expression)).Placement;
Severity: Minor
Found in src/MusicalScore/VoiceData/Expressions/MultiExpression.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

Function addExpression has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public addExpression(abstractExpression: AbstractExpression, prefix: string): void {
        if (abstractExpression instanceof InstantaneousDynamicExpression) {
            if (this.instantaneousDynamic) {
                this.removeExpressionFromEntryList(this.InstantaneousDynamic);
            }
Severity: Minor
Found in src/MusicalScore/VoiceData/Expressions/MultiExpression.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

Function getFontstyleOfFirstEntry has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public getFontstyleOfFirstEntry(): FontStyles {
       let fontStyle: FontStyles = FontStyles.Regular;
       if (this.expressions.length > 0) {
           if (this.expressions[0].expression instanceof ContinuousDynamicExpression) {
            fontStyle = FontStyles.Italic;
Severity: Minor
Found in src/MusicalScore/VoiceData/Expressions/MultiExpression.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

Severity
Category
Status
Source
Language