nukeop/nuclear

View on GitHub

Showing 661 of 661 total issues

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

export function addPlaylistFromFile(filePath, t) {
  return async dispatch => {
    fs.readFile(filePath, (err, data) => {
      if (err) {
        dispatch(error(t('import-fail-title'), t('error-open-file'), null, null));
Severity: Minor
Found in packages/app/app/actions/playlists.ts - 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 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 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 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

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

              artistInfoSuccess: createStandardAction(Search.ARTIST_INFO_SEARCH_SUCCESS).map((artistId: string, info: ArtistDetails) => {
                return {
                  payload: {
                    artistId,
                    info
            Severity: Major
            Found in packages/app/app/actions/search.ts and 1 other location - About 1 hr to fix
            packages/app/app/actions/search.ts on lines 55..62

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 58.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

            jest.mock('electron-store', () => jest.fn().mockImplementation(() => ({
              get: jest.fn(),
              set: jest.fn()
            })));
            packages/app/app/containers/SettingsContainer/SettingsContainer.test.tsx on lines 10..13

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 58.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

            export type AudiusArtistReleaseSearchResult = {
              id: number;
              artist: string;
              title: string;
              thumb: string;
            Severity: Major
            Found in packages/core/src/rest/Audius.types.ts and 1 other location - About 1 hr to fix
            packages/core/src/rest/Discogs.types.ts on lines 40..48

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 58.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

              constructor() {
                super();
                this.name = 'iTunes Podcast Plugin';
                this.sourceName = 'iTunes';
                this.description = 'Allows Nuclear to find podcast streams on iTunes';
            Severity: Major
            Found in packages/core/src/plugins/stream/iTunesPodcastPlugin.ts and 2 other locations - About 1 hr to fix
            packages/core/src/plugins/stream/JamendoPlugin.ts on lines 9..15
            packages/core/src/plugins/stream/SoundcloudPlugin.ts on lines 9..15

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 58.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

              albumInfoSuccess: createStandardAction(Search.ALBUM_INFO_SEARCH_SUCCESS).map((albumId: string, info: AlbumDetails) => {
                return {
                  payload: {
                    albumId,
                    info
            Severity: Major
            Found in packages/app/app/actions/search.ts and 1 other location - About 1 hr to fix
            packages/app/app/actions/search.ts on lines 85..92

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 58.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

            export const AlbumView: React.FC<AlbumViewProps> = ({
              album,
              isFavorite,
              searchAlbumArtist,
              addAlbumToDownloads,
            Severity: Major
            Found in packages/app/app/components/AlbumView/index.tsx and 1 other location - About 1 hr to fix
            packages/ui/lib/components/AlbumGrid/index.tsx on lines 12..79

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 58.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

              constructor(){
                super();
                this.name = 'Jamendo Plugin';
                this.sourceName = 'Jamendo';
                this.description = 'Allows Nuclear to find music streams on Jamendo';
            Severity: Major
            Found in packages/core/src/plugins/stream/JamendoPlugin.ts and 2 other locations - About 1 hr to fix
            packages/core/src/plugins/stream/SoundcloudPlugin.ts on lines 9..15
            packages/core/src/plugins/stream/iTunesPodcastPlugin.ts on lines 9..15

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 58.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

            export type DiscogsArtistReleaseSearchResult = {
              id: number;
              artist: string;
              title: string;
              thumb: string;
            Severity: Major
            Found in packages/core/src/rest/Discogs.types.ts and 1 other location - About 1 hr to fix
            packages/core/src/rest/Audius.types.ts on lines 25..33

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 58.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

              constructor() {
                super();
                this.name = 'Soundcloud Plugin';
                this.sourceName = 'Soundcloud';
                this.description = 'Allows Nuclear to find music streams on Soundcloud';
            Severity: Major
            Found in packages/core/src/plugins/stream/SoundcloudPlugin.ts and 2 other locations - About 1 hr to fix
            packages/core/src/plugins/stream/JamendoPlugin.ts on lines 9..15
            packages/core/src/plugins/stream/iTunesPodcastPlugin.ts on lines 9..15

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 58.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

            jest.mock('electron-store', () => jest.fn().mockImplementation(() => ({
              get: jest.fn(),
              set: jest.fn()
            })));
            packages/app/app/containers/ListeningHistoryContainer/ListeningHistoryContainer.test.tsx on lines 10..13

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 58.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                expect(response).toEqual({ 
                  'artist': 'Queen', 
                  'coverImage': 'https://is3-ssl.mzstatic.com/image/thumb/Music115/v4/83/23/e4/8323e48b-3467-448b-1ce0-8981d8a97437/source/250x250bb.jpg', 
                  'id': 1440650428,
                  'thumb': 'https://is3-ssl.mzstatic.com/image/thumb/Music115/v4/83/23/e4/8323e48b-3467-448b-1ce0-8981d8a97437/source/1600x1600bb.jpg', 
            Severity: Major
            Found in packages/core/src/plugins/meta/itunesmusic.test.ts and 1 other location - About 1 hr to fix
            packages/core/src/plugins/meta/itunespodcast.test.ts on lines 38..47

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 58.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                expect(response).toEqual({ 
                  'artist': 'Programming Throwdown', 
                  'coverImage': 'https://is3-ssl.mzstatic.com/image/thumb/Podcasts125/v4/83/e8/a9/83e8a9d5-df87-b19d-7050-55e4ce4df89d/mza_13511678666604160959.jpg/600x600bb.jpg', 
                  'id': 427166321,
                  'thumb': 'https://is3-ssl.mzstatic.com/image/thumb/Podcasts125/v4/83/e8/a9/83e8a9d5-df87-b19d-7050-55e4ce4df89d/mza_13511678666604160959.jpg/600x600bb.jpg', 
            Severity: Major
            Found in packages/core/src/plugins/meta/itunespodcast.test.ts and 1 other location - About 1 hr to fix
            packages/core/src/plugins/meta/itunesmusic.test.ts on lines 88..97

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 58.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

            const AlbumGrid = ({
              albums,
              removeFavoriteAlbum,
              loading,
              trackButtons,
            Severity: Major
            Found in packages/ui/lib/components/AlbumGrid/index.tsx and 1 other location - About 1 hr to fix
            packages/app/app/components/AlbumView/index.tsx on lines 26..189

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 58.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            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
                Severity
                Category
                Status
                Source
                Language