bemusic/bemuse

View on GitHub

Showing 274 of 508 total issues

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 Help has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const Help = () => {
  const supportLinks = [
    {
      content: (
        <>
Severity: Minor
Found in website/src/pages/contribute.tsx - About 1 hr to fix

    Function exports has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = function () {
      const World = this.World
    
      World.plug(function () {
        this.parseOptions = {}
    Severity: Minor
    Found in packages/bms/features/support/bms.js - About 1 hr to fix

      Function createInstance has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        function createInstance(songUrl) {
          const audio = document.createElement('audio')
          audio.src = songUrl
          let played = false
      
      
      Severity: Minor
      Found in bemuse/src/music-previewer/index.js - About 1 hr to fix

        Function createSongServer has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function createSongServer(dir) {
          const promise = glob('**/*.{wav,ogg,mp3,m4a,flac}', { cwd: dir })
            .map((name) =>
              stat(path.join(dir, name)).then((stats) => ({
                name: name,
        Severity: Minor
        Found in packages/bemuse-tools/src/server.js - About 1 hr to fix

          Function installAndRun has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function installAndRun(logger, packageName, packageVersion, packageBinName, packageBinArgs, lockFilePath = process.env[INSTALL_RUN_LOCKFILE_PATH_VARIABLE]) {
              const rushJsonFolder = findRushJsonFolder();
              const rushCommonFolder = path.join(rushJsonFolder, 'common');
              const rushTempFolder = _getRushTempFolder(rushCommonFolder);
              const packageInstallFolder = _ensureAndJoinPath(rushTempFolder, 'install-run', `${packageName}@${packageVersion}`);
          Severity: Minor
          Found in common/scripts/install-run.js - About 1 hr to fix

            Function createFader has 41 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function createFader(audio, initialVolume, onTargetReached) {
              let targetVolume = 0
              let currentSpeed = 0
              let requested = false
              let volumeChanged
            Severity: Minor
            Found in bemuse/src/music-previewer/index.js - About 1 hr to fix

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

                Function GenericErrorScene has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export default function GenericErrorScene(props: {
                  preamble: string
                  error: Error
                  onContinue: () => void
                }) {
                Severity: Minor
                Found in bemuse/src/app/ui/GenericErrorScene.tsx - About 1 hr to fix

                  Function songInfoForBmson has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export function songInfoForBmson(bmson: Bmson) {
                    const bmsonInfo = bmson.info
                    const info: Partial<BMS.ISongInfoData> = {}
                    if (bmsonInfo.title) info.title = bmsonInfo.title
                    if (bmsonInfo.artist) info.artist = bmsonInfo.artist
                  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 Scratch has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export const Scratch = ({
                    active,
                    value,
                  }: {
                    active: boolean
                  Severity: Minor
                  Found in bemuse/src/app/ui/OptionsPlayerGraphics.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 CustomFolderTester has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const CustomFolderTester = () => {
                    const context = getDefaultCustomFolderContext()
                    const { isLoading, error, data } = useQuery('customFolder', async () => {
                      const result = await getCustomFolderState(context)
                      return result
                  Severity: Minor
                  Found in bemuse/src/devtools/playgrounds/custom-folder.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 groupSongsIntoCategories has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export function groupSongsIntoCategories(
                    songs: readonly Song[],
                    { songOfTheDayEnabled = false } = {}
                  ) {
                    const context = {
                  Severity: Minor
                  Found in bemuse/src/music-collection/groupSongsIntoCategories.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 validateSong has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function validateSong(song: Song): Problem[] {
                    const problems: Problem[] = []
                    const report = (message: string, ...keys: string[]) =>
                      problems.push({ keys, message })
                    if (song.unreleased) {
                  Severity: Minor
                  Found in bemuse/src/music-collection-viewer/MusicTable.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 getColumn has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function getColumn(x: any, options: MusicalScoreOptions) {
                    switch (x) {
                      case 1:
                        return '1'
                      case 2:
                  Severity: Minor
                  Found in packages/bmson/src/index.ts - About 1 hr to fix

                    Function _advance has 39 lines of code (exceeds 25 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

                      Function slicesForNotesAndTiming has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export function slicesForNotesAndTiming(
                        notes: Note[],
                        timing: BMS.Timing,
                        options: { beatForPulse: (pulse: number) => number }
                      ) {
                      Severity: Minor
                      Found in packages/bmson/src/utils.ts - About 1 hr to fix

                        Function constructor has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          constructor(
                            data: NotechartInput,
                            playerOptions: Partial<PlayerOptions> = {}
                          ) {
                            let {
                        Severity: Minor
                        Found in packages/bemuse-notechart/src/index.ts - About 1 hr to fix

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

                            Function KBGraphics has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            function KBGraphics() {
                              const children = []
                              for (let i = 0; i < 7; i++) {
                                if (i === 3) {
                                  children.push(
                            Severity: Minor
                            Found in bemuse/src/app/ui/ModeSelectScene.tsx - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language