Seanitzel/Note-Art

View on GitHub

Showing 8 of 10 total issues

Score has 29 functions (exceeds 20 allowed). Consider refactoring.
Open

export class Score {
  measureSize: number;
  timeSignature: [number, number];

  constructor({ bpm, timeSignature, name, voiceNames = [] }: ScoreProps = {}) {
Severity: Minor
Found in src/notation/Score.ts - About 3 hrs to fix

    Measure has 21 functions (exceeds 20 allowed). Consider refactoring.
    Open

    export class Measure {
      _duration: string;
    
      constructor(maxDuration = 64) {
        this._maxDuration = maxDuration;
    Severity: Minor
    Found in src/notation/Measure.ts - About 2 hrs to fix

      Function pitchClassesToPianoChordNotes has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

      export function pitchClassesToPianoChordNotes(pitchClasses: Array<PitchClass>, octave: number, inversion = 0): Array<Note> {
        if(inversion) {
          pitchClasses = rearrangeArray(pitchClasses, inversion) as Array<PitchClass>;
        }
        let currentOctave = octave;
      Severity: Minor
      Found in src/utilities/MusicFunctions.ts - About 2 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 transposePitchClass has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      export function transposePitchClass(pitchClass: PitchClass, interval: number): PitchClass {
        const normalizedInterval = interval % NUMBER_OF_PITCH_CLASSES;
        const normalizedPitchClass: PitchClass = normalizePitchClass(pitchClass);
        const classSet = getClassSet(pitchClass);
        const classIndex = getPitchClassSet(classSet).indexOf(normalizedPitchClass);
      Severity: Minor
      Found in src/Theory.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 normalizePitchClass has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      export function normalizePitchClass(pc: PitchClass): PitchClass {
        const pitchLetter: PitchClassLetter = firstToUpper(pc[0]) as PitchClassLetter;
        const accidental: Accidental = pc[1] as Accidental;
      
        let times, index, accurateIndex;
      Severity: Minor
      Found in src/utilities/PureMusicUtils.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 pitchClassesToPianoChordNotes has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function pitchClassesToPianoChordNotes(pitchClasses: Array<PitchClass>, octave: number, inversion = 0): Array<Note> {
        if(inversion) {
          pitchClasses = rearrangeArray(pitchClasses, inversion) as Array<PitchClass>;
        }
        let currentOctave = octave;
      Severity: Minor
      Found in src/utilities/MusicFunctions.ts - About 1 hr to fix

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

        export function mapString(str: string, toMap: string, mapTo: string): string {
          while (str.includes(toMap)) {
            const length = str.length;
            for(let i = 0; i < length; ++i) {
              if(str.substring(i, i + toMap.length) === toMap) {
        Severity: Minor
        Found in src/utilities/GeneralFunctions.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 normalizeNote has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        export function normalizeNote(note: Note): Note {
          const { pitchClass, octave } = noteToObject(note);
          const normalizedPitchClass = normalizePitchClass(pitchClass);
          let octaveDifference = 0;
          const bWithSharps = pitchClass[0] === 'B' && pitchClass.includes('#' || 'x');
        Severity: Minor
        Found in src/utilities/PureMusicUtils.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