bemusic/bemuse

View on GitHub

Showing 274 of 508 total issues

Function update has a Cognitive Complexity of 97 (exceeds 5 allowed). Consider refactoring.
Open

  update(time, gameTime, playerState) {
    const touch3dMode = this._touch3dMode
    const player = this._player
    const noteArea = this._noteArea
    const stateful = this._stateful
Severity: Minor
Found in bemuse/src/game/display/player-display.js - About 1 day 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 tests has 323 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function tests(onlineServiceOptions) {
  const storage = {
    map: new Map(),
    getItem(key) {
      return this.map.get(key) ?? null
Severity: Major
Found in bemuse/src/online/index.spec.js - About 1 day to fix

    Function TouchPlugin has a Cognitive Complexity of 69 (exceeds 5 allowed). Consider refactoring.
    Open

    export function TouchPlugin(context) {
      let scratchStartY = null
      let scratchY = null
      const getInput = bench.wrap('input:touch:I', _getInput)
      const getScratch = bench.wrap('input:touch:SC', _getScratch)
    Severity: Minor
    Found in bemuse/src/game/input/touch-plugin.js - About 1 day 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 update has 182 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      update(time, gameTime, playerState) {
        const touch3dMode = this._touch3dMode
        const player = this._player
        const noteArea = this._noteArea
        const stateful = this._stateful
    Severity: Major
    Found in bemuse/src/game/display/player-display.js - About 7 hrs to fix

      File index.ts has 455 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import _ from 'lodash'
      import { get, set, del } from 'idb-keyval'
      import pMemoize from 'p-memoize'
      import {
        CustomFolderChartFile,
      Severity: Minor
      Found in bemuse/src/custom-folder/index.ts - About 6 hrs to fix

        Function createMusicPreviewer has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
        Open

        function createMusicPreviewer() {
          let enabled = false
          let currentUrl = null
          let backgroundLoaded = false
          let backgroundPlayed = false
        Severity: Minor
        Found in bemuse/src/music-previewer/index.js - About 6 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 load has 163 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function load(spec: LoadSpec) {
          const assets = spec.assets
          const bms = spec.bms
          const songId = spec.songId
        
        
        Severity: Major
        Found in bemuse/src/game/loaders/game-loader.ts - About 6 hrs to fix

          Function createFakeScoreboardClient has 156 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function createFakeScoreboardClient(): ScoreboardClient {
            let submissions: Submission[] = []
          
            let nextId = 1
            const chart = (md5: string, playMode: MappingMode) => {
          Severity: Major
          Found in bemuse/src/online/scoreboard-system/createFakeScoreboardClient.ts - About 6 hrs to fix

            Function MusicSelectScene has 155 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const MusicSelectScene = () => {
              const sceneManager = useContext(SceneManagerContext)
              const musicSelect = useSelector(selectMusicSelectState)
              const collectionUrl = useSelector(selectCurrentCollectionUrl)
              const options = useSelector(selectOptions)
            Severity: Major
            Found in bemuse/src/app/ui/MusicSelectScene.tsx - About 6 hrs to fix

              Function generateLoadersConfig has 146 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function generateLoadersConfig() {
                return [
                  ...(Env.coverageEnabled()
                    ? [
                        {
              Severity: Major
              Found in bemuse/config/webpack.js - About 5 hrs to fix

                File NotechartPreview.ts has 400 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import Notechart, {
                  GameLandmine,
                  GameNote,
                  SoundedEvent,
                } from 'bemuse-notechart'
                Severity: Minor
                Found in bemuse/src/previewer/NotechartPreview.ts - About 5 hrs to fix

                  Function AboutScene has 140 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const AboutScene = () => {
                    const sceneManager = useContext(SceneManagerContext)
                  
                    const [artists, setArtists] = useState<{ name: string; url: string }[]>([])
                    useEffect(() => {
                  Severity: Major
                  Found in bemuse/src/app/ui/AboutScene.tsx - About 5 hrs to fix

                    Function PreviewCanvas has 138 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export const PreviewCanvas: FC<PreviewCanvas> = (props) => {
                      const keymap = 'SCs 1 2b 3 4g 5 6b 7 - 8 9b 10 11g 12 13b 14 SC2s'
                      const notesImage = useImage('/skins/default/Note/DX/Note.png')
                      const landmineImage = useImage('/skins/default/Note/DX/Landmine.png')
                      const canvasRef = React.useRef<HTMLCanvasElement>(null)
                    Severity: Major
                    Found in bemuse/src/previewer/PreviewCanvas.tsx - About 5 hrs to fix

                      File install-run.js has 395 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      "use strict";
                      // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
                      // See the @microsoft/rush package's LICENSE file for license information.
                      var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
                          if (k2 === undefined) k2 = k;
                      Severity: Minor
                      Found in common/scripts/install-run.js - About 5 hrs to fix

                        Function getViewport has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
                        Open

                          getViewport(currentTime: number, hiSpeed: number): PreviewViewport {
                            const beat = this._secondsToBeat(currentTime)
                            const position = this._notechart.beatToPosition(beat)
                            const speed = this._notechart.spacingAtBeat(beat)
                            const windowSize = 4 / speed / hiSpeed
                        Severity: Minor
                        Found in bemuse/src/previewer/NotechartPreview.ts - About 5 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 createMusicPreviewer has 129 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function createMusicPreviewer() {
                          let enabled = false
                          let currentUrl = null
                          let backgroundLoaded = false
                          let backgroundPlayed = false
                        Severity: Major
                        Found in bemuse/src/music-previewer/index.js - About 5 hrs to fix

                          Function AuthenticationPanel has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
                          Open

                          const AuthenticationPanel = ({ onFinish }: AuthenticationPanelProps) => {
                            const online = useContext(OnlineContext)
                            const [mode, setMode] = useState<AuthMode>('logIn')
                            const [auth, setAuth] = useState<AuthState>({ status: 'idle', message: '' })
                          
                          
                          Severity: Minor
                          Found in bemuse/src/online/ui/AuthenticationPanel.tsx - About 5 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 OptionsInput has 125 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          const OptionsInput = () => {
                            const dispatch = useDispatch()
                            const { scratch, texts, mode, isContinuous, sensitivity } =
                              useSelector(extractState)
                            const [editing, setEditing] = useState<string | null>(null)
                          Severity: Major
                          Found in bemuse/src/app/ui/OptionsInput.tsx - About 5 hrs to fix

                            File index.spec.js has 361 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import { filter, first, firstValueFrom } from 'rxjs'
                            
                            import Online from '.'
                            import OnlineService from './scoreboard-system/OnlineService'
                            import assert from 'power-assert'
                            Severity: Minor
                            Found in bemuse/src/online/index.spec.js - About 4 hrs to fix

                              File createLegacyScoreboardClient.ts has 361 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              import axios from 'axios'
                              import invariant from 'invariant'
                              
                              import * as authenticationFlow from './authenticationFlow'
                              import { ScoreboardClient } from './ScoreboardClient'
                              Severity: Minor
                              Found in bemuse/src/online/scoreboard-system/createLegacyScoreboardClient.ts - About 4 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language