bemusic/bemuse

View on GitHub

Showing 274 of 508 total issues

Function _SoX has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  async _SoX(path, type) {
    let typeArgs = []
    try {
      const fd = await fs.promises.open(path, 'r')
      const buffer = Buffer.alloc(4)
Severity: Minor
Found in packages/bemuse-tools/src/audio.js - About 1 hr to fix

    Function as has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        async as(type, progress) {
          let shouldGiveUp = false
          for (let i = 1; ; i++) {
            try {
              return await attempt()
    Severity: Minor
    Found in bemuse/src/utils/download.js - About 1 hr to fix

      Function OptionsAdvanced has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const OptionsAdvanced = () => {
        const dispatch = useDispatch()
        const options = useSelector(selectOptions)
      
        const handleAudioInputLatencyChange = (value: number) => {
      Severity: Minor
      Found in bemuse/src/app/ui/OptionsAdvanced.tsx - About 1 hr to fix

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

        export function main() {
          sceneRoot.render(
            <QueryClientProvider client={queryClient}>
              <div style={{ margin: '0 auto', maxWidth: '32em', padding: '0 1em' }}>
                <h1>Bemuse custom songs folder console</h1>
        Severity: Minor
        Found in bemuse/src/devtools/playgrounds/custom-folder.tsx - About 1 hr to fix

          Function createNullNotechartPreview has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function createNullNotechartPreview(): NotechartPreview {
            const warning =
              location.hostname !== 'bemuse.ninja'
                ? ' [NOTE: Do not bookmark this URL because it is a preview and this URL will stop working in the future.]'
                : ''
          Severity: Minor
          Found in bemuse/src/previewer/NotechartPreview.ts - About 1 hr to fix

            Function fakeWindow has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function fakeWindow() {
              const events = new EventEmitter()
              const gamepads = []
              const noop = () => {}
              return {
            Severity: Minor
            Found in bemuse/src/omni-input/index.spec.js - About 1 hr to fix

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

                Function CollectionViewer has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export const CollectionViewer = () => {
                  const [status, setStatus] = useState('Loading')
                  const [data, setData] = useState<MusicServerIndex | null>(null)
                
                  const url = query.server || OFFICIAL_SERVER_URL
                Severity: Minor
                Found in bemuse/src/music-collection-viewer/CollectionViewer.tsx - About 1 hr to fix

                  Function findVideoUrl has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  async function findVideoUrl(song: Song, assets: LoadSpec['assets']) {
                    if (song.video_url) {
                      return song.video_url
                    }
                    if (song.video_file) {
                  Severity: Minor
                  Found in bemuse/src/app/game-launcher.tsx - About 1 hr to fix

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

                      Function get has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          get() {
                            const data = input.update()
                      
                            const result = {
                              p1_1: data[kbm['1'] || '83'],
                      Severity: Minor
                      Found in bemuse/src/game/input/omni-input-plugin.js - About 1 hr to fix

                        Function Benchmarker has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function Benchmarker() {
                          const stats = {}
                          const bench = {
                            enabled: true,
                            stats,
                        Severity: Minor
                        Found in bemuse/src/devtools/benchmark.js - About 1 hr to fix

                          Function showAlert has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export async function showAlert(title: string, message: ReactNode) {
                            await registerActiveModal(
                              new Promise<void>((resolve) => {
                                const container = document.createElement('div')
                                const root = createRoot(container)
                          Severity: Minor
                          Found in bemuse/src/ui-dialogs/index.tsx - About 1 hr to fix

                            Function _resolvePackageVersion has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function _resolvePackageVersion(logger, rushCommonFolder, { name, version }) {
                                if (!version) {
                                    version = '*'; // If no version is specified, use the latest version
                                }
                                if (version.match(/^[a-zA-Z0-9\-\+\.]+$/)) {
                            Severity: Minor
                            Found in common/scripts/install-run.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 constructor has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                            Open

                              constructor (options) {
                                this._context = options.context
                                this._object = options.object
                                this._children = options.children
                                this._bindings = []
                            Severity: Minor
                            Found in bemuse/src/scintillator/nodes/lib/instance.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 fromBMSChart has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                            Open

                              static fromBMSChart(chart: BMSChart) {
                                void BMSChart
                                const info: Partial<ISongInfoData> = {}
                                let title = chart.headers.get('title')
                                const artist = chart.headers.get('artist')
                            Severity: Minor
                            Found in packages/bms/src/song-info/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 _run has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function _run() {
                                const [nodePath /* Ex: /bin/node */, scriptPath /* /repo/common/scripts/install-run-rush.js */, ...packageBinArgs /* [build, --to, myproject] */] = process.argv;
                                // Detect if this script was directly invoked, or if the install-run-rushx script was invokved to select the
                                // appropriate binary inside the rush package to run
                                const scriptName = path.basename(scriptPath);
                            Severity: Minor
                            Found in common/scripts/install-run-rush.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 getTouchedColumn has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                            Open

                            export function getTouchedColumn(x, y) {
                              let min = 0.75
                              let max = 1
                              let mid
                              let row
                            Severity: Minor
                            Found in bemuse/src/game/display/touch3d.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 compile has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                            Open

                            export function compile(text: string, options?: Partial<BMSCompileOptions>) {
                              options = options || {}
                            
                              const chart = new BMSChart()
                            
                            
                            Severity: Minor
                            Found in packages/bms/src/compiler/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 Buttons has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                            Open

                            const Buttons = ({ song }: MusicInfoTabInformationProps) => {
                              const buttons = []
                              if (song.bms_url) {
                                buttons.push(<Link text='Download BMS' url={song.bms_url} />)
                              }
                            Severity: Minor
                            Found in bemuse/src/app/ui/MusicInfoTabInformation.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

                            Severity
                            Category
                            Status
                            Source
                            Language