RolandJansen/intermix.js

View on GitHub

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.

/**
Severity: Major
Found in src/registry/midiActionDefs.ts - About 2 days to fix

    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
    
    
    Severity: Minor
    Found in src/helper.ts - About 3 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 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 };
    Severity: Major
    Found in src/store/rootReducer.ts - About 2 hrs to fix

      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);
      Severity: Major
      Found in etc/make-docs.js - About 2 hrs to fix

        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";
        Severity: Minor
        Found in src/registry/__tests__/AbstractRegistry.test.ts - About 2 hrs to fix

          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 };
          Severity: Minor
          Found in src/store/rootReducer.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

          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";
          Severity: Minor
          Found in src/plugins/Sequencer/__tests__/Sequencer.test.ts - About 2 hrs to fix

            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();
            Severity: Minor
            Found in src/plugins/Sequencer/Sequencer.ts - About 2 hrs to fix

              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
              
              
              Severity: Minor
              Found in src/helper.ts - About 1 hr to fix

                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) {
                Severity: Minor
                Found in src/helper.ts - About 1 hr to fix

                  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) {
                  Severity: Minor
                  Found in src/helper.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 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("/");
                  Severity: Minor
                  Found in src/store/preprocessOscMiddleware.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 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
                  Severity: Minor
                  Found in src/registry/AbstractRegistry.ts - About 1 hr to fix

                    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();
                    
                    
                    Severity: Minor
                    Found in src/registry/commonPluginActionDefs.ts - About 1 hr to fix

                      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();
                      Severity: Minor
                      Found in src/plugins/Sequencer/Sequencer.ts - 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

                      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
                      Severity: Major
                      Found in src/store/rootReducer.ts - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                    if (value === partRef) {
                                        newState.seqparts.splice(index, 1);
                                    }
                        Severity: Major
                        Found in src/store/rootReducer.ts - About 45 mins to fix

                          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 = {};
                          Severity: Minor
                          Found in src/registry/MasterRegistry.ts - 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

                          Avoid too many return statements within this function.
                          Open

                                          return true;
                          Severity: Major
                          Found in src/plugins/Sequencer/Sequencer.ts - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                    return copyTypedArray(original) as any;
                            Severity: Major
                            Found in src/helper.ts - About 30 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language