nukeop/nuclear

View on GitHub

Showing 665 of 665 total issues

Function playerRouter has 80 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function playerRouter(rendererWindow: BrowserWindow['webContents']): ISwaggerizedRouter {

  const router = express.Router() as ISwaggerizedRouter;
  
  swagger.swaggerize(router);
Severity: Major
Found in packages/main/src/services/http/server/api/player.ts - About 3 hrs to fix

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

    export const onDownloadError = createStandardAction(DownloadActionTypes.DOWNLOAD_ERROR).map(
      (uuid: string) => {
        const downloads: Download[] = store.get('downloads');
        const payload = changePropertyForItem({
          downloads,
    Severity: Major
    Found in packages/app/app/actions/downloads.ts and 2 other locations - About 3 hrs to fix
    packages/app/app/actions/downloads.ts on lines 61..72
    packages/app/app/actions/downloads.ts on lines 147..159

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

    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

    export const onDownloadFinished = createStandardAction(DownloadActionTypes.DOWNLOAD_FINISHED).map(
      (uuid: string) => {
        const downloads: Download[] = store.get('downloads');
        const payload = changePropertyForItem({
          downloads,
    Severity: Major
    Found in packages/app/app/actions/downloads.ts and 2 other locations - About 3 hrs to fix
    packages/app/app/actions/downloads.ts on lines 61..72
    packages/app/app/actions/downloads.ts on lines 123..135

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

    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

    export const onDownloadStarted = createStandardAction(DownloadActionTypes.DOWNLOAD_STARTED).map(
      (uuid: string) => {
        const downloads: Download[] = store.get('downloads');
        const payload = changePropertyForItem({
          downloads,
    Severity: Major
    Found in packages/app/app/actions/downloads.ts and 2 other locations - About 3 hrs to fix
    packages/app/app/actions/downloads.ts on lines 123..135
    packages/app/app/actions/downloads.ts on lines 147..159

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

    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 initSwagger has 79 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function initSwagger(app: Express): void {
      swagger.reset();
      swagger.initialise(app, {
        title: 'Nuclear REST API',
        description: 'This Api allow you to remotly control nuclear desktop app',
    Severity: Major
    Found in packages/main/src/services/http/server/swagger.ts - About 3 hrs to fix

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

                        <Draggable
                          key={`${row.values[TrackTableColumn.Title]} ${row.index}`}
                          draggableId={`${row.values[TrackTableColumn.Title]} ${row.index}`}
                          index={row.index}
                          isDragDisabled={!onDragEnd}
      Severity: Major
      Found in packages/ui/lib/components/TrackTable/index.tsx and 1 other location - About 3 hrs to fix
      packages/ui/lib/components/Playlists/index.tsx on lines 109..130

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

      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

                        <Draggable
                          key={`${row.values[PlaylistsColumn.Title]}  ${row.index}`}
                          draggableId={`${row.values[PlaylistsColumn.Title]}  ${row.index}`}
                          index={row.index}
                          isDragDisabled={!onDragEnd}
      Severity: Major
      Found in packages/ui/lib/components/Playlists/index.tsx and 1 other location - About 3 hrs to fix
      packages/ui/lib/components/TrackTable/index.tsx on lines 177..195

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

      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 search.ts has 294 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import logger from 'electron-timber';
      import { rest } from '@nuclear/core';
      import _, { isString } from 'lodash';
      import artPlaceholder from '../../resources/media/art_placeholder.png';
      import globals from '../globals';
      Severity: Minor
      Found in packages/app/app/actions/search.ts - About 3 hrs to fix

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

            expect(state.playlists.localPlaylists.data[1].tracks).toEqual([
              expect.objectContaining({
                artist: 'test artist 1',
                name: 'test track 1'
              }),
        packages/app/app/containers/PlayQueueContainer/PlayQueueContainer.test.tsx on lines 211..224

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

        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

          searchForReleases(query: string): Promise<Array<SearchResultsAlbum>> {
            return Discogs.search(query, 'master')
              .then(response => response.json())
              .then((json: DiscogsReleaseSearchResponse) => json.results.map(this.discogsReleaseSearchResultToGeneric));
          }
        Severity: Major
        Found in packages/core/src/plugins/meta/discogs.ts and 1 other location - About 3 hrs to fix
        packages/core/src/plugins/meta/discogs.ts on lines 131..135

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

        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

          searchForArtists(query: string): Promise<Array<SearchResultsArtist>> {
            return Discogs.search(query, 'artist')
              .then(response => response.json())
              .then((json: DiscogsArtistSearchResponse) => json.results.map(this.discogsArtistSearchResultToGeneric));
          }
        Severity: Major
        Found in packages/core/src/plugins/meta/discogs.ts and 1 other location - About 3 hrs to fix
        packages/core/src/plugins/meta/discogs.ts on lines 137..141

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

        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(state.playlists.localPlaylists.data[0].tracks).toEqual([
              expect.objectContaining({
                artist: 'test artist 1',
                name: 'test track 1'
              }),
        packages/app/app/containers/PlayQueueContainer/PlayQueueContainer.test.tsx on lines 183..196

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

        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 genreToIcon has 76 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const genreToIcon = (genre: string): string => {
          switch (genre.toLowerCase()) {
          case 'blues':
            return blues;
          case 'rock':
        Severity: Major
        Found in packages/app/app/components/Dashboard/GenresTab/mapGenres.ts - About 3 hrs to fix

          LinuxMediaService has 26 functions (exceeds 20 allowed). Consider refactoring.
          Open

          @systemMediaController() 
          class LinuxMediaService extends MprisService implements NuclearApi {
            tracks: MprisMeta[];
          
            constructor(
          Severity: Minor
          Found in packages/main/src/services/@linux/system-api.ts - About 3 hrs to fix

            File queue.ts has 290 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import logger from 'electron-timber';
            import _, { isEmpty, isString } from 'lodash';
            import { createStandardAction } from 'typesafe-actions';
            import { v4 } from 'uuid';
            
            
            Severity: Minor
            Found in packages/app/app/actions/queue.ts - About 2 hrs to fix

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

                increaseSeek = () => {
                  const { player, actions } = this.props;
              
                  if (player.playbackProgress < 100) {
                    actions.updateSeek(player.seek + this.getSeekIteration() * this.coef);
              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 91..99

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

              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

                decreaseSeek = () => {
                  const { player, actions } = this.props;
              
                  if (player.playbackProgress > 0) {
                    actions.updateSeek(player.seek - this.getSeekIteration() * this.coef);
              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 81..89

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

              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

                async getConfiguration() {
                  const dbConfiguration = await this.client
                    .from<ConfigurationDbType>('config')
                    .select();
              
              
              Severity: Major
              Found in packages/core/src/rest/Nuclear/Configuration.ts and 1 other location - About 2 hrs to fix
              packages/core/src/rest/Nuclear/Configuration.ts on lines 40..49

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

              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

                async getParams() {
                  const dbParams = await this.client
                    .from<ParamDbType>('params')
                    .select();
              
              
              Severity: Major
              Found in packages/core/src/rest/Nuclear/Configuration.ts and 1 other location - About 2 hrs to fix
              packages/core/src/rest/Nuclear/Configuration.ts on lines 29..38

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

              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

                constructor(
                  @inject(Config) private config: Config,
                  @inject(HttpApi) private httpApi: HttpApi,
                  @inject(SystemApi) private systemApi: NuclearApi,
                  @inject(Store) private store: Store,
              Severity: Major
              Found in packages/main/src/controllers/settings.ts and 1 other location - About 2 hrs to fix
              packages/main/src/controllers/player.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

              Severity
              Category
              Status
              Source
              Language