ltgcgo/octavia

View on GitHub

Showing 9 of 38 total issues

Function rawToPool has 80 lines of code (exceeds 25 allowed). Consider refactoring.
Open

let rawToPool = function (midiJson) {
    //console.debug(midiJson);
    let list = new TimedEvents();
    let upThis = this;
    let timeDiv = midiJson.timeDivision,
Severity: Major
Found in src/basic/transform.js - About 3 hrs to fix

    Function sysexBitmap has 63 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    let sysexBitmap = function (frameData, type = "xg", frameId = 0, noCopy) {
        if (!frameData?.length) {
            throw Error(`Blank frame data`);
        };
        // 0 for XG, 1 for GS, 2 for NS5R
    Severity: Major
    Found in src/state/emitGlobal.js - About 2 hrs to fix

      Function sysexBitmap has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

      let sysexBitmap = function (frameData, type = "xg", frameId = 0, noCopy) {
          if (!frameData?.length) {
              throw Error(`Blank frame data`);
          };
          // 0 for XG, 1 for GS, 2 for NS5R
      Severity: Minor
      Found in src/state/emitGlobal.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 arrowGen has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

      let arrowGen = function (charArr, value, border, unit) {
          let boundLow = border - (unit >> 1), boundHi = border + (unit >> 1);
          if (value > border) {
              for (let c = 0; value > border; c ++) {
                  charArr[c] = (value < boundHi) ? "=" : ">";
      Severity: Minor
      Found in src/disp/texted.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 gOpenSmf has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      self.gOpenSmf = async function () {
          useMidiBus = false;
          let file = await fileOpen(propsMid);
          let fileSplit = file.name.lastIndexOf("."), ext = "";
          if (fileSplit > -1) {
      Severity: Minor
      Found in src/cambiare_demo/index.js - About 1 hr to fix

        Function fileReadAs has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            let fileReadAs = function (blob, target) {
                let reader = new FileReader();
                return new Promise((success, failure) => {
                    reader.addEventListener("abort", () => {
                        failure(new Error("Blob read aborted"));
        Severity: Minor
        Found in src/compat/inject.js - About 1 hr to fix

          Consider simplifying this complex logical expression.
          Open

                          if (document.fullscreen || document.mozFullscreen || document.webkitFullscreen) {
                              (document.exitFullscreen || document.mozExitFullscreen || document.webkitExitFullscreen).apply(document);
                          } else {
                              let cc = $e(".cambiare");
                              (cc.requestFullscreen || cc.mozRequestFullscreen || cc.webkitRequestFullscreen).apply(cc);
          Severity: Major
          Found in src/cambiare_demo/index.js - About 1 hr to fix

            Function customInterpreter has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            let customInterpreter = function (type, file, rawMtLen) {
                let u8Data = [];
                let metaLength = rawMtLen == false ? file.readIntVLV() : rawMtLen;
                if (type == 0 || type == 127) {
                    //metaLength = 1;
            Severity: Minor
            Found in src/state/utils.js - About 45 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 replaceAll has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                String.prototype.replaceAll = String.prototype.replaceAll || function (source, target) {
                    let antiLoop = 0, maxSafe = 16;
                    let indexFinder = this, indexes = [];
                    while (antiLoop < maxSafe && indexFinder.lastIndexOf(source) > -1) {
                        let index = indexFinder.lastIndexOf(source);
            Severity: Minor
            Found in src/compat/inject.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

            Severity
            Category
            Status
            Source
            Language