Showing 1,568 of 1,568 total issues
File MusicSheetCalculator.ts
has 2828 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { GraphicalStaffEntry } from "./GraphicalStaffEntry";
import { StaffLine } from "./StaffLine";
import { GraphicalMusicSheet } from "./GraphicalMusicSheet";
import { EngravingRules } from "./EngravingRules";
import { Tie } from "../VoiceData/Tie";
Function readNextXmlMeasure
has a Cognitive Complexity of 263 (exceeds 5 allowed). Consider refactoring. Open
public readNextXmlMeasure(currentMeasure: SourceMeasure, measureStartAbsoluteTimestamp: Fraction, octavePlusOne: boolean): boolean {
if (this.currentXmlMeasureIndex >= this.xmlMeasureList.length) {
return false;
}
this.currentMeasure = currentMeasure;
- Read upRead up
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 a Cognitive Complexity of 252 (exceeds 5 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) {
- Read upRead up
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 StaveNote
has a Cognitive Complexity of 245 (exceeds 5 allowed). Consider refactoring. Open
public static StaveNote(gve: GraphicalVoiceEntry): VF.StaveNote {
// if (gve.octaveShiftValue !== OctaveEnum.NONE) { // gves with accidentals in octave shift brackets can be unsorted
gve.sortForVexflow(); // also necessary for some other cases, see test_sorted_notes... sample
// sort and reverse replace the array anyways, so we might as well directly sort them reversely for now.
// otherwise we should copy the array, see the commented GraphicalVoiceEntry.sortedNotesCopyForVexflow()
- Read upRead up
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 VexFlowMusicSheetCalculator.ts
has 1432 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { MusicSheetCalculator } from "../MusicSheetCalculator";
import { VexFlowGraphicalSymbolFactory } from "./VexFlowGraphicalSymbolFactory";
import { GraphicalMeasure } from "../GraphicalMeasure";
import { StaffLine } from "../StaffLine";
import { SkyBottomLineBatchCalculator } from "../SkyBottomLineBatchCalculator";
File VexFlowMeasure.ts
has 1288 lines of code (exceeds 250 allowed). Consider refactoring. Open
import Vex from "vexflow";
import VF = Vex.Flow;
import {GraphicalMeasure} from "../GraphicalMeasure";
import {SourceMeasure} from "../../VoiceData/SourceMeasure";
import {Staff} from "../../VoiceData/Staff";
File InstrumentReader.ts
has 1238 lines of code (exceeds 250 allowed). Consider refactoring. Open
import {Instrument} from "../Instrument";
import {MusicSheet} from "../MusicSheet";
import {VoiceGenerator} from "./VoiceGenerator";
import {Staff} from "../VoiceData/Staff";
import {SourceMeasure} from "../VoiceData/SourceMeasure";
Function saveAbstractInstructionList
has a Cognitive Complexity of 151 (exceeds 5 allowed). Consider refactoring. Open
private saveAbstractInstructionList(numberOfStaves: number, beginOfMeasure: boolean): void {
for (let i: number = this.abstractInstructions.length - 1; i >= 0; i--) {
const instruction: [number, AbstractNotationInstruction, Fraction] = this.abstractInstructions[i];
const key: number = instruction[0]; // staffNumber
const value: AbstractNotationInstruction = instruction[1];
- Read upRead up
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 a Cognitive Complexity of 143 (exceeds 5 allowed). Consider refactoring. Open
static format(notes, state) {
if (!notes || notes.length < 2) return false;
// FIXME: VexFlow will soon require that a stave be set before formatting.
// Which, according to the below condition, means that following branch will
- Read upRead up
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 addLyricEntry
has a Cognitive Complexity of 140 (exceeds 5 allowed). Consider refactoring. Open
public addLyricEntry(lyricNodeList: IXmlElement[], currentVoiceEntry: VoiceEntry): void {
if (lyricNodeList) {
const lyricNodeListArr: IXmlElement[] = lyricNodeList;
for (let idx: number = 0, len: number = lyricNodeListArr.length; idx < len; ++idx) {
const lyricNode: IXmlElement = lyricNodeListArr[idx];
- Read upRead up
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 calculateChordSymbols
has a Cognitive Complexity of 134 (exceeds 5 allowed). Consider refactoring. Open
protected calculateChordSymbols(): void {
for (const musicSystem of this.musicSystems) {
for (const staffLine of musicSystem.StaffLines) {
const skybottomcalculator: SkyBottomLineCalculator = staffLine.SkyBottomLineCalculator;
let minimumOffset: number = Number.MAX_SAFE_INTEGER; // only calculated if option set
- Read upRead up
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 createInstrumentGroups
has a Cognitive Complexity of 131 (exceeds 5 allowed). Consider refactoring. Open
private createInstrumentGroups(entryList: IXmlElement[]): { [_: string]: Instrument } {
let instrumentId: number = 0;
const instrumentDict: { [_: string]: Instrument } = {};
let currentGroup: InstrumentalGroup;
try {
- Read upRead up
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 calculateMeasureXLayout
has a Cognitive Complexity of 129 (exceeds 5 allowed). Consider refactoring. Open
protected calculateMeasureXLayout(measures: GraphicalMeasure[]): number {
const visibleMeasures: GraphicalMeasure[] = [];
for (const measure of measures) {
if (measure?.isVisible()) { // if we don't check for visibility, invisible parts affect layout (#1444)
visibleMeasures.push(measure);
- Read upRead up
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 tables.js
has 1019 lines of code (exceeds 250 allowed). Consider refactoring. Open
// [VexFlow](http://vexflow.com) - Copyright (c) Mohit Muthanna 2010.
/* eslint-disable key-spacing */
import { Vex } from './vex';
File MusicSystemBuilder.ts
has 976 lines of code (exceeds 250 allowed). Consider refactoring. Open
import {GraphicalMeasure} from "./GraphicalMeasure";
import {GraphicalMusicPage} from "./GraphicalMusicPage";
import {EngravingRules} from "./EngravingRules";
import {RhythmInstruction} from "../VoiceData/Instructions/RhythmInstruction";
import {KeyInstruction} from "../VoiceData/Instructions/KeyInstruction";
File VexFlowConverter.ts
has 971 lines of code (exceeds 250 allowed). Consider refactoring. Open
import Vex from "vexflow";
import VF = Vex.Flow;
import {ClefEnum} from "../../VoiceData/Instructions/ClefInstruction";
import {ClefInstruction} from "../../VoiceData/Instructions/ClefInstruction";
import {Pitch} from "../../../Common/DataObjects/Pitch";
Function addAbstractInstruction
has a Cognitive Complexity of 119 (exceeds 5 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;
}
- Read upRead up
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 calculateGraphicalContinuousDynamic
has a Cognitive Complexity of 116 (exceeds 5 allowed). Consider refactoring. Open
public calculateGraphicalContinuousDynamic(graphicalContinuousDynamic: GraphicalContinuousDynamicExpression, startPosInStaffline: PointF2D): void {
const isSoftAccent: boolean = graphicalContinuousDynamic.IsSoftAccent;
const staffIndex: number = graphicalContinuousDynamic.ParentStaffLine.ParentStaff.idInMusicSheet;
// TODO: Previously the staffIndex was passed down. BUT you can (and this function actually does this) get it from
// the musicSystem OR from the ParentStaffLine. Is this the same index?
- Read upRead up
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 calculateGlissandi
has a Cognitive Complexity of 116 (exceeds 5 allowed). Consider refactoring. Open
public calculateGlissandi(): void {
const openGlissDict: { [staffId: number]: GraphicalGlissando[] } = {};
for (const graphicalMeasure of this.graphicalMusicSheet.MeasureList[0]) { //let i: number = 0; i < this.graphicalMusicSheet.MeasureList[0].length; i++) {
openGlissDict[graphicalMeasure.ParentStaff.idInMusicSheet] = [];
}
- Read upRead up
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 VoiceGenerator.ts
has 934 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { LinkedVoice } from "../VoiceData/LinkedVoice";
import { Voice } from "../VoiceData/Voice";
import { MusicSheet } from "../MusicSheet";
import { VoiceEntry, StemDirectionType } from "../VoiceData/VoiceEntry";
import { Note, TremoloInfo } from "../VoiceData/Note";