Showing 52 of 131 total issues
File midiActionDefs.ts
has 997 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { IInternalActionDef } from "../interfaces/IActions";
// WARNING!: Currently not in use.
/**
Function deepCopy
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
export const deepCopy = <T>(original: T): T => {
// what about:
// * img data
// * functions
- 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 rootReducer
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
const rootReducer = (state: IState = initialState, action: AnyAction): IState => {
if (action.type === ADD_PLUGIN) {
if (isStringArray(state.plugins)) {
const newPluginRefs = addItem(state.plugins, action.payload);
const newState: IState = { ...state, plugins: newPluginRefs };
Function main
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function main() {
await new Promise((resolve, reject) =>
exec("api-extractor run --local && api-documenter markdown -i temp -o docs/api", (err, stdout, stderr) => {
console.log(stdout);
console.error(stderr);
File AbstractRegistry.test.ts
has 261 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* eslint-disable @typescript-eslint/camelcase */
import { ActionCreatorsMapObject, Reducer, ReducersMapObject } from "redux";
import { store } from "../../store/store";
import AbstractRegistry from "../AbstractRegistry";
import { IActionHandlerMap, IState, Tuple } from "../../interfaces/interfaces";
Function rootReducer
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
const rootReducer = (state: IState = initialState, action: AnyAction): IState => {
if (action.type === ADD_PLUGIN) {
if (isStringArray(state.plugins)) {
const newPluginRefs = addItem(state.plugins, action.payload);
const newState: IState = { ...state, plugins: newPluginRefs };
- 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 Sequencer.test.ts
has 256 lines of code (exceeds 250 allowed). Consider refactoring. Open
/// <reference path="../../../../typings/web-audio-test-api.d.ts" />
import "web-audio-test-api";
import Sequencer from "../Sequencer";
import SeqPart from "../../../seqpart/SeqPart";
import { IntermixNote } from "../../../interfaces/interfaces";
Function onChange
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
public onChange(changed: Tuple): boolean {
switch (changed[0]) {
case "running":
if (changed[1] === 0) {
this.stop();
Function deepCopy
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const deepCopy = <T>(original: T): T => {
// what about:
// * img data
// * functions
Function copyTypedArray
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
const copyTypedArray = (original: TypedArray): TypedArray => {
if (original instanceof Int8Array) {
return new Int8Array(original);
}
if (original instanceof Uint8Array) {
Function copyTypedArray
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
const copyTypedArray = (original: TypedArray): TypedArray => {
if (original instanceof Int8Array) {
return new Int8Array(original);
}
if (original instanceof Uint8Array) {
- 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 preprocessOSC
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
const preprocessOSC: Middleware = () => (next) => (action: AnyAction): AnyAction => {
let toBeDispatched: AnyAction = action;
if (itsAnOscAction(action)) {
const address: string[] = action.address.split("/");
- 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 getActionCreators
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected getActionCreators(actionDefs: IOscActionDef[], uid: string): ActionCreatorsMapObject {
const actionCreators: ActionCreatorsMapObject = {};
actionDefs.forEach((actionDef) => {
// make a physical copy of actionDef. If not, we would
Function savePreset
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
const savePreset: reducerLogic = (mySubState: IState, action: InternalAction): IState => {
const actionDefs: IOscActionDef[] = mySubState.actionDefs as IOscActionDef[];
const newPreset: IState = {};
const commonActionAddresses = new Set();
Function onChange
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public onChange(changed: Tuple): boolean {
switch (changed[0]) {
case "running":
if (changed[1] === 0) {
this.stop();
- 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
Avoid deeply nested control flow statements. Open
} else if (action.type === CONNECT_AUDIO_NODES) {
const outEndpoint: AudioEndpoint = [action.payload[0], action.payload[1]];
const inEndpoint: AudioEndpoint = [action.payload[2], action.payload[3]];
// we also have to change the state of the former input
Avoid deeply nested control flow statements. Open
if (value === partRef) {
newState.seqparts.splice(index, 1);
}
Function getActionCreators
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public getActionCreators(itemId: string, bound?: string): ActionCreatorsMapObject {
const pluginKeys = this.plugins.getUidList();
const seqPartKeys = this.seqParts.getUidList();
const actionCreatorsType = bound === "unbound" ? "unboundActionCreators" : "actionCreators";
let actionCreators: ActionCreatorsMapObject = {};
- 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
Avoid too many return
statements within this function. Open
return true;
Avoid too many return
statements within this function. Open
return copyTypedArray(original) as any;