bemusic/bemuse

View on GitHub
bemuse/src/app/game-launcher.tsx

Summary

Maintainability
C
1 day
Test Coverage

File game-launcher.tsx has 322 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import * as Analytics from './analytics'
import * as Options from './entities/Options'

import { Chart, Song } from 'bemuse/collection-model/types'
import { ReactScene, SceneManager } from 'bemuse/scene-manager'
Severity: Minor
Found in bemuse/src/app/game-launcher.tsx - About 3 hrs to fix

    Function launchGame has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

    async function launchGame(
      {
        server,
        song,
        chart,
    Severity: Minor
    Found in bemuse/src/app/game-launcher.tsx - About 3 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 findVideoUrl has a Cognitive Complexity of 16 (exceeds 5 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 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 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 showResult has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function showResult(
        player: Player,
        playerState: PlayerState,
        chart: Chart,
        sceneDisplayContext: SceneDisplayContext
      Severity: Minor
      Found in bemuse/src/app/game-launcher.tsx - About 1 hr to fix

        There are no issues that match your filters.

        Category
        Status