opensheetmusicdisplay/opensheetmusicdisplay

View on GitHub
src/VexFlowPatch/src/keysignature.js

Summary

Maintainability
C
1 day
Test Coverage

Function accidentalSpacing has 58 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  static get accidentalSpacing() {
    return {
      '#': {
        above: 6,
        below: 4,
Severity: Major
Found in src/VexFlowPatch/src/keysignature.js - About 2 hrs to fix

    File keysignature.js has 257 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // [VexFlow](http://vexflow.com) - Copyright (c) Mohit Muthanna 2010.
    // Author: Cyril Silverman
    //
    // ## Description
    //
    Severity: Minor
    Found in src/VexFlowPatch/src/keysignature.js - About 2 hrs to fix

      Function convertAccLines has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

        convertAccLines(clef, type, accList = this.accList) {
          let offset = 0.0; // if clef === "treble"
          let customLines; // when clef doesn't follow treble key sig shape
      
          switch (clef) {
      Severity: Minor
      Found in src/VexFlowPatch/src/keysignature.js - 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 convertAccLines has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        convertAccLines(clef, type, accList = this.accList) {
          let offset = 0.0; // if clef === "treble"
          let customLines; // when clef doesn't follow treble key sig shape
      
          switch (clef) {
      Severity: Minor
      Found in src/VexFlowPatch/src/keysignature.js - About 1 hr to fix

        Function format has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

          format() {
            if (!this.stave) {
              throw new Vex.RERR('KeySignatureError', "Can't draw key signature without stave.");
            }
        
        
        Severity: Minor
        Found in src/VexFlowPatch/src/keysignature.js - 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 format has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          format() {
            if (!this.stave) {
              throw new Vex.RERR('KeySignatureError', "Can't draw key signature without stave.");
            }
        
        
        Severity: Minor
        Found in src/VexFlowPatch/src/keysignature.js - About 1 hr to fix

          Function draw has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

            draw() {
              if (!this.x) {
                throw new Vex.RERR('KeySignatureError', "Can't draw key signature without x.");
              }
          
          
          Severity: Minor
          Found in src/VexFlowPatch/src/keysignature.js - About 55 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 convertToGlyph has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

            convertToGlyph(acc, nextAcc) {
              const accGlyphData = Flow.accidentalCodes(acc.type);
              const glyph = new Glyph(accGlyphData.code, this.glyphFontScale);
          
              // Determine spacing between current accidental and the next accidental
          Severity: Minor
          Found in src/VexFlowPatch/src/keysignature.js - About 35 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 convertToCancelAccList has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

            convertToCancelAccList(spec) {
              // Get the accidental list for the cancelled key signature
              const cancel_accList = Flow.keySignature(spec);
          
              // If the cancelled key has a different accidental type, ie: # vs b
          Severity: Minor
          Found in src/VexFlowPatch/src/keysignature.js - 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