bemusic/bemuse

View on GitHub

Showing 274 of 508 total issues

Function PreviewFileDropHandler has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

export const PreviewFileDropHandler: FC<PreviewFileDropHandler> = (props) => {
  useEffect(() => {
    const onDragOver = (e: DragEvent) => {
      e.preventDefault()
    }
Severity: Minor
Found in bemuse/src/previewer/PreviewFileDropHandler.tsx - 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 keysForBmson has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

export function keysForBmson(bmson: Bmson) {
  const soundChannels = soundChannelsForBmson(bmson)
  let hasKeys = false
  let hasSecondPlayer = false
  let hasDeluxeKeys = false
Severity: Minor
Found in packages/bmson/src/index.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

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

import * as Scintillator from './'

const fixture = (file) => `/base/src/scintillator/test-fixtures/${file}`

describe('Scintillator', function () {
Severity: Minor
Found in bemuse/src/scintillator/index.spec.js - About 3 hrs to fix

    Function loadSongFromResources has 78 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function loadSongFromResources(
      resources: ICustomSongResources,
      options: LoadSongOptions = {}
    ) {
      const onMessage = options.onMessage || (() => {})
    Severity: Major
    Found in bemuse/src/custom-song-loader/index.ts - About 3 hrs to fix

      Function _judgeNote has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

        _judgeNote(note: GameNote) {
          let delta = this._gameTime - note.time
          let judgment = judgeTime(this._gameTime, note.time, this._judge)
          let result = this._noteResult.get(note)
          const isDown = !result || result.status === 'unjudged'
      Severity: Minor
      Found in bemuse/src/game/state/player-state.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 launchGame has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

      async function launchGame(
        {
          server,
          song,
          chart,
      Severity: Minor
      Found in bemuse/src/app/game-launcher.tsx - 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 loadPreview has 77 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export async function loadPreview(loadOptions: LoadPreviewOptions) {
        const log =
          loadOptions.log ||
          ((message: string) => console.log(`[PreviewLoader] ${message}`))
      
      
      Severity: Major
      Found in bemuse/src/previewer/PreviewLoader.tsx - About 3 hrs to fix

        Function generateBaseConfig has 76 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function generateBaseConfig() {
          const config = {
            mode: Env.production() ? 'production' : 'development',
            context: path('src'),
            resolve: webpackResolve,
        Severity: Major
        Found in bemuse/config/webpack.js - About 3 hrs to fix

          Online has 26 functions (exceeds 20 allowed). Consider refactoring.
          Open

          export class Online {
            constructor(private readonly service: InternetRankingService) {}
          
            /** @deprecated */
            private user口 = new Subject<UserInfo | null>()
          Severity: Minor
          Found in bemuse/src/online/index.ts - About 3 hrs to fix

            Function main has 75 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export async function main() {
              // iOS
              window.addEventListener('touchstart', function unmute() {
                unmuteAudio(audioContext)
                window.removeEventListener('touchstart', unmute)
            Severity: Major
            Found in bemuse/src/game/index.tsx - About 3 hrs to fix

              Function ModeSelectScene has 75 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const ModeSelectScene = () => {
                const sceneManager = useContext(SceneManagerContext)
                const dispatch = useDispatch()
                const playDevice = useRef<PlayDevice>(null)
              
              
              Severity: Major
              Found in bemuse/src/app/ui/ModeSelectScene.tsx - About 3 hrs to fix

                Function ChildManager has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                Open

                function ChildManager(expr, child, poolSize) {
                  return {
                    instantiate(context, subject) {
                      const instances = new Map()
                      const pool = []
                Severity: Minor
                Found in bemuse/src/scintillator/nodes/object.js - 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

                Function _judgeColumn has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                Open

                  _judgeColumn(buffer: NoteBuffer, control: Control, column: string) {
                    let judgedNote
                    let judgment
                    const notes = buffer.notes
                    let autoPlayed = false
                Severity: Minor
                Found in bemuse/src/game/state/player-state.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

                Function getFilesFromEvent has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                async function getFilesFromEvent(
                  event: DragEvent,
                  log: LoggingFunction
                ): Promise<FileEntry[]> {
                  const out: FileEntry[] = []
                Severity: Major
                Found in bemuse/src/resources/dnd-resources.ts - About 2 hrs to fix

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

                    public update(axis: number, threshold: number = 3) {
                      if (this.previous === false) {
                        this.previous = axis
                        return 0
                      }
                  Severity: Minor
                  Found in bemuse/src/omni-input/axis-logic.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

                  Function main has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export async function main(bootContext: {
                    setStatus: (status: string) => void
                  }) {
                    bootContext.setStatus('Loading song')
                    const state口 = new Subject<ExperimentState>()
                  Severity: Major
                  Found in bemuse/src/auto-synchro/index.tsx - About 2 hrs to fix

                    Function updateVisibleNotes has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        function updateVisibleNotes() {
                          const entities = noteArea.getVisibleNotes(position, getUpperBound(), 1)
                          if (touch3dMode) {
                            const putNote = (id, noteY, column, scale = 1) => {
                              const row = touch3d.getRow(noteY - 0.01)
                    Severity: Major
                    Found in bemuse/src/game/display/player-display.js - About 2 hrs to fix

                      Function main has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export async function main() {
                        const chart = BMS.Compiler.compile(`
                          #TITLE ทดสอบ Bemuse
                          #ARTIST ฟหกด
                          #00111:01
                      Severity: Major
                      Found in bemuse/src/devtools/playgrounds/skin.js - About 2 hrs to fix

                        Function getName has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                        Open

                        export function getName(key: string) {
                          if (+key) {
                            return _.capitalize(keycode(+key))
                          }
                          {
                        Severity: Minor
                        Found in bemuse/src/omni-input/index.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

                        Function TitleScene has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const TitleScene = () => {
                          const sceneManager = useContext(SceneManagerContext)
                          const dispatch = useDispatch()
                          const options = useSelector(selectOptions)
                        
                        
                        Severity: Major
                        Found in bemuse/src/app/ui/TitleScene.tsx - About 2 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language