nukeop/nuclear

View on GitHub

Showing 663 of 663 total issues

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 InputDialog has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    const InputDialog: React.VFC<InputDialogProps> = ({
      initialString,
      header,
      placeholder,
      acceptLabel,
    Severity: Minor
    Found in packages/ui/lib/components/InputDialog/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 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 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

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

      it('maximizes the program on clicking maximize', () => {
        const { component, props } = mountComponent();
        
        component.getByTestId('maximize-button').click();
    
    
    packages/app/app/components/WindowControls/WindowControls.test.tsx on lines 7..13
    packages/app/app/components/WindowControls/WindowControls.test.tsx on lines 23..29

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

    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

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

    const mockFetch = (data) => {
      global.fetch = jest.fn(() =>
        Promise.resolve({
          json: jest.fn(() => ({
            data
    Severity: Major
    Found in packages/core/src/rest/audius.test.ts and 1 other location - About 1 hr to fix
    packages/core/src/rest/itunes.test.ts on lines 4..12

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

    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

      it('minimizes the program on clicking maximize', () => {
        const { component, props } = mountComponent();
        
        component.getByTestId('minimize-button').click();
    
    
    packages/app/app/components/WindowControls/WindowControls.test.tsx on lines 15..21
    packages/app/app/components/WindowControls/WindowControls.test.tsx on lines 23..29

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

    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

      it('closes the program on clicking close', () => {
        const { component, props } = mountComponent();
        
        component.getByTestId('close-button').click();
    
    
    packages/app/app/components/WindowControls/WindowControls.test.tsx on lines 7..13
    packages/app/app/components/WindowControls/WindowControls.test.tsx 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 70.

    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

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

    const mockFetch = (data) => {
      global.fetch = jest.fn(() =>
        Promise.resolve({
          json: jest.fn(() => ({
            data
    Severity: Major
    Found in packages/core/src/rest/itunes.test.ts and 1 other location - About 1 hr to fix
    packages/core/src/rest/audius.test.ts on lines 4..12

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

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

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

        constructor() {
          super();
          this.name = 'Bandcamp Plugin';
          this.sourceName = 'Bandcamp';
          this.description = 'A plugin allowing Nuclear to search for music and play it from Bandcamp';
      Severity: Major
      Found in packages/core/src/plugins/stream/BandcampPlugin.ts and 3 other locations - About 1 hr to fix
      packages/core/src/plugins/lyrics/azlyrics.ts on lines 7..14
      packages/core/src/plugins/lyrics/simple.ts on lines 8..15
      packages/core/src/plugins/stream/YoutubePlugin.ts on lines 7..14

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

      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

        @ipcEvent(IpcEvents.PAUSE)
        onPause() {
          this.systemApi.pause();
          this.trayMenu.update({isPlaying: false});
          return this.discord.pause();
      Severity: Major
      Found in packages/main/src/controllers/player.ts and 1 other location - About 1 hr to fix
      packages/main/src/controllers/player.ts on lines 23..28

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

      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

        constructor() {
          super();
          this.name = 'Youtube Plugin';
          this.sourceName = 'Youtube';
          this.description = 'A plugin allowing Nuclear to search for music and play it from Youtube';
      Severity: Major
      Found in packages/core/src/plugins/stream/YoutubePlugin.ts and 3 other locations - About 1 hr to fix
      packages/core/src/plugins/lyrics/azlyrics.ts on lines 7..14
      packages/core/src/plugins/lyrics/simple.ts on lines 8..15
      packages/core/src/plugins/stream/BandcampPlugin.ts on lines 8..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 69.

      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

      storiesOf('Components/User plugins item', module)
        .add('Basic', () => (
          <div className='bg'>
            <UserPluginsItem
              path='/usr/bin/local'
      Severity: Major
      Found in packages/ui/stories/components/userPluginsItem.stories.js and 1 other location - About 1 hr to fix
      packages/ui/stories/components/userPluginsItem.stories.js on lines 6..30

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

      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

        @ipcEvent(IpcEvents.PLAY)
        onPlay() {
          this.systemApi.play();
          this.trayMenu.update({isPlaying: true});
          return this.discord.play();
      Severity: Major
      Found in packages/main/src/controllers/player.ts and 1 other location - About 1 hr to fix
      packages/main/src/controllers/player.ts on lines 30..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 69.

      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

        constructor() {
          super();
          this.name = 'AZ Lyrics Provider Plugin';
          this.sourceName = 'AZ Lyrics Provider';
          this.description = 'AZ lyrics provider plugin. Uses search result from azlyrics';
      Severity: Major
      Found in packages/core/src/plugins/lyrics/azlyrics.ts and 3 other locations - About 1 hr to fix
      packages/core/src/plugins/lyrics/simple.ts on lines 8..15
      packages/core/src/plugins/stream/BandcampPlugin.ts on lines 8..15
      packages/core/src/plugins/stream/YoutubePlugin.ts on lines 7..14

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

      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

        constructor() {
          super();
          this.name = 'Simple Lyrics Provider Plugin';
          this.sourceName = 'Simple Lyrics Provider';
          this.description = 'Simple lyrics provider plugin. Uses several sources with fallbacks.';
      Severity: Major
      Found in packages/core/src/plugins/lyrics/simple.ts and 3 other locations - About 1 hr to fix
      packages/core/src/plugins/lyrics/azlyrics.ts on lines 7..14
      packages/core/src/plugins/stream/BandcampPlugin.ts on lines 8..15
      packages/core/src/plugins/stream/YoutubePlugin.ts on lines 7..14

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

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

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

          storiesOf('Components/Loader', module)
            .add('Default', () => {
              return (
                <div style={{
                  background: '#282a36',
          Severity: Major
          Found in packages/ui/stories/components/loader.stories.js and 1 other location - About 1 hr to fix
          packages/ui/stories/components/loader.stories.js on lines 6..45

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

          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