bemusic/bemuse

View on GitHub

Showing 274 of 508 total issues

Function scanFolder has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export async function scanFolder(
  context: CustomFolderContext,
  io: CustomFolderScanIO
) {
  let state = await getCustomFolderState(context)
Severity: Minor
Found in bemuse/src/custom-folder/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 use has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  use(plugin: IGameInputPlugin) {
    const state: { [key: string]: number } = {}
    const name = 'input:' + plugin.name
    this._plugins.push({
      get: bench.wrap(name, function () {
Severity: Minor
Found in bemuse/src/game/input/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 updateFolders has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

async function updateFolders(
  state: CustomFolderState,
  handle: FileSystemDirectoryHandle,
  io: CustomFolderScanIO
): Promise<ScanIterationResult | undefined> {
Severity: Minor
Found in bemuse/src/custom-folder/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 getTweetLink has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

const getTweetLink = ({ chart, result }: { chart: Chart; result: Result }) => {
  const title = chart.info.title
  let subtitle = chart.info.subtitles[0] || ''
  const score = result.score
  const grade = result.grade
Severity: Minor
Found in bemuse/src/app/ui/ResultScene.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 ComboBox has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export function ComboBox<T extends ComboBoxItem>(props: {
  items: T[]
  onSelect: (item: T) => void
}) {
  const [inputItems, setInputItems] = useState(props.items)
Severity: Minor
Found in bemuse/src/ui-dialogs/ComboBox.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 fromBMSChart has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function fromBMSChart(bms: BMS.BMSChart, playerOptions: PlayerOptions) {
  const notes = BMS.Notes.fromBMSChart(bms, {
    mapping: playerOptions.double
      ? BMS.Notes.CHANNEL_MAPPING.IIDX_DP
      : BMS.Notes.CHANNEL_MAPPING.IIDX_P1,
Severity: Minor
Found in packages/bemuse-notechart/src/loader/BMSNotechartLoader.ts - About 1 hr to fix

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

      instantiate(context, container) {
        let text
        if (this.ttf) {
          text = new PIXI.Text(this.text, {
            font: this.font,
    Severity: Minor
    Found in bemuse/src/scintillator/nodes/text.js - About 1 hr to fix

      Function doSignUp has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        const doSignUp = async (formData: AuthenticationFormData) => {
          if (!formData.username.trim()) {
            throw new Error('Please enter a username.')
          }
          if (!formData.username.match(/^\S+$/)) {
      Severity: Minor
      Found in bemuse/src/online/ui/AuthenticationPanel.tsx - About 1 hr to fix

        Function showQuickPick has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export async function showQuickPick<T extends QuickPickItem>(
          items: T[],
          options: QuickPickOptions
        ) {
          return registerActiveModal(
        Severity: Minor
        Found in bemuse/src/ui-dialogs/index.tsx - About 1 hr to fix

          Function send has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function send(category, action, label, value, extra) {
            console.log('[Analytics]', category, action, label, value, extra)
            ga('send', 'event', category, action, label, value)
            try {
              if (window.ga) {
          Severity: Minor
          Found in bemuse/src/app/analytics.js - About 1 hr to fix

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

            export function main() {
              const renderer = PIXI.autoDetectRenderer(640, 480)
              const stage = new PIXI.Stage(0x8b8685)
              const loader = new PIXI.loaders.Loader()
              const urls = [
            Severity: Minor
            Found in bemuse/src/devtools/playgrounds/font.js - About 1 hr to fix

              Function load has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                load(md5: string): Promise<T[]> {
                  if (!this.pending) {
                    const set = new Set<string>()
                    this.pending = {
                      set,
              Severity: Minor
              Found in bemuse/src/online/BatchedFetcher.ts - About 1 hr to fix

                Function scanAllChartFiles has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

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

                  Function searchForChartFiles has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  async function searchForChartFiles(
                    directoryHandle: FileSystemDirectoryHandle,
                    chartFileScanner: ChartFileScanner,
                    io: CustomFolderScanIO,
                    parentPath: string[] = []
                  Severity: Minor
                  Found in bemuse/src/custom-folder/index.ts - About 1 hr to fix

                    Consider simplifying this complex logical expression.
                    Open

                          if (params.score > (+gameScore.get('score') || -1)) {
                            gameScore.set('recordedAt', new Date())
                            gameScore.set('score', params.score)
                            gameScore.set('combo', params.combo)
                            gameScore.set('total', params.total)
                    Severity: Major
                    Found in bemuse/src/online/parse/cloud-code/cloud/main.js - About 1 hr to fix

                      Function generateBaseConfig has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function generateBaseConfig() {
                        const config = {
                          mode: Env.production() ? 'production' : 'development',
                          context: path('src'),
                          resolve: webpackResolve,
                      Severity: Minor
                      Found in bemuse/config/webpack.js - About 55 mins 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 findRushJsonFolder has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function findRushJsonFolder() {
                          if (!_rushJsonFolder) {
                              let basePath = __dirname;
                              let tempPath = __dirname;
                              do {
                      Severity: Minor
                      Found in common/scripts/install-run.js - About 55 mins 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 BarDots has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                      const BarDots: FC<BarDots> = (props) => {
                        const { measureInfo } = props
                        if (!measureInfo.measureEndBeat) return null
                        const measureSize = measureInfo.measureEndBeat - measureInfo.measureStartBeat
                        if (!measureSize) return null
                      Severity: Minor
                      Found in bemuse/src/previewer/PreviewInfo.tsx - About 55 mins 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 installAndRun has a Cognitive Complexity of 9 (exceeds 5 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 55 mins 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 9 (exceeds 5 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 55 mins 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