bemusic/bemuse

View on GitHub

Showing 274 of 508 total issues

Function constructor has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  constructor(samplingMaster, buffer, delay, options = {}) {
    delay = delay || 0
    this._master = samplingMaster

    // Connect all the stuff...
Severity: Minor
Found in bemuse/src/sampling-master/index.js - 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

Function MusicSelectScene has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

const MusicSelectScene = () => {
  const sceneManager = useContext(SceneManagerContext)
  const musicSelect = useSelector(selectMusicSelectState)
  const collectionUrl = useSelector(selectCurrentCollectionUrl)
  const options = useSelector(selectOptions)
Severity: Minor
Found in bemuse/src/app/ui/MusicSelectScene.tsx - 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

Function addPath has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  async addPath(
    childPath: string[],
    io: {
      getModifiedDate: () => Promise<number>
    }
Severity: Minor
Found in bemuse/src/custom-folder/index.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

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

  compileChildren($el) {
    const output = []
    for (const child of Array.from($el.children())) {
      const nodeName = child.nodeName
      if (nodeName === 'defs') {
Severity: Minor
Found in bemuse/src/scintillator/compiler.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 installAndRun has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

function installAndRun(logger, packageName, packageVersion, packageBinName, packageBinArgs, lockFilePath = process.env[INSTALL_RUN_LOCKFILE_PATH_VARIABLE]) {
Severity: Minor
Found in common/scripts/install-run.js - About 45 mins to fix

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

    function getNpmPath() {
        if (!_npmPath) {
            try {
                if (os.platform() === 'win32') {
                    // We're on Windows
    Severity: Minor
    Found in common/scripts/install-run.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 __importStar has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    var __importStar = (this && this.__importStar) || function (mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
        __setModuleDefault(result, mod);
    Severity: Minor
    Found in common/scripts/install-run.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 __importStar has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    var __importStar = (this && this.__importStar) || function (mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
        __setModuleDefault(result, mod);
    Severity: Minor
    Found in common/scripts/install-run-rush.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 _compile has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    export function _compile($el) {
      const keyframes = _.map(Array.from($el.children('keyframe')), _attrs)
      const attrs = {}
      for (const keyframe of keyframes) {
        const time = +keyframe.t
    Severity: Minor
    Found in bemuse/src/scintillator/nodes/concerns/animation.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

    Avoid deeply nested control flow statements.
    Open

                        if (!process.env[environmentVariableName]) {
                            // No, so trim this line
                            lineShouldBeTrimmed = true;
                            break;
                        }
    Severity: Major
    Found in common/scripts/install-run.js - About 45 mins to fix

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

      function updateChangelog(existingChangelog, entries, version = 'UNRELEASED') {
        const userListRegExp = /((?:\[@\w+\]: https.+\n)+)/
        const userList = existingChangelog.match(userListRegExp)
        if (!userList) {
          throw new Error('Cannot find user list in changelog')
      Severity: Minor
      Found in build-scripts/lib/changelog.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

      Avoid deeply nested control flow statements.
      Open

                  if (noteHeight > 0) {
                    ctx.drawImage(
                      notesImage,
                      column.sprite.x,
                      22 + spriteYOffset,
      Severity: Major
      Found in bemuse/src/previewer/PreviewCanvas.tsx - About 45 mins to fix

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

        function createMockFileSystemDirectoryHandle(
          data: MockFolder
        ): FileSystemDirectoryHandle {
          return {
            kind: 'directory',
        Severity: Minor
        Found in bemuse/src/custom-folder/index.spec.ts - 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 updateGamepad has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          private updateGamepad(gamepad: Gamepad) {
            const prefix = `gamepad.${gamepad.index}`
            for (let i = 0; i < gamepad.buttons.length; i++) {
              const button = gamepad.buttons[i]
              this.status[`${prefix}.button.${i}`] = button && button.value >= 0.5
        Severity: Minor
        Found in bemuse/src/omni-input/index.ts - 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 createFakeScoreboardClient has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        export function createFakeScoreboardClient(): ScoreboardClient {
          let submissions: Submission[] = []
        
          let nextId = 1
          const chart = (md5: string, playMode: MappingMode) => {
        Severity: Minor
        Found in bemuse/src/online/scoreboard-system/createFakeScoreboardClient.ts - 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 constructor has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          constructor(keymap: string) {
            let nextX = 0
            const column = (width: number, name: string | null): PreviewColumn => {
              const x = nextX
              nextX += width + 1
        Severity: Minor
        Found in bemuse/src/previewer/PreviewCanvas.tsx - 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 _updateUserFromStorage has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          _updateUserFromStorage() {
            const loadUser = (text: string | null) => {
              if (!text) return null
              try {
                const data = JSON.parse(text)
        Severity: Minor
        Found in bemuse/src/online/scoreboard-system/OnlineService.ts - 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 removeFolders has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        async function removeFolders(
          state: CustomFolderState,
          handle: FileSystemDirectoryHandle,
          io: CustomFolderScanIO
        ): Promise<ScanIterationResult | undefined> {
        Severity: Minor
        Found in bemuse/src/custom-folder/index.ts - 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 _installPackage has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        function _installPackage(logger, packageInstallFolder, name, version, command) {
        Severity: Minor
        Found in common/scripts/install-run.js - About 35 mins to fix

          Function createNotechartPreview has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            notechart: Notechart,
            filename: string,
            samplingMaster: SamplingMaster,
            soundGroup: SoundGroup,
            samples: PreviewSoundSample[]
          Severity: Minor
          Found in bemuse/src/previewer/NotechartPreview.ts - About 35 mins to fix
            Severity
            Category
            Status
            Source
            Language