Showing 274 of 508 total issues
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());
- 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 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)
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,
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> {
File MusicTable.tsx
has 264 lines of code (exceeds 250 allowed). Consider refactoring. Open
import _ from 'lodash'
import MusicSelectPreviewer from 'bemuse/music-previewer/MusicSelectPreviewer'
import getPlayableCharts from 'bemuse/music-collection/getPlayableCharts'
import getPreviewResourceUrl from 'bemuse/music-collection/getPreviewResourceUrl'
import groupSongsIntoCategories from 'bemuse/music-collection/groupSongsIntoCategories'
Consider simplifying this complex logical expression. Open
if (!original || score > original.score) {
return Object.assign({}, original || {}, {
id: original?.id || ObjectID.generate(),
score: score,
playCount: nextPlayCount,
Function getSongInfo
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function getSongInfo(
files: IndexingInputFile[],
options?: {
cache?: {
get(md5: string): OutputFileInfo
File index.js
has 262 lines of code (exceeds 250 allowed). Consider refactoring. Open
const yargs = require('yargs')
const execa = require('execa')
const vfs = require('vinyl-fs')
const fs = require('fs')
const merge = require('merge-stream')
Function updateChangelog
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
function updateChangelog(existingChangelog, entries, version = 'UNRELEASED') {
const userListRegExp = /((?:\[@\w+\]: https.+\n)+)/
const userList = existingChangelog.match(userListRegExp)
if (!userList) {
throw new Error('Cannot find user list in changelog')
Function slicesForNotesAndTiming
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
export function slicesForNotesAndTiming(
notes: Note[],
timing: BMS.Timing,
options: { beatForPulse: (pulse: number) => number }
) {
- 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
File Options.ts
has 259 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { PayloadAction, createSlice } from '@reduxjs/toolkit'
import { Draft } from 'immer'
import { MappingMode } from '../../rules/mapping-mode'
import { StoredOptions } from '../types'
Function ChildManager
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
function ChildManager(expr, child, poolSize) {
return {
instantiate(context, subject) {
const instances = new Map()
const pool = []
Function getViewport
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
getViewport(currentTime: number, hiSpeed: number): PreviewViewport {
const beat = this._secondsToBeat(currentTime)
const position = this._notechart.beatToPosition(beat)
const speed = this._notechart.spacingAtBeat(beat)
const windowSize = 4 / speed / hiSpeed
Function getName
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function getName(key: string) {
if (+key) {
return _.capitalize(keycode(+key))
}
{
Function music
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
function music(master: SamplingMaster, samples: Samples) {
return function play(callbacks: { a: () => void }) {
master.unmute()
const BPM = 148
Function createFader
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
function createFader(audio, initialVolume, onTargetReached) {
let targetVolume = 0
let currentSpeed = 0
let requested = false
let volumeChanged
- 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 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) {
- 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 _setupInteractivity
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
_setupInteractivity() {
let mouse = null
let touches = []
const onMouse = (e) => {
mouse = e
Function constructor
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(initialBPM: number, actions: TimingAction[]) {
const state = { bpm: initialBPM, beat: 0, seconds: 0 }
const segments: TimingSegment[] = []
segments.push({
t: 0,
Function instantiate
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
instantiate(context, subject) {
const instances = new Map()
const pool = []
initPool()
return new Instance({