nukeop/nuclear

View on GitHub

Showing 661 of 661 total issues

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

  constructor(
    @inject(Discord) private discord: Discord,
    @inject(TrayMenu) private trayMenu: TrayMenu,
    @inject(SystemApi) private systemApi: NuclearApi,
    @inject(Window) private window: Window,
Severity: Major
Found in packages/main/src/controllers/player.ts and 1 other location - About 2 hrs to fix
packages/main/src/controllers/settings.ts on lines 15..21

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 93.

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 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

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

    export const RowOfCards = () => (
      <div
        className='bg'
        style={{ display: 'flex', flexFlow: 'row wrap', width: '100%' }}
      >
    Severity: Major
    Found in packages/ui/stories/components/card.stories.tsx and 1 other location - About 2 hrs to fix
    packages/ui/stories/components/card.stories.tsx on lines 62..74

    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 92.

    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 { component, store } = mountComponent({
          queue: {
            currentSong: 0,
            queueItems: [{
              artist: 'test artist 1',
    packages/app/app/containers/PlayerBarContainer/PlayerBarContainer.test.tsx on lines 123..140

    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 92.

    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 RowOfCardsWithLongContent = () => (
      <div
        className='bg'
        style={{ display: 'flex', flexFlow: 'row wrap', width: '100%' }}
      >
    Severity: Major
    Found in packages/ui/stories/components/card.stories.tsx and 1 other location - About 2 hrs to fix
    packages/ui/stories/components/card.stories.tsx on lines 47..59

    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 92.

    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

      signUp(body: SignUpRequestBody) {
        return this.getJson<SignUpResponseBody, ErrorBody>(fetch(`${this.baseUrl}/signup`, {
          method: 'POST',
          headers: this.getHeaders(),
          body: JSON.stringify(this.prepareBody(body))
    Severity: Major
    Found in packages/core/src/rest/Nuclear/Identity.ts and 1 other location - About 2 hrs to fix
    packages/core/src/rest/Nuclear/Identity.ts on lines 15..21

    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 92.

    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 { component, store } = mountComponent({
          queue: {
            currentSong: 0,
            queueItems: [{
              artist: 'test artist 1',
    packages/app/app/containers/PlayerBarContainer/PlayerBarContainer.test.tsx on lines 224..241

    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 92.

    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

      signIn(body: SignInRequestBody) {
        return this.getJson<SignInResponseBody, ErrorBody>(fetch(`${this.baseUrl}/signin`, {
          method: 'POST',
          headers: this.getHeaders(),
          body: JSON.stringify(this.prepareBody(body))
    Severity: Major
    Found in packages/core/src/rest/Nuclear/Identity.ts and 1 other location - About 2 hrs to fix
    packages/core/src/rest/Nuclear/Identity.ts on lines 7..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 92.

    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 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

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

        export function info(title: string, details: string, icon:  Node | React.ReactElement<{
          src: string;
        }>, settings: Setting[] | { [key: string]: unknown }) {
          return generateNotification(title, details, icon, {info: true}, settings);
        }
        Severity: Major
        Found in packages/app/app/actions/toasts.ts and 3 other locations - About 2 hrs to fix
        packages/app/app/actions/toasts.ts on lines 19..23
        packages/app/app/actions/toasts.ts on lines 25..29
        packages/app/app/actions/toasts.ts on lines 31..35

        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 90.

        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 4 locations. Consider refactoring.
        Open

        export function warning(title: string, details: string, icon:  Node | React.ReactElement<{
          src: string;
        }>, settings: Setting[] | { [key: string]: unknown }) {
          return generateNotification(title, details, icon, {warning: true}, settings);
        }
        Severity: Major
        Found in packages/app/app/actions/toasts.ts and 3 other locations - About 2 hrs to fix
        packages/app/app/actions/toasts.ts on lines 19..23
        packages/app/app/actions/toasts.ts on lines 31..35
        packages/app/app/actions/toasts.ts on lines 37..41

        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 90.

        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 4 locations. Consider refactoring.
        Open

        export function success(title: string, details: string, icon:  Node | React.ReactElement<{
          src: string;
        }>, settings: Setting[] | { [key: string]: unknown }) {
          return generateNotification(title, details, icon, {success: true}, settings);
        }
        Severity: Major
        Found in packages/app/app/actions/toasts.ts and 3 other locations - About 2 hrs to fix
        packages/app/app/actions/toasts.ts on lines 19..23
        packages/app/app/actions/toasts.ts on lines 25..29
        packages/app/app/actions/toasts.ts on lines 37..41

        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 90.

        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 4 locations. Consider refactoring.
        Open

        export function error(title: string, details: string, icon:  Node | React.ReactElement<{
          src: string;
        }>, settings: Setting[] | { [key: string]: unknown }) {
          return generateNotification(title, details, icon, {error: true}, settings);
        }
        Severity: Major
        Found in packages/app/app/actions/toasts.ts and 3 other locations - About 2 hrs to fix
        packages/app/app/actions/toasts.ts on lines 25..29
        packages/app/app/actions/toasts.ts on lines 31..35
        packages/app/app/actions/toasts.ts on lines 37..41

        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 90.

        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

              tracklist: _.map(podcastInfo.slice(1), (episode, index) => new Track ({
                artist: episode.collectionName,
                title: episode.trackName,
                duration: Math.ceil(episode.trackTimeMillis/1000),
                thumbnail: episode.artworkUrl60,
        Severity: Major
        Found in packages/core/src/plugins/meta/itunespodcast.ts and 1 other location - About 2 hrs to fix
        packages/core/src/plugins/meta/itunesmusic.ts on lines 136..142

        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 89.

        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

              tracklist: _.map(albumInfo.slice(1), (episode, index) => new Track ({
                artist: episode.collectionName,
                title: episode.trackName,
                duration: Math.ceil(episode.trackTimeMillis/1000),
                thumbnail: episode.artworkUrl60,
        Severity: Major
        Found in packages/core/src/plugins/meta/itunesmusic.ts and 1 other location - About 2 hrs to fix
        packages/core/src/plugins/meta/itunespodcast.ts on lines 58..64

        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 89.

        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

        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

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

              it('should show that an artist is still loading', () => {
                const { component } = mountComponent(
                  buildStoreState()
                    .withPlugins()
                    .withArtistDetails({ ['test-artist-id']: { loading: true } })
            packages/app/app/containers/AlbumViewContainer/AlbumViewContainer.test.tsx on lines 23..32

            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 88.

            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

              increaseVolume = () => {
                const { player, actions } = this.props;
            
                if (player.volume < 100) {
                  actions.updateVolume(player.volume + VOLUME_ITERATION * this.coef, false);
            Severity: Major
            Found in packages/app/app/containers/ShortcutsContainer/index.js and 1 other location - About 2 hrs to fix
            packages/app/app/containers/ShortcutsContainer/index.js on lines 71..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 88.

            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

            Severity
            Category
            Status
            Source
            Language