Showing 134 of 387 total issues
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')
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')
albumStore.vault.set(album.id, album)
expect(albumStore.byId(album.id)).toEqual(album)
Function usePlaylistManagement
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
Open
export const usePlaylistManagement = () => {
const { handleHttpError } = useErrorHandler('dialog')
const { toastSuccess } = useMessageToaster()
const inflect = (playables: Playable[]) => {
- 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 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected test () {
it('pauses playback', async () => {
const pauseMock = this.mock(playbackService, 'pause')
this.renderComponent(factory('episode', {
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
File NoiseBlob.ts
has 276 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import * as THREE from 'three'
import type { ThreeSharedRenderer } from './ThreeSharedRenderer'
import type { ThreePBR } from './ThreePBR'
import type { ThreePointLight } from './ThreePointLight'
import type { AudioAnalyzer } from './AudioAnalyzer'
File songStore.spec.ts
has 275 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { reactive } from 'vue'
import { expect, it } from 'vitest'
import isMobile from 'ismobilejs'
import UnitTestCase from '@/__tests__/UnitTestCase'
import factory from '@/__tests__/factory'
Function useDroppable
has 64 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))
}
Function test
has 62 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 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'],
Function checkServiceIntegrations
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
Open
private function checkServiceIntegrations(): void
{
if (!LastfmService::enabled()) {
$this->reportWarning('Last.fm integration', 'Not available');
} else {
- 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
queueStore
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
Open
export const queueStore = {
state: reactive<{ playables: Playable[] }>({
playables: [],
}),
DoctorCommand
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class DoctorCommand extends Command
{
protected $signature = 'koel:doctor';
protected $description = 'Check Koel setup';
SongRepository
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class SongRepository extends Repository
{
private const DEFAULT_QUEUE_LIMIT = 500;
public function findOneByPath(string $path): ?Song
Function test
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected test () {
const { get: lsGet, set: lsSet } = useLocalStorage(false)
it('gets the token', () => {
lsSet('api-token', 'foo')
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> = {},
) => {
Method __construct
has 18 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
public float $volume,
public string $repeatMode,
public Equalizer $equalizer,
public string $artistsViewMode,
public string $albumsViewMode,
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()
})
Method checkServiceIntegrations
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function checkServiceIntegrations(): void
{
if (!LastfmService::enabled()) {
$this->reportWarning('Last.fm integration', 'Not available');
} else {
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')
this.be(user).renderComponent(user)