bemusic/bemuse

View on GitHub

Showing 508 of 508 total issues

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

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

          it('is always 555555 in best case', function () {
            const stats = statsFor1000Notes()
            assert(stats.maxPossibleScore === 555555)
            for (let i = 0; i < 1000; i++) {
              stats.handleJudgment(1)
      Severity: Major
      Found in bemuse/src/game/state/player-stats.spec.js and 1 other location - About 2 hrs to fix
      bemuse/src/game/state/player-stats.spec.js on lines 36..43

      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 87.

      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 detect UTF-16LE', function () {
            expect(Reader.read(fixture('jp.utf16le'))).to.match(/色は匂へど/)
            expect(Reader.read(fixture('jp.utf16le')).charCodeAt(0)).not.to.equal(
              0xfeff
            )
      Severity: Major
      Found in packages/bms/spec/reader_spec.js and 1 other location - About 2 hrs to fix
      packages/bms/spec/reader_spec.js on lines 40..45

      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 87.

      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 detect UTF-16BE', function () {
            expect(Reader.read(fixture('jp.utf16be'))).to.match(/色は匂へど/)
            expect(Reader.read(fixture('jp.utf16be')).charCodeAt(0)).not.to.equal(
              0xfeff
            )
      Severity: Major
      Found in packages/bms/spec/reader_spec.js and 1 other location - About 2 hrs to fix
      packages/bms/spec/reader_spec.js on lines 33..38

      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 87.

      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('is always 55555 in best case', function () {
            const stats = statsFor1000Notes()
            assert(stats.maxPossibleComboScore === 55555)
            for (let i = 0; i < 1000; i++) {
              stats.handleJudgment(1)
      Severity: Major
      Found in bemuse/src/game/state/player-stats.spec.js and 1 other location - About 2 hrs to fix
      bemuse/src/game/state/player-stats.spec.js on lines 57..64

      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 87.

      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 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

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

          it('handles modulation lever', function () {
            this.midi(0xbc, 0x01, 0x7f)
            assert(this.input.update()['midi.1234.12.mod'])
            this.midi(0xbc, 0x01, 0x00)
            assert(!this.input.update()['midi.1234.12.mod'])
      Severity: Major
      Found in bemuse/src/omni-input/index.spec.js and 1 other location - About 2 hrs to fix
      bemuse/src/omni-input/index.spec.js on lines 127..132

      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 85.

      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('handles sustain pedal', function () {
            this.midi(0xbc, 0x40, 0x7f)
            assert(this.input.update()['midi.1234.12.sustain'])
            this.midi(0xbc, 0x40, 0x00)
            assert(!this.input.update()['midi.1234.12.sustain'])
      Severity: Major
      Found in bemuse/src/omni-input/index.spec.js and 1 other location - About 2 hrs to fix
      bemuse/src/omni-input/index.spec.js on lines 133..138

      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 85.

      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 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

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

                <label hidden={mode !== 'signUp'}>
                  <span className='AuthenticationFormのlabel'>Confirm Password</span>
                  <span className='AuthenticationFormのcontrol'>
                    <input type='password' defaultValue='' ref={passwordConfirmRef} />
                  </span>
        Severity: Major
        Found in bemuse/src/online/ui/AuthenticationForm.tsx and 1 other location - About 2 hrs to fix
        bemuse/src/online/ui/AuthenticationForm.tsx on lines 53..58

        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 84.

        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

                <label hidden={mode !== 'signUp'}>
                  <span className='AuthenticationFormのlabel'>Email</span>
                  <span className='AuthenticationFormのcontrol'>
                    <input type='email' defaultValue='' ref={emailRef} />
                  </span>
        Severity: Major
        Found in bemuse/src/online/ui/AuthenticationForm.tsx and 1 other location - About 2 hrs to fix
        bemuse/src/online/ui/AuthenticationForm.tsx on lines 65..70

        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 84.

        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 _copyAndTrimNpmrcFile has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

        function _copyAndTrimNpmrcFile(logger, sourceNpmrcPath, targetNpmrcPath) {
            logger.info(`Transforming ${sourceNpmrcPath}`); // Verbose
            logger.info(`  --> "${targetNpmrcPath}"`);
            let npmrcFileLines = fs.readFileSync(sourceNpmrcPath).toString().split('\n');
            npmrcFileLines = npmrcFileLines.map((line) => (line || '').trim());
        Severity: Minor
        Found in common/scripts/install-run.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 ComboBox has 60 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function ComboBox<T extends ComboBoxItem>(props: {
          items: T[]
          onSelect: (item: T) => void
        }) {
          const [inputItems, setInputItems] = useState(props.items)
        Severity: Major
        Found in bemuse/src/ui-dialogs/ComboBox.tsx - About 2 hrs to fix

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

              it('sets note explode time', function () {
                const info = { judgment: 1, delta: 0, combo: 123, column: 'SC' }
                update(12, 34, makeState({ notifications: { judgments: [info] } }))
                assert(data['SC_explode'] === 12)
              })
          Severity: Major
          Found in bemuse/src/game/display/player-display.spec.js and 1 other location - About 2 hrs to fix
          bemuse/src/game/display/player-display.spec.js on lines 113..117

          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 83.

          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('sets combo', function () {
                const info = { judgment: 1, delta: 0, combo: 123, column: 'SC' }
                update(12, 34, makeState({ notifications: { judgments: [info] } }))
                assert(data['combo'] === 123)
              })
          Severity: Major
          Found in bemuse/src/game/display/player-display.spec.js and 1 other location - About 2 hrs to fix
          bemuse/src/game/display/player-display.spec.js on lines 118..122

          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 83.

          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 index.ts has 266 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import _ from 'lodash'
          import * as BMS from 'bms'
          import invariant from 'invariant'
          import {
            NotechartInput,
          Severity: Minor
          Found in packages/bemuse-notechart/src/index.ts - About 2 hrs to fix

            Function updateFolders has 59 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            async function updateFolders(
              state: CustomFolderState,
              handle: FileSystemDirectoryHandle,
              io: CustomFolderScanIO
            ): Promise<ScanIterationResult | undefined> {
            Severity: Major
            Found in bemuse/src/custom-folder/index.ts - About 2 hrs to fix

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

              const TRANSITIONAL_BEGINNER_LV5_TIMEGATES: Timegates = [
                { value: 1, timegate: 0.021, endTimegate: 0.042 },
                { value: 2, timegate: 0.06, endTimegate: 0.12 },
                { value: 3, timegate: 0.12, endTimegate: 0.2 },
                { value: 4, timegate: 0.2, endTimegate: 0.2 },
              Severity: Major
              Found in bemuse/src/game/judgments.ts and 2 other locations - About 2 hrs to fix
              bemuse/src/game/judgments.ts on lines 38..43
              bemuse/src/game/judgments.ts on lines 44..49

              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 82.

              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 3 locations. Consider refactoring.
              Open

              const TRANSITIONAL_BEGINNER_LV3_TIMEGATES: Timegates = [
                { value: 1, timegate: 0.023, endTimegate: 0.046 },
                { value: 2, timegate: 0.08, endTimegate: 0.16 },
                { value: 3, timegate: 0.16, endTimegate: 0.2 },
                { value: 4, timegate: 0.2, endTimegate: 0.2 },
              Severity: Major
              Found in bemuse/src/game/judgments.ts and 2 other locations - About 2 hrs to fix
              bemuse/src/game/judgments.ts on lines 32..37
              bemuse/src/game/judgments.ts on lines 38..43

              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 82.

              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