Showing 134 of 387 total issues
Function test
has 275 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected test () {
it('only initializes once', () => {
const spy = vi.spyOn(plyr, 'setup')
playbackService.init(document.querySelector('.plyr')!)
Function test
has 257 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected test () {
it('plays', async () => {
const playMock = this.mock(playbackService, 'play')
const song = factory('song', { playback_state: 'Stopped' })
await this.renderComponent(song)
Function test
has 249 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected test () {
it('gets a song by ID', () => {
const song = reactive(factory('song', { id: 'foo' }))
songStore.vault.set('foo', reactive(song))
songStore.vault.set('bar', reactive(factory('song', { id: 'bar' })))
Function useSongList
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
export const useSongList = (
playables: Ref<Playable[]>,
context: PlayableListContext = {},
config: Partial<PlayableListConfig> = {
filterable: true,
- 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 110 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected test () {
it('edits a standard playlist', async () => {
const playlist = factory('playlist')
await this.renderComponent(playlist)
const emitMock = this.mock(eventBus, 'emit')
Function test
has 103 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected test () {
it('serializes playlist for storage', () => {
expect(playlistStore.serializeSmartPlaylistRulesForStorage(ruleGroups)).toEqual(serializedRuleGroups)
})
Function useDroppable
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. 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
File playbackService.ts
has 324 lines of code (exceeds 250 allowed). Consider refactoring. Open
import isMobile from 'ismobilejs'
import plyr from 'plyr'
import { watch } from 'vue'
import { shuffle, throttle } from 'lodash'
import { commonStore } from '@/stores/commonStore'
File DoctorCommand.php
has 322 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace App\Console\Commands;
use App\Enums\SongStorageType;
Function init
has 93 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const init = (container: HTMLElement) => {
const uniforms = {
u_time: {
type: 'f',
value: 2.0,
Function test
has 92 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected test () {
it('edits a single song', async () => {
const result: SongUpdateResult = {
albums: [],
artists: [],
Function initShader
has 89 lines of code (exceeds 25 allowed). Consider refactoring. Open
initShader () {
const screenRes = `vec2( ${this.w.toFixed(1)}, ${this.h.toFixed(1)})`
const load = (_vert, _frag) => new THREE.ShaderMaterial({
defines: {
File playbackService.spec.ts
has 315 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { nextTick, reactive } from 'vue'
import plyr from 'plyr'
import lodash from 'lodash'
import { expect, it, vi } from 'vitest'
import { noop } from '@/utils/helpers'
Function init
has 87 lines of code (exceeds 25 allowed). Consider refactoring. 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 test
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected test () {
it('returns all queued songs', () => expect(queueStore.all).toEqual(playables))
it('returns the first queued song', () => expect(queueStore.first).toEqual(playables[0]))
Function test
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected test () {
it('toggles the playback of current song', async () => {
const toggleMock = this.mock(playbackService, 'toggle')
this.renderComponent(factory('song'))
Function test
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected test () {
it('renames', async () => {
const folder = factory('playlist-folder')
await this.renderComponent(folder)
const emitMock = this.mock(eventBus, 'emit')
Function listenToMediaEvents
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
private listenToMediaEvents (media: HTMLMediaElement) {
media.addEventListener('error', () => this.playNext(), true)
media.addEventListener('ended', () => {
if (
- 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 26 functions (exceeds 20 allowed). Consider refactoring. Open
export const songStore = {
vault: new Map<Playable['id'], Playable>(),
state: reactive<{ songs: Playable[] }>({
songs: [],
File PlayableContextMenu.spec.ts
has 291 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { expect, it } from 'vitest'
import UnitTestCase from '@/__tests__/UnitTestCase'
import factory from '@/__tests__/factory'
import { arrayify } from '@/utils/helpers'
import { eventBus } from '@/utils/eventBus'