nukeop/nuclear

View on GitHub

Showing 143 of 663 total issues

Function CommandPaletteContainer has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const CommandPaletteContainer: React.FC = () => {
  const { t } = useTranslation('command-palette');
  const [isOpen, setOpen] = useState(false);
  const [input, setInput] = useState('');
  const inputRef = useRef<Input>();
Severity: Minor
Found in packages/app/app/containers/CommandPaletteContainer/index.tsx - About 1 hr to fix

    Function addPlaylistFromFile has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function addPlaylistFromFile(filePath, t) {
      return async dispatch => {
        if (!filePath || typeof filePath !== 'string') {
          dispatch(error(t('import-fail-title'), t('error-empty-data'), null, null));
          return;
    Severity: Minor
    Found in packages/app/app/actions/playlists.ts - About 1 hr to fix

      Function Toast has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const Toast = (props: ToastProps) => {
        return (
          <div
            className={cx(
              common.nuclear,
      Severity: Minor
      Found in packages/ui/lib/components/ToastContainer/Toast/index.tsx - About 1 hr to fix

        Function QueueReducer has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export default function QueueReducer(state = defaultState, action) {
          switch (action.type) {
          case Queue.ADD_QUEUE_ITEM:
            return {
              ...state,
        Severity: Minor
        Found in packages/app/app/reducers/queue.ts - About 1 hr to fix

          Function mockAlbumResult has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function mockAlbumResult() {
            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 mountComponent has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              const mountComponent = (initialStore?: AnyProps) => {
                const initialState = initialStore ||
                  buildStoreState()
                    .withArtistDetails()
                    .withPlaylists([{

              Function loadUserPlugin has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function loadUserPlugin(path) {
                return async (dispatch, getState) => {
                  dispatch(loadUserPluginStart(path));
                  try {
                    const api = createApi();
              Severity: Minor
              Found in packages/app/app/actions/plugins.js - About 1 hr to fix

                Function equalizerRouter has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function equalizerRouter(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/equalizer.ts - About 1 hr to fix

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

                    render() {
                      return (
                        <Route render={({ location }) => {
                          return (
                            <MainLayout>
                  Severity: Minor
                  Found in packages/app/app/containers/MainContentContainer/index.js - About 1 hr to fix

                    Function onAccept has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      const onAccept = (w: WebviewTag, handleClose: CloseCallback) => {
                        if (w !== null) {
                          w.addEventListener('dom-ready', () => {
                            w.addEventListener('ipc-message', event => {
                              switch (event.channel) {
                    Severity: Minor
                    Found in packages/app/app/containers/SpotifyPlaylistImporter/hooks.tsx - About 1 hr to fix

                      Function fetchAllFmFavorites has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export function fetchAllFmFavorites() {
                        const storage = store.get('lastFm');
                        if (storage) {
                          return async dispatch => {
                            dispatch({ type: ImportFavs.LASTFM_FAV_IMPORT_START });
                      Severity: Minor
                      Found in packages/app/app/actions/importfavs.ts - About 1 hr to fix

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

                              render() {
                                return (
                                  <div
                                    style={{
                                      background: '#282a36',
                        Severity: Minor
                        Found in packages/ui/stories/components/toasts.stories.js - About 1 hr to fix

                          Function ImportFavsReducer has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export default function ImportFavsReducer(state=initialState, action) {
                            switch (action.type) {
                            case ImportFavs.FAV_IMPORT_INIT:
                              return Object.assign({}, state, {
                                lastFmFavImportStatus: action.payload.lastFmFavImportStatus,
                          Severity: Minor
                          Found in packages/app/app/reducers/importfavs.ts - About 1 hr to fix

                            Function MiniPlayerContainer has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            const MiniPlayerContainer: React.FC = () => {
                              const seekbarProps = useSeekbarProps();
                              const playerControlsProps = usePlayerControlsProps();
                              const trackInfoProps = useTrackInfoProps();
                              const volumeControlsProps = useVolumeControlsProps();
                            Severity: Minor
                            Found in packages/app/app/containers/MiniPlayerContainer/index.tsx - About 1 hr to fix

                              Function fetchArtistDetails has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                async fetchArtistDetails(artistId: string): Promise<ArtistDetails> {
                                  const AudiusInfo: AudiusArtistInfo = (await ((await Audius.getArtist(this.apiEndpoint, artistId)).json())).data;
                                  AudiusInfo.name = cleanName(AudiusInfo.name);
                              
                                  const lastFmInfo: LastFmArtistInfo = (await (await this.lastfm.getArtistInfo(AudiusInfo.name)).json()).artist;
                              Severity: Minor
                              Found in packages/core/src/plugins/meta/audius.ts - About 1 hr to fix

                                Function getSegments has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                export async function getSegments (videoID: VideoID, categories?: Category[]): Promise<Segment[]> {
                                  let query = `?videoID=${videoID}`;
                                
                                  if (!categories) {
                                    query += `&categories=${JSON.stringify(ALL_CATEGORIES)}`;
                                Severity: Minor
                                Found in packages/core/src/rest/SponsorBlock.ts - About 1 hr to fix

                                  Function getEntries has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      async getEntries(request?: ListeningHistoryRequest): Promise<PagingResult<ListeningHistoryEntry>> {
                                        const qb = this.listeningHistoryRepository.createQueryBuilder('entry');
                                  
                                        if (request?.artist) {
                                          qb.andWhere(`entry.artist = '${request.artist}'`);
                                  Severity: Minor
                                  Found in packages/main/src/services/listening-history/db.ts - About 1 hr to fix

                                    Function PlayQueue has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                    const PlayQueue: React.FC<PlayQueueProps> = ({
                                      actions: {
                                        queueDrop,
                                        repositionSong,
                                        addToDownloads,
                                    Severity: Minor
                                    Found in packages/app/app/components/PlayQueue/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 fetchAcousticIdBatch has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                      fetchAcousticIdBatch(metas: NuclearMeta[], onProgress?: ProgressHandler): Promise<void[]> {
                                        let scanProgress = 0;
                                        const scanTotal = metas.length;
                                    
                                        this.logger.log(`start fetching metadata from acoustic-id api for ${scanTotal} tracks`);
                                    Severity: Minor
                                    Found in packages/main/src/services/local-library/index.ts - About 1 hr to fix

                                      Function EqualizerViewContainer has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                      const EqualizerViewContainer: React.FC = () => {
                                        const equalizer = useSelector((state: RootState) => state.equalizer);
                                        const preset = equalizer.presets[equalizer.selected];
                                        const dispatch = useDispatch();
                                        const actions = useMemo(() => bindActionCreators(EqualizerActions, dispatch), [dispatch]);
                                      Severity: Minor
                                      Found in packages/app/app/containers/EqualizerViewContainer/index.tsx - About 1 hr to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language