Showing 120 of 336 total issues
Function test
has 273 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected test () {
it('only initializes once', () => {
const spy = vi.spyOn(plyr, 'setup')
playbackService.init(document.querySelector('.plyr')!)
Function test
has 234 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected test () {
it('gets a song by ID', () => {
const song = reactive(factory<Song>('song', { id: 'foo' }))
songStore.vault.set('foo', reactive(song))
songStore.vault.set('bar', reactive(factory<Song>('song', { id: 'bar' })))
Function test
has 187 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected test () {
it('queues and plays', async () => {
const queueMock = this.mock(queueStore, 'queueIfNotQueued')
const playMock = this.mock(playbackService, 'play')
const song = factory<Song>('song', { playback_state: 'Stopped' })
Function useDroppable
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
Open
export const useDroppable = (acceptedTypes: DraggableType[]) => {
const acceptsDrop = (event: DragEvent) => {
const type = getDragType(event)
return Boolean(type && acceptedTypes.includes(type))
}
- 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 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected test () {
it('initializes with current user', () => {
expect(userStore.current).toEqual(currentUser)
expect(userStore.vault.size).toBe(1)
})
Function init
has 93 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const init = (container: HTMLElement) => {
const uniforms = {
u_time: {
type: 'f',
value: 2.0
File playbackService.spec.ts
has 314 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { nextTick, reactive } from 'vue'
import plyr from 'plyr'
import lodash from 'lodash'
import { expect, it, vi } from 'vitest'
import { noop } from '@/utils'
Function initShader
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
initShader () {
const screenRes = 'vec2( ' + this.w.toFixed(1) + ', ' + this.h.toFixed(1) + ')'
const load = (_vert, _frag) => new THREE.ShaderMaterial({
defines: {
Function test
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected test () {
it('returns all queued songs', () => expect(queueStore.all).toEqual(songs))
it('returns the first queued song', () => expect(queueStore.first).toEqual(songs[0]))
Function test
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected test () {
it('toggles the playback of current song', async () => {
const toggleMock = this.mock(playbackService, 'toggle')
this.renderComponent(factory<Song>('song'))
Function init
has 83 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const init = async (container: HTMLElement) => {
const gl = document.createElement('canvas').getContext('webgl')!
const postctx = container.appendChild(document.createElement('canvas')).getContext('2d')!
const postprocess = postctx.canvas
const canvas = gl.canvas
Function useSongList
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
Open
export const useSongList = (
songs: Ref<Song[]>,
config: Partial<SongListConfig> = { sortable: true, reorderable: true }
) => {
const filterKeywords = ref('')
- 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 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected test () {
it('serializes playlist for storage', () => {
expect(playlistStore.serializeSmartPlaylistRulesForStorage(ruleGroups)).toEqual(serializedRuleGroups)
})
Function test
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected test () {
it('edits a standard playlist', async () => {
const playlist = factory<Playlist>('playlist')
await this.renderComponent(playlist)
const emitMock = this.mock(eventBus, 'emit')
Function test
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected test () {
it('renames', async () => {
const folder = factory<PlaylistFolder>('playlist-folder')
await this.renderComponent(folder)
const emitMock = this.mock(eventBus, 'emit')
Function test
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected test () {
it('edits a single song', async () => {
const updateMock = this.mock(songStore, 'update')
const emitMock = this.mock(eventBus, 'emit')
const alertMock = this.mock(MessageToasterStub.value, 'success')
Function test
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected test () {
it('gets an artist by ID', () => {
const artist = factory<Artist>('artist')
artistStore.vault.set(artist.id, artist)
expect(artistStore.byId(artist.id)).toEqual(artist)
Function test
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected test () {
it('gets an album by ID', () => {
const album = factory<Album>('album')
albumStore.vault.set(album.id, album)
expect(albumStore.byId(album.id)).toEqual(album)
File playbackService.ts
has 284 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import isMobile from 'ismobilejs'
import plyr from 'plyr'
import { watch } from 'vue'
import { shuffle, throttle } from 'lodash'
File InitCommand.php
has 282 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
namespace App\Console\Commands;
use App\Console\Commands\Traits\AskForPassword;