nukeop/nuclear

View on GitHub

Showing 143 of 665 total issues

Function getChartOptions has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function getChartOptions(data) {
  return {
    type: 'line',
    data,
    options: {
Severity: Minor
Found in packages/app/app/components/Equalizer/chart.ts - About 2 hrs to fix

    Function playlistRouter has 50 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function playlistRouter(store: Store, rendererWindow: BrowserWindow['webContents']): ISwaggerizedRouter {
    
      const router = express.Router() as ISwaggerizedRouter;
      
      swagger.swaggerize(router);
    Severity: Minor
    Found in packages/main/src/services/http/server/api/playlist.ts - About 2 hrs to fix

      Function renderArtistHeader has 50 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        function renderArtistHeader() {
          return (
            <div className={styles.artist_header_overlay}>
              <div className={styles.artist_header_container}>
                {
      Severity: Minor
      Found in packages/app/app/components/ArtistView/index.tsx - About 2 hrs to fix

        Function panes has 49 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          panes() {
            const artistsHasResults = _.get(this.props.artistSearchResults, ['length'], 0) > 0;
            const albumsHasResults = _.get(this.props.albumSearchResults, ['length'], 0) > 0;
            const tracksHasResults = _.get(this.props.trackSearchResults, ['info', 'length'], 0) > 0;
            const playlistsHasResults = _.get(this.props.playlistSearchResults, ['info', 'length'], 0) > 0;
        Severity: Minor
        Found in packages/app/app/components/SearchResults/index.js - About 1 hr to fix

          Function Mic has 48 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const Mic = () => {
            const [audioNode, setAudioNode] = useState<AudioNode>();
            const [audioContext, setAudioContext] = useState<AudioContext>();
            const [preset, setPreset] = useState<string>();
            useEffect(() => {
          Severity: Minor
          Found in packages/ui/stories/components/visualizer.stories.tsx - About 1 hr to fix

            Function constructor has 48 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              constructor(
                @inject(Config) private config: Config,
                @inject($mainLogger) private logger: Logger,
                @inject($ipcLogger) private ipcLogger: Logger,
                @inject(Platform) private platform: Platform,
            Severity: Minor
            Found in packages/main/src/services/window/index.ts - About 1 hr to fix

              Function PlayerReducer has 48 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export default function PlayerReducer(state=initialState, action: PlayerReducerActions): PlayerReducerState {
                switch (action.type) {
                case getType(PlayerActions.startPlayback):
                  return Object.assign({}, state, {
                    playbackStatus: Sound.status.PLAYING
              Severity: Minor
              Found in packages/app/app/reducers/player.ts - About 1 hr to fix

                Function usePlayerControlsProps has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export const usePlayerControlsProps = () => {
                  const dispatch = useDispatch();
                  const queue = useSelector(queueSelector);
                  const settings = useSelector(settingsSelector);
                  const playbackStatus = useSelector(playerSelectors.playbackStatus);
                Severity: Minor
                Found in packages/app/app/containers/PlayerBarContainer/hooks.ts - About 1 hr to fix

                  Function render has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    render() {
                      const { queue, player, equalizer, actions, enableSpectrum, currentStream, location, defaultEqualizer } = this.props;
                      const currentTrack = queue.queueItems[queue.currentSong];
                      const usedEqualizer = enableSpectrum ? equalizer : defaultEqualizer;
                  
                  
                  Severity: Minor
                  Found in packages/app/app/containers/SoundContainer/index.js - About 1 hr to fix

                    Function ListeningHistoryContainer has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export const ListeningHistoryContainer: React.FC = () => {
                      const queue = useSelector(queueSelector);
                      const [limit, setLimit] = useState(10);
                      const [afterCursor, setAfterCursor] = useState(undefined);
                      const [beforeCursor, setBeforeCursor] = useState(undefined);
                    Severity: Minor
                    Found in packages/app/app/containers/ListeningHistoryContainer/index.tsx - About 1 hr to fix

                      Function webpackFinal has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        webpackFinal: config => {
                          return {
                            ...config,
                            module: {
                              ...config.module,
                      Severity: Minor
                      Found in packages/ui/.storybook/main.js - About 1 hr to fix

                        Function addToQueue has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                        Open

                          (item: QueueItem, asNextItem = false) =>
                            async (dispatch, getState) => {
                              const { local }: RootState = getState();
                              item = {
                                ...safeAddUuid(item),
                        Severity: Minor
                        Found in packages/app/app/actions/queue.ts - About 1 hr 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 TrackTable has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function TrackTable<T extends Track>({
                          className,
                          tracks,
                          customColumns = [],
                          isTrackFavorite,
                        Severity: Minor
                        Found in packages/ui/lib/components/TrackTable/index.tsx - About 1 hr 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 SearchBoxContainer has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const SearchBoxContainer: React.FC = () => {
                          const { t } = useTranslation('search');
                          const history = useHistory();
                          const dispatch = useDispatch();
                          const unifiedSearchStarted = useSelector(searchSelectors.unifiedSearchStarted);
                        Severity: Minor
                        Found in packages/app/app/containers/SearchBoxContainer/index.tsx - About 1 hr to fix

                          Function mockTrackResult has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

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

                            Function useSpotifyPlaylistImporterProps has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export const useSpotifyPlaylistImporterProps = (t: TFunction<string>) => {
                              const dispatch = useDispatch();
                              const onImportFromUrl = useCallback((data: SpotifyPlaylist) => {
                                dispatch(PlaylistActions.addPlaylistFromUrl(data, t));
                              }, [dispatch, t]);
                            Severity: Minor
                            Found in packages/app/app/containers/SpotifyPlaylistImporter/hooks.tsx - About 1 hr to fix

                              Function handleFinishedPlaying has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                handleFinishedPlaying() {
                                  const currentSong = this.props.queue.queueItems[
                                    this.props.queue.currentSong
                                  ];
                                  if (
                              Severity: Minor
                              Found in packages/app/app/containers/SoundContainer/index.js - About 1 hr to fix

                                Function DashboardContainer has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                const DashboardContainer: React.FC = () => {
                                  const dispatch = useDispatch();
                                  const history = useHistory();
                                
                                  const dashboard = useSelector(dashboardSelector);
                                Severity: Minor
                                Found in packages/app/app/containers/DashboardContainer/index.tsx - About 1 hr to fix

                                  Function mockArtistAlbumsResult has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

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

                                    Function onStartDownload has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                      @ipcEvent(IpcEvents.DOWNLOAD_START)
                                      async onStartDownload(event: IpcMessageEvent, data: NuclearMeta) {
                                        try {
                                          const { uuid } = data;
                                          const downloadRef = this.downloadItems.find((item => item.uuid === uuid));
                                    Severity: Minor
                                    Found in packages/main/src/controllers/download.ts - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language