Showing 274 of 508 total issues
Function _getScratch
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function _getScratch(input) {
const objects = context.refs['p1_SC']
if (!objects) return 0
scratchY = null
for (const p of input) {
Function removeFolders
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function removeFolders(
state: CustomFolderState,
handle: FileSystemDirectoryHandle,
io: CustomFolderScanIO
): Promise<ScanIterationResult | undefined> {
Function BarDots
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const BarDots: FC<BarDots> = (props) => {
const { measureInfo } = props
if (!measureInfo.measureEndBeat) return null
const measureSize = measureInfo.measureEndBeat - measureInfo.measureStartBeat
if (!measureSize) return null
Function MusicInfoTabs
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const MusicInfoTabs = (props: MusicInfoTabsProps) => {
const [selectedTab, setSelectedTab] = useState(0)
const onClick = (index: number) => () => setSelectedTab(index)
return (
<section className='MusicInfoTabs'>
Function simultaneous
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function simultaneous(target: Progress) {
const queue: Progress[] = []
let current: Progress | undefined
let unsubscribe: (() => void) | null = null
function update() {
Function Cache
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function Cache(path) {
const data = load()
const stream = fs.createWriteStream(path, { encoding: 'utf-8', flags: 'a' })
function load() {
Function _copyAndTrimNpmrcFile
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
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());
Function fromBMSChart
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static fromBMSChart(chart: BMSChart) {
void BMSChart
const segments: SpeedSegment[] = []
let x = 0
segments.push({
Function fromBMSChart
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static fromBMSChart(chart: BMSChart) {
void BMSChart
const info: Partial<ISongInfoData> = {}
let title = chart.headers.get('title')
const artist = chart.headers.get('artist')
Function constructor
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
constructor(
base: string | URL | IResources,
options: {
metadataFilename?: string
fallback?: string | IResources
Function fromBMSChart
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static fromBMSChart(chart: BMSChart) {
void BMSChart
const segments: SpacingSegment[] = []
chart.objects.allSorted().forEach(function (object) {
if (object.channel === 'SP') {
Function Content
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const Content = () => {
const [state, setState] = useState<LoadState>({ type: 'loading' })
useEffect(
() =>
void (async () => {
Function constructor
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
constructor (options) {
this._context = options.context
this._object = options.object
this._children = options.children
this._bindings = []
Function gameFinish
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function gameFinish(song, chart, gameState, gameMode) {
const player = gameState.game.players[0]
const notechart = player.notechart
const state = gameState.player(player)
const stats = state.stats
Function play
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const play = () => {
state口.next({ type: 'started' })
const remote = music({
a() {
const latency = Math.max(0, getLatency(samples))
Function _shouldJudge
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_shouldJudge(note: GameNote, control: Control, buffer: NoteBuffer) {
const status = this.getNoteStatus(note)
if (status === 'unjudged') {
if (this._shouldAutoplay() && this._gameTime >= note.time) {
this.tainted = true
Function showResult
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function showResult(
player: Player,
playerState: PlayerState,
chart: Chart,
sceneDisplayContext: SceneDisplayContext
Function song
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const song = await new Promise<Song>((resolve, reject) => {
const worker = new Worker(
// @ts-ignore
new URL('./song-loader.worker.js', import.meta.url)
)
Function hasScratch
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
export function hasScratch(bmson: Bmson) {
const soundChannels = soundChannelsForBmson(bmson)
if (soundChannels) {
for (const { notes } of soundChannels) {
for (const { x } of notes) {
- Read upRead up
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 download
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
export function download(
url,
{ getRetryDelay = () => 1000 + Math.random() * 4000 } = {}
) {
return {
- Read upRead up
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"