Showing 143 of 661 total issues
File queue.ts
has 290 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import logger from 'electron-timber';
import _, { isEmpty, isString } from 'lodash';
import { createStandardAction } from 'typesafe-actions';
import { v4 } from 'uuid';
Function useTreeData
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const useTreeData = (tracks, localFolders) => {
return useMemo(() => {
const pathToEntryMap = {};
function getEntryForFolder(path) {
if (pathToEntryMap[path] === undefined) {
Function useVolumeControlsProps
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const useVolumeControlsProps = () => {
const { t } = useTranslation('option-control');
const dispatch = useDispatch();
const volume: number = useSelector(playerSelectors.volume);
const isMuted: boolean = useSelector(playerSelectors.muted);
Function PluginsReducer
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function PluginsReducer(state=initialState, action): PluginsState {
switch (action.type) {
case CREATE_PLUGINS:
return {
...state,
File AlbumViewContainer.test.tsx
has 279 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { waitFor } from '@testing-library/react';
import { mountedComponentFactory, setupI18Next } from '../../../test/testUtils';
import { buildStoreState } from '../../../test/storeBuilders';
import PlayerBarContainer from '../PlayerBarContainer';
import userEvent from '@testing-library/user-event';
Function findStreamsForTrack
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const findStreamsForTrack = (index: number) => async (dispatch, getState) => {
const {queue, settings}: RootState = getState();
const track = queue.queueItems[index];
if (track && !track.local && trackHasNoFirstStream(track)) {
Function getMenu
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
getMenu() {
const template = [];
// Playing status
if (this.playerContext.track) {
Function mockAlbumSongsSearch
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function mockAlbumSongsSearch() {
global.fetch = jest.fn(() =>
Promise.resolve({
json: jest.fn(() => ({
'resultCount': 2,
File PlaylistViewContainer.test.tsx
has 273 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/* eslint-disable @typescript-eslint/no-var-requires */
/* eslint-disable @typescript-eslint/ban-ts-comment */
import { fireEvent, render, waitFor } from '@testing-library/react';
import React from 'react';
import { createMemoryHistory } from 'history';
Function swaggerRouter
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function swaggerRouter(store: Store): Router {
const router = express.Router();
router.get('/swagger.json', (req, res) => {
res.json(swaggerJson);
File discogs.ts
has 267 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import _ from 'lodash';
import MetaProvider from '../metaProvider';
import * as Discogs from '../../rest/Discogs';
import LastFmApi from '../../rest/Lastfm';
Function exports
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = (env: BuildEnv): webpack.Configuration => {
if (!env.TARGET) {
env.TARGET = osMapper[os.platform() as string];
}
Function SidebarMenuContainer
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const SidebarMenuContainer: React.FC = () => {
const { t } = useTranslation('app');
const dispatch = useDispatch();
const settings = useSelector(settingsSelector);
const isCollapsed = settings.compactMenuBar;
Function AlbumPreview
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const AlbumPreview: React.FC<AlbumPreviewProps & Handlers> = (props) => {
const { album, trackButtons, handleAddToQueue, handlePlayAll } = props;
const thumb = _.defaultTo(getThumbnail(album), artPlaceholder);
Function EqualizerReducer
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function EqualizerReducer(state = getInitialState(), action:EqualizerReducerActions): EqualizerState {
let newState: EqualizerState;
switch (action.type) {
case getType(EqualizerActions.changeValue): {
File index.js
has 259 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React from 'react';
import { withRouter } from 'react-router-dom';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { compose, withProps } from 'recompose';
Function mockPodcastResult
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function mockPodcastResult() {
global.fetch = jest.fn(() =>
Promise.resolve({
json: jest.fn(() => ({
'resultCount': 1,
Function useTreeData
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
Open
const useTreeData = (tracks, localFolders) => {
return useMemo(() => {
const pathToEntryMap = {};
function getEntryForFolder(path) {
if (pathToEntryMap[path] === undefined) {
- 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 Settings
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
Open
const Settings: React.FC<SettingsProps> = ({
actions,
mastodonActions,
scrobbling,
importfavs,
- 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 hooks.ts
has 251 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { useCallback, useEffect } from 'react';
import Sound from 'react-hifi';
import { useTranslation } from 'react-i18next';
import { useDispatch, useSelector } from 'react-redux';
import { useHistory } from 'react-router-dom';