nukeop/nuclear

View on GitHub

Showing 143 of 661 total issues

File queue.ts has 290 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import logger from 'electron-timber';
import _, { isEmpty, isString } from 'lodash';
import { createStandardAction } from 'typesafe-actions';
import { v4 } from 'uuid';

Severity: Minor
Found in packages/app/app/actions/queue.ts - About 2 hrs to fix

    Function useTreeData has 72 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const useTreeData = (tracks, localFolders) => {
      return useMemo(() => {
        const pathToEntryMap = {};
        function getEntryForFolder(path) {
          if (pathToEntryMap[path] === undefined) {
    Severity: Major
    Found in packages/app/app/components/LibraryView/LibraryFolderTree/index.js - About 2 hrs to fix

      Function useVolumeControlsProps has 69 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const useVolumeControlsProps = () => {
        const { t } = useTranslation('option-control');
        const dispatch = useDispatch();
        const volume: number = useSelector(playerSelectors.volume);
        const isMuted: boolean = useSelector(playerSelectors.muted);
      Severity: Major
      Found in packages/app/app/containers/PlayerBarContainer/hooks.ts - About 2 hrs to fix

        Function PluginsReducer has 69 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export default function PluginsReducer(state=initialState, action): PluginsState {
          switch (action.type) {
          case CREATE_PLUGINS:
            return {
              ...state,
        Severity: Major
        Found in packages/app/app/reducers/plugins.ts - About 2 hrs to fix

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

            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: Major
            Found in packages/app/app/actions/queue.ts - About 2 hrs to fix

              Function getMenu has 66 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                getMenu() {
                  const template = [];
              
                  // Playing status
                  if (this.playerContext.track) {
              Severity: Major
              Found in packages/main/src/services/trayMenu/index.ts - About 2 hrs to fix

                Function mockAlbumSongsSearch has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

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

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

                    export function swaggerRouter(store: Store): Router {
                      const router = express.Router();
                    
                      router.get('/swagger.json', (req, res) => {
                        res.json(swaggerJson);
                    Severity: Major
                    Found in packages/main/src/services/http/server/api/swagger.ts - About 2 hrs to fix

                      File discogs.ts has 267 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import _ from 'lodash';
                      
                      import MetaProvider from '../metaProvider';
                      import * as Discogs from '../../rest/Discogs';
                      import LastFmApi from '../../rest/Lastfm';
                      Severity: Minor
                      Found in packages/core/src/plugins/meta/discogs.ts - About 2 hrs to fix

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

                        module.exports = (env: BuildEnv): webpack.Configuration => {
                          if (!env.TARGET) {
                            env.TARGET = osMapper[os.platform() as string];
                          }
                        
                        
                        Severity: Major
                        Found in packages/main/webpack.config.ts - About 2 hrs to fix

                          Function SidebarMenuContainer has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          const SidebarMenuContainer: React.FC = () => {
                            const { t } = useTranslation('app');
                            const dispatch = useDispatch();
                            const settings = useSelector(settingsSelector);
                            const isCollapsed = settings.compactMenuBar;
                          Severity: Major
                          Found in packages/app/app/containers/SidebarMenuContainer/index.tsx - About 2 hrs to fix

                            Function AlbumPreview has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            const AlbumPreview: React.FC<AlbumPreviewProps & Handlers> = (props) => {
                            
                              const { album, trackButtons, handleAddToQueue, handlePlayAll } = props;
                            
                              const thumb = _.defaultTo(getThumbnail(album), artPlaceholder);
                            Severity: Major
                            Found in packages/ui/lib/components/AlbumPreview/index.tsx - About 2 hrs to fix

                              Function EqualizerReducer has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export default function EqualizerReducer(state = getInitialState(), action:EqualizerReducerActions): EqualizerState {
                                let newState: EqualizerState;
                              
                                switch (action.type) {
                                case getType(EqualizerActions.changeValue): {
                              Severity: Major
                              Found in packages/app/app/reducers/equalizer.ts - About 2 hrs to fix

                                File index.js has 259 lines of code (exceeds 250 allowed). Consider refactoring.
                                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';
                                Severity: Minor
                                Found in packages/app/app/containers/SoundContainer/index.js - About 2 hrs to fix

                                  Function mockPodcastResult has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

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

                                    Function useTreeData has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                    const useTreeData = (tracks, localFolders) => {
                                      return useMemo(() => {
                                        const pathToEntryMap = {};
                                        function getEntryForFolder(path) {
                                          if (pathToEntryMap[path] === undefined) {
                                    Severity: Minor
                                    Found in packages/app/app/components/LibraryView/LibraryFolderTree/index.js - About 2 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 Settings has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                    const Settings: React.FC<SettingsProps> = ({
                                      actions,
                                      mastodonActions,
                                      scrobbling,
                                      importfavs,
                                    Severity: Minor
                                    Found in packages/app/app/components/Settings/index.tsx - About 2 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

                                    File hooks.ts has 251 lines of code (exceeds 250 allowed). Consider refactoring.
                                    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';
                                    Severity: Minor
                                    Found in packages/app/app/containers/PlayerBarContainer/hooks.ts - About 2 hrs to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language