Showing 143 of 661 total issues
Function exports
has 211 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = (env) => {
const IS_PROD = env.NODE_ENV === 'production';
const IS_DEV = env.NODE_ENV === 'development';
const entry = IS_PROD
Function SearchReducer
has 180 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function SearchReducer(state = initialState, action: SearchReducerActionTypes):SearchState {
switch (action.type) {
case getType(SearchActions.unifiedSearchStart):
return {
...state,
Function useCommandPaletteActions
has 178 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const useCommandPaletteActions = (): CommandPaletteAction[] => {
const history = useHistory();
const dispatch = useDispatch();
const { t } = useTranslation('command-palette');
const settings = useSelector(settingsSelector);
Function actions
has 158 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const actions = () => {
return [{
id: 'play',
name: t('actions.play'),
shortcut: ['space'],
File index.ts
has 375 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { app, remote } from 'electron';
import { v4 } from 'uuid';
export enum SettingType {
BOOLEAN = 'boolean',
Function StreamVerificationContainer
has 113 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const StreamVerificationContainer: React.FC = () => {
const { t } = useTranslation('queue');
const dispatch = useDispatch();
const queue = useSelector(queueSelector);
const settings = useSelector(settingsSelector);
Function SpotifyPlaylistImporter
has 109 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const SpotifyPlaylistImporter: React.FC= () => {
const { t } = useTranslation('playlists');
const { onAccept, importProgress, playlistMeta, onClose } = useSpotifyPlaylistImporterProps(t);
const progressPercent = Math.round((playlistMeta?.totalTracks ? importProgress/playlistMeta.totalTracks : 0) * 100);
Function ipcConnect
has 108 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const ipcConnect: Middleware = () => next => {
next({
type: LocalLibrary.UPDATE_LOCAL_FOLDERS,
payload: ipcRenderer.sendSync(IpcEvents.LOCALFOLDERS_GET)
});
Function useTrackPopupProps
has 106 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const useTrackPopupProps = (track, thumb) => {
const { localPlaylists: playlists } = useLocalPlaylists();
const settings = useSelector(settingsSelector);
const plugins: any = useSelector(pluginsSelectors.plugins);
Function findStreamsForTrack
has a Cognitive Complexity of 27 (exceeds 5 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)) {
- 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 useAlbumViewProps
has 96 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const useAlbumViewProps = () => {
const dispatch = useDispatch();
const history = useHistory();
const { albumId } = useParams<{ albumId: string }>();
File PlayerBarContainer.test.tsx
has 318 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React from 'react';
import { fireEvent, render, waitFor } from '@testing-library/react';
import { AnyProps, configureMockStore, setupI18Next, TestStoreProvider } from '../../../test/testUtils';
import { getMouseEvent } from '../../../test/mockMouseEvent';
Function mockPodcastEpisodesResult
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function mockPodcastEpisodesResult() {
global.fetch = jest.fn(() =>
Promise.resolve({
json: jest.fn(() => ({
'resultCount': 2,
Function componentDidMount
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
componentDidMount() {
const { actions } = this.props;
ipcRenderer.send(IpcEvents.STARTED);
File heuristics.test.ts
has 306 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { SearchVideo } from 'youtube-ext';
import { YoutubeHeuristics } from './heuristics';
export const ytTrack = (overrides?: Partial<SearchVideo>): Partial<SearchVideo> => ({
title: 'Black Sabbath - Paranoid',
Function playerRouter
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function playerRouter(rendererWindow: BrowserWindow['webContents']): ISwaggerizedRouter {
const router = express.Router() as ISwaggerizedRouter;
swagger.swaggerize(router);
Function initSwagger
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function initSwagger(app: Express): void {
swagger.reset();
swagger.initialise(app, {
title: 'Nuclear REST API',
description: 'This Api allow you to remotly control nuclear desktop app',
File search.ts
has 294 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import logger from 'electron-timber';
import { rest } from '@nuclear/core';
import _, { isString } from 'lodash';
import artPlaceholder from '../../resources/media/art_placeholder.png';
import globals from '../globals';
Function genreToIcon
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const genreToIcon = (genre: string): string => {
switch (genre.toLowerCase()) {
case 'blues':
return blues;
case 'rock':
LinuxMediaService
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
Open
@systemMediaController()
class LinuxMediaService extends MprisService implements NuclearApi {
tracks: MprisMeta[];
constructor(