nukeop/nuclear

View on GitHub

Showing 143 of 661 total issues

Function exports has 211 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = (env) => {
  const IS_PROD = env.NODE_ENV === 'production';
  const IS_DEV = env.NODE_ENV === 'development';

  const entry = IS_PROD
Severity: Major
Found in packages/app/webpack.config.ts - About 1 day to fix

    Function SearchReducer has 180 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export default function SearchReducer(state = initialState, action: SearchReducerActionTypes):SearchState {
      switch (action.type) {
      case getType(SearchActions.unifiedSearchStart):
        return {
          ...state,
    Severity: Major
    Found in packages/app/app/reducers/search.ts - About 7 hrs to fix

      Function useCommandPaletteActions has 178 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const useCommandPaletteActions = (): CommandPaletteAction[] => {
        const history = useHistory();
        const dispatch = useDispatch();
        const { t } = useTranslation('command-palette');
        const settings = useSelector(settingsSelector);
      Severity: Major
      Found in packages/app/app/containers/CommandPaletteContainer/hooks.ts - About 7 hrs to fix

        Function actions has 158 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          const actions = () => {
            return [{
              id: 'play',
              name: t('actions.play'),
              shortcut: ['space'],
        Severity: Major
        Found in packages/app/app/containers/CommandPaletteContainer/hooks.ts - About 6 hrs to fix

          File index.ts has 375 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import { app, remote } from 'electron';
          import { v4 } from 'uuid';
          
          export enum SettingType {
            BOOLEAN = 'boolean',
          Severity: Minor
          Found in packages/core/src/settings/index.ts - About 5 hrs to fix

            Function StreamVerificationContainer has 113 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export const StreamVerificationContainer: React.FC = () => {
              const { t } = useTranslation('queue');
              const dispatch = useDispatch();
              const queue = useSelector(queueSelector);
              const settings = useSelector(settingsSelector);
            Severity: Major
            Found in packages/app/app/containers/StreamVerificationContainer/index.tsx - About 4 hrs to fix

              Function SpotifyPlaylistImporter has 109 lines of code (exceeds 25 allowed). Consider refactoring.
              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

                const ipcConnect: Middleware = () => next => {
                  next({
                    type: LocalLibrary.UPDATE_LOCAL_FOLDERS,
                    payload: ipcRenderer.sendSync(IpcEvents.LOCALFOLDERS_GET)
                  });
                Severity: Major
                Found in packages/app/app/store/middlewares/ipc.ts - About 4 hrs to fix

                  Function useTrackPopupProps has 106 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const useTrackPopupProps = (track, thumb) => {
                    const { localPlaylists: playlists } = useLocalPlaylists();
                    const settings = useSelector(settingsSelector);
                    const plugins: any = useSelector(pluginsSelectors.plugins);
                  
                  
                  Severity: Major
                  Found in packages/app/app/containers/TrackPopupContainer/hooks.ts - About 4 hrs to fix

                    Function findStreamsForTrack has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                    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)) {
                    Severity: Minor
                    Found in packages/app/app/actions/queue.ts - About 3 hrs to fix

                    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

                    export const useAlbumViewProps = () => {
                      const dispatch = useDispatch();
                      const history = useHistory();
                      const { albumId } = useParams<{ albumId: string }>();
                    
                    
                    Severity: Major
                    Found in packages/app/app/containers/AlbumViewContainer/hooks.ts - About 3 hrs to fix

                      File PlayerBarContainer.test.tsx has 318 lines of code (exceeds 250 allowed). Consider refactoring.
                      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

                        export function mockPodcastEpisodesResult() {
                          global.fetch = jest.fn(() =>
                            Promise.resolve({
                              json: jest.fn(() => ({
                                'resultCount': 2,
                        Severity: Major
                        Found in packages/core/src/plugins/meta/metaMocks/iTunesPodcastMocks.ts - About 3 hrs to fix

                          Function componentDidMount has 86 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            componentDidMount() {
                              const { actions } = this.props;
                          
                              ipcRenderer.send(IpcEvents.STARTED);
                          
                          
                          Severity: Major
                          Found in packages/app/app/containers/IpcContainer/index.js - About 3 hrs to fix

                            File heuristics.test.ts has 306 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import { SearchVideo } from 'youtube-ext';
                            import { YoutubeHeuristics } from './heuristics';
                            
                            export const ytTrack = (overrides?: Partial<SearchVideo>): Partial<SearchVideo> => ({
                              title: 'Black Sabbath - Paranoid',
                            Severity: Minor
                            Found in packages/core/src/rest/heuristics.test.ts - About 3 hrs to fix

                              Function playerRouter has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export function playerRouter(rendererWindow: BrowserWindow['webContents']): ISwaggerizedRouter {
                              
                                const router = express.Router() as ISwaggerizedRouter;
                                
                                swagger.swaggerize(router);
                              Severity: Major
                              Found in packages/main/src/services/http/server/api/player.ts - About 3 hrs to fix

                                Function initSwagger has 79 lines of code (exceeds 25 allowed). Consider refactoring.
                                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',
                                Severity: Major
                                Found in packages/main/src/services/http/server/swagger.ts - About 3 hrs to fix

                                  File search.ts has 294 lines of code (exceeds 250 allowed). Consider refactoring.
                                  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';
                                  Severity: Minor
                                  Found in packages/app/app/actions/search.ts - About 3 hrs to fix

                                    Function genreToIcon has 76 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    const genreToIcon = (genre: string): string => {
                                      switch (genre.toLowerCase()) {
                                      case 'blues':
                                        return blues;
                                      case 'rock':
                                    Severity: Major
                                    Found in packages/app/app/components/Dashboard/GenresTab/mapGenres.ts - About 3 hrs to fix

                                      LinuxMediaService has 26 functions (exceeds 20 allowed). Consider refactoring.
                                      Open

                                      @systemMediaController() 
                                      class LinuxMediaService extends MprisService implements NuclearApi {
                                        tracks: MprisMeta[];
                                      
                                        constructor(
                                      Severity: Minor
                                      Found in packages/main/src/services/@linux/system-api.ts - About 3 hrs to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language