bemusic/bemuse

View on GitHub

Showing 508 of 508 total issues

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

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                  it('does not suppress freestyle keysound outside 3d mode', function () {
                    setup(
                      `
                        #BPM 60
                        #00111:01
          Severity: Major
          Found in bemuse/src/game/state/player-state.spec.js and 1 other location - About 5 hrs to fix
          bemuse/src/game/state/player-state.spec.js on lines 317..334

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 141.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                  it('suppresses freestyle keysound when column is sandwiched between 2 adjacent notes in 3d mode', function () {
                    setup(
                      `
                        #BPM 60
                        #00111:01
          Severity: Major
          Found in bemuse/src/game/state/player-state.spec.js and 1 other location - About 5 hrs to fix
          bemuse/src/game/state/player-state.spec.js on lines 335..352

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 141.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          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

                  File webpack.js has 359 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import Gauge from 'gauge'
                  import TerserPlugin from 'terser-webpack-plugin'
                  import express from 'express'
                  import webpack from 'webpack'
                  import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer'
                  Severity: Minor
                  Found in bemuse/config/webpack.js - About 4 hrs to fix

                    Function getFilesFromEvent has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
                    Open

                    async function getFilesFromEvent(
                      event: DragEvent,
                      log: LoggingFunction
                    ): Promise<FileEntry[]> {
                      const out: FileEntry[] = []
                    Severity: Minor
                    Found in bemuse/src/resources/dnd-resources.ts - About 4 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

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                        it('should save speed after playing game', () => {
                          const autoVelocity = createAutoVelocity({
                            enabled: false,
                            initialSpeed: 3.8,
                            desiredLeadTime: 1000,
                    Severity: Major
                    Found in bemuse/src/app/interactors/createAutoVelocity.spec.js and 1 other location - About 4 hrs to fix
                    bemuse/src/app/interactors/createAutoVelocity.spec.js on lines 92..104

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 124.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                        it('should not save if speed remains the same', () => {
                          const autoVelocity = createAutoVelocity({
                            enabled: true,
                            initialSpeed: 3.8,
                            desiredLeadTime: 1685,
                    Severity: Major
                    Found in bemuse/src/app/interactors/createAutoVelocity.spec.js and 1 other location - About 4 hrs to fix
                    bemuse/src/app/interactors/createAutoVelocity.spec.js on lines 16..28

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 124.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    File player-state.spec.js has 350 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import assert from 'assert'
                    
                    import GameInput from '../input'
                    import Player from '../player'
                    import PlayerState from './player-state'
                    Severity: Minor
                    Found in bemuse/src/game/state/player-state.spec.js - About 4 hrs to fix

                      Function TouchPlugin has 109 lines of code (exceeds 25 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: Major
                      Found in bemuse/src/game/input/touch-plugin.js - About 4 hrs to fix

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                              <FloatingMobileMenu visible={visible}>
                                {items.map((element, index) => {
                                  if (element.type === 'item') {
                                    return (
                                      <React.Fragment key={index}>
                        Severity: Major
                        Found in bemuse/src/app/ui/Toolbar.tsx and 1 other location - About 4 hrs to fix
                        bemuse/src/app/ui/Toolbar.tsx on lines 91..107

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 121.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                          <SceneToolbar>
                            {items.map((element, index) => {
                              if (element.type === 'item') {
                                return (
                                  <React.Fragment key={index}>
                        Severity: Major
                        Found in bemuse/src/app/ui/Toolbar.tsx and 1 other location - About 4 hrs to fix
                        bemuse/src/app/ui/Toolbar.tsx on lines 121..137

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 121.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Severity
                        Category
                        Status
                        Source
                        Language