bemusic/bemuse

View on GitHub

Showing 274 of 508 total issues

Function instantiate has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    instantiate(context, subject) {
      const instances = new Map()
      const pool = []
      initPool()
      return new Instance({
Severity: Major
Found in bemuse/src/scintillator/nodes/object.js - About 2 hrs to fix

    Function play has 51 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      return function play(callbacks: { a: () => void }) {
        master.unmute()
    
        const BPM = 148
        const time = new AudioTime(context, -1)
    Severity: Major
    Found in bemuse/src/auto-synchro/music/index.ts - About 2 hrs to fix

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

      import { BPMInfo, OutputSongInfo } from './types'
      import { expect } from 'chai'
      import * as indexer from '.'
      
      describe('getFileInfo (bms)', function () {
      Severity: Minor
      Found in packages/bemuse-indexer/src/index.spec.ts - About 2 hrs to fix

        Function PreviewFileDropHandler has 50 lines of code (exceeds 25 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 2 hrs to fix

          Function OmniInputPlugin has 49 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function OmniInputPlugin(game) {
            const input = new OmniInput(window, {
              exclusive: true,
              continuous: game.players[0].options.input.continuous,
              sensitivity: game.players[0].options.input.sensitivity,
          Severity: Minor
          Found in bemuse/src/game/input/omni-input-plugin.js - About 1 hr to fix

            Function HomePage has 48 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export const HomePage = () => {
              return (
                <Page>
                  <Heading>What is Bemuse?</Heading>
                  <p>Bemuse is an online, web-based rhythm game.</p>
            Severity: Minor
            Found in bemuse/src/site/HomePage.tsx - About 1 hr to fix

              Function getSong has 48 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                const getSong = async function (): Promise<GameLoader.LoadSpec> {
                  const kbm = (query.keyboard || '').split(',').map((x) => +x)
                  const options: OptionsDraft = {
                    url: query.bms || '/music/[snack]dddd/dddd_sph.bme',
                    game: {
              Severity: Minor
              Found in bemuse/src/game/index.tsx - About 1 hr to fix

                Function getKeys has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                export function getKeys(chart: BMS.BMSChart): Keys {
                  const objects = chart.objects.all()
                  const stat: { [channel: number]: number } = {}
                  for (let i = 0; i < objects.length; i++) {
                    const object = objects[i]
                Severity: Minor
                Found in packages/bemuse-indexer/src/keys.ts - 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 MusicListItem has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const MusicListItem = (props: MusicListItemProps) => {
                  const { song, selected, onSelect, highlight } = props
                  const handleClick = (e: MouseEvent<HTMLLIElement>) => {
                    onSelect(e, song)
                  }
                Severity: Minor
                Found in bemuse/src/app/ui/MusicListItem.tsx - About 1 hr to fix

                  Function runMocha has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function runMocha() {
                    const specs = []
                    mocha
                      .run()
                      .on('test end', function reportFailedSpec(test) {
                  Severity: Minor
                  Found in bemuse/src/test/index.js - About 1 hr to fix

                    Function loadFromBmsFileList has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      async function loadFromBmsFileList(bmsFileList: string[]) {
                        onMessage(bmsFileList.length + ' file(s) found. Reading them...')
                        const files = await Promise.all(
                          bmsFileList.map(async (filename) => {
                            const start = Date.now()
                    Severity: Minor
                    Found in bemuse/src/custom-song-loader/index.ts - About 1 hr to fix

                      Function _judgeNote has 44 lines of code (exceeds 25 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 1 hr to fix

                        Function OmniInputPlugin has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function OmniInputPlugin(game) {
                          const input = new OmniInput(window, {
                            exclusive: true,
                            continuous: game.players[0].options.input.continuous,
                            sensitivity: game.players[0].options.input.sensitivity,
                        Severity: Minor
                        Found in bemuse/src/game/input/omni-input-plugin.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 _preTransform has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                        Open

                          _preTransform(
                            bmsNotes: BMS.BMSNote[],
                            playerOptions: Partial<PlayerOptions>
                          ) {
                            let chain = _.chain(bmsNotes)
                        Severity: Minor
                        Found in packages/bemuse-notechart/src/index.ts - 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 getSongInfo has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                        Open

                        async function getSongInfo(
                          files: IndexingInputFile[],
                          options?: {
                            cache?: {
                              get(md5: string): OutputFileInfo
                        Severity: Minor
                        Found in packages/bemuse-indexer/src/index.ts - 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 notesDataAndKeysoundsDataForBmsonAndTiming has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function notesDataAndKeysoundsDataForBmsonAndTiming(
                          bmson: Bmson,
                          timing: BMS.Timing,
                          options: MusicalScoreOptions
                        ) {
                        Severity: Minor
                        Found in packages/bmson/src/index.ts - 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 _advance has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                        Open

                          private _advance() {
                            const currentTime =
                              this._samplingMaster.currentTime -
                              this._startAudioTime +
                              this._startSongTime
                        Severity: Minor
                        Found in bemuse/src/previewer/NotechartPreview.ts - 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 OptionsInput has a Cognitive Complexity of 14 (exceeds 5 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: Minor
                        Found in bemuse/src/app/ui/OptionsInput.tsx - 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 handleClipboardPaste has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                        Open

                          (dispatch: Dispatch<AnyAction>) => (e: ClipboardEvent) => {
                            const text = e.clipboardData?.getData('text/plain')
                            if (!text) {
                              return
                            }
                        Severity: Minor
                        Found in bemuse/src/app/io/CustomSongsIO.ts - 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 _shouldJudge has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                        Open

                          _shouldJudge(note: GameNote, control: Control, buffer: NoteBuffer) {
                            const status = this.getNoteStatus(note)
                            if (status === 'unjudged') {
                              if (this._shouldAutoplay() && this._gameTime >= note.time) {
                                this.tainted = true
                        Severity: Minor
                        Found in bemuse/src/game/state/player-state.ts - 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

                        Severity
                        Category
                        Status
                        Source
                        Language