Showing 120 of 336 total issues
PlaybackService
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class PlaybackService {
public player!: Plyr
private repeatModes: RepeatMode[] = ['NO_REPEAT', 'REPEAT_ALL', 'REPEAT_ONE']
private initialized = false
Function listenToMediaEvents
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
Open
private listenToMediaEvents (media: HTMLMediaElement) {
media.addEventListener('error', () => this.playNext(), true)
media.addEventListener('ended', () => {
if (commonStore.state.use_last_fm && userStore.current.preferences!.lastfm_session_key) {
- 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
songStore
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
Open
export const songStore = {
vault: new Map<string, UnwrapNestedRefs<Song>>(),
state: reactive({
songs: [] as Song[]
Function test
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected test () {
it.each([
[0, '00:00'],
[59, '00:59'],
[60, '01:00'],
File NoiseBlob.ts
has 269 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import * as THREE from 'three'
import { ThreeSharedRenderer } from './ThreeSharedRenderer'
import { ThreePBR } from './ThreePBR'
import { ThreePointLight } from './ThreePointLight'
import { AudioAnalyzer } from './AudioAnalyzer'
Function useDroppable
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const useDroppable = (acceptedTypes: DraggableType[]) => {
const acceptsDrop = (event: DragEvent) => {
const type = getDragType(event)
return Boolean(type && acceptedTypes.includes(type))
}
queueStore
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
Open
export const queueStore = {
state: reactive<{ songs: Song[] }>({
songs: []
}),
Function useFloatingUi
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const useFloatingUi = (
reference: HTMLElement | Ref<HTMLElement | undefined>,
floating: HTMLElement | Ref<HTMLElement | undefined>,
config: Partial<Config> = {}
) => {
SongRepository
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class SongRepository extends Repository
{
use Searchable;
public const SORT_COLUMNS_NORMALIZE_MAP = [
Function test
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected test () {
it('renders for album', () => {
expect(this.renderForAlbum().html()).toMatchSnapshot()
})
Function test
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected test () {
it('has different behaviors for current user', () => {
const user = factory<User>('user')
this.actingAs(user).renderComponent(user)
File songStore.spec.ts
has 251 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { reactive } from 'vue'
import isMobile from 'ismobilejs'
import UnitTestCase from '@/__tests__/UnitTestCase'
import { expect, it } from 'vitest'
import factory from '@/__tests__/factory'
Function test
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected test () {
it('initializes the store', () => {
const applyMock = this.mock(themeStore, 'applyThemeFromPreference')
themeStore.init()
Function test
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected test () {
it('renders', async () => expect((await this.renderComponent()).html()).toMatchSnapshot())
it('plays all', async () => {
const songs = factory<Song>('song', 10)
Function test
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected test () {
it('toggles one song', async () => {
const addMock = this.mock(favoriteStore, 'add')
const removeMock = this.mock(favoriteStore, 'remove')
const postMock = this.mock(http, 'post')
Function test
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected test () {
it('renders', async () => expect((await this.renderComponent()).html()).toMatchSnapshot())
it('plays all', async () => {
const songs = factory<Song>('song', 10)
Function update
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
Open
update () {
this.analyzer.getByteFrequencyData(this.audioBuffer)
let bass = 0., mid = 0., high = 0.
if (this.audioBuffer[0] === 0) {
- 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 test
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected test () {
it('renders', () => {
playlistStore.state.playlists = [
factory<Playlist>('playlist', { name: 'Foo' }),
factory<Playlist>('playlist', { name: 'Bar' }),
Method handle
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function handle(): int
{
$this->alert('KOEL INSTALLATION WIZARD');
$this->info(
'As a reminder, you can always install/upgrade manually following the guide at '
Function test
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected test () {
it('fetches the artist info', async () => {
const artist = artistStore.syncWithVault(factory<Artist>('artist', { id: 42 }))[0]
const artistInfo = factory<ArtistInfo>('artist-info')
const getMock = this.mock(http, 'get').mockResolvedValue(artistInfo)