nukeop/nuclear

View on GitHub

Showing 654 of 654 total issues

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

      StreamMappingsService.deleteStreamMapping({
        artist: getTrackArtist(currentTrack),
        title: currentTrack.name,
        source: selectedStreamProvider,
        stream_id: head(currentTrack.streams).id,
packages/app/app/containers/StreamVerificationContainer/index.tsx on lines 74..86

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

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

  async getTagAlbums(tag: string): Promise<LastfmAlbum[]> {
    const result = await (await fetch(this.addApiKey(
      scrobblingApiUrl +
      '?method=tag.getTopAlbums&format=json&tag=' +
      tag
Severity: Major
Found in packages/core/src/rest/Lastfm.ts and 2 other locations - About 2 hrs to fix
packages/core/src/rest/Lastfm.ts on lines 110..118
packages/core/src/rest/Lastfm.ts on lines 129..137

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

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

export function swaggerRouter(store: Store): Router {
  const router = express.Router();

  router.get('/swagger.json', (req, res) => {
    res.json(swaggerJson);
Severity: Major
Found in packages/main/src/services/http/server/api/swagger.ts - About 2 hrs to fix

    File discogs.ts has 267 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import _ from 'lodash';
    
    import MetaProvider from '../metaProvider';
    import * as Discogs from '../../rest/Discogs';
    import LastFmApi from '../../rest/Lastfm';
    Severity: Minor
    Found in packages/core/src/plugins/meta/discogs.ts - About 2 hrs to fix

      Function SidebarMenuContainer has 60 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const SidebarMenuContainer: React.FC = () => {
        const { t } = useTranslation('app');
        const dispatch = useDispatch();
        const settings = useSelector(settingsSelector);
        const isCollapsed = settings.compactMenuBar;
      Severity: Major
      Found in packages/app/app/containers/SidebarMenuContainer/index.tsx - About 2 hrs to fix

        Function AlbumPreview has 60 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const AlbumPreview: React.FC<AlbumPreviewProps & Handlers> = (props) => {
        
          const { album, trackButtons, handleAddToQueue, handlePlayAll } = props;
        
          const thumb = _.defaultTo(getThumbnail(album), artPlaceholder);
        Severity: Major
        Found in packages/ui/lib/components/AlbumPreview/index.tsx - About 2 hrs to fix

          Function exports has 60 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          module.exports = (env: BuildEnv): webpack.Configuration => {
            if (!env.TARGET) {
              env.TARGET = osMapper[os.platform() as string];
            }
          
          
          Severity: Major
          Found in packages/main/webpack.config.ts - About 2 hrs to fix

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

              async deleteStreamMapping(mapping: DeleteStreamMappingPayload) {
                return this.getJson<void, ErrorBody>(fetch(`${this.baseUrl}/stream-mappings/unverify`, {
                  headers: this.getHeaders(),
                  method: 'DELETE',
                  body: JSON.stringify(mapping)
            Severity: Major
            Found in packages/core/src/rest/Nuclear/StreamMappings.ts and 1 other location - About 2 hrs to fix
            packages/core/src/rest/Nuclear/StreamMappings.ts on lines 45..51

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

            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 postStreamMapping(mapping: PostStreamMappingPayload) {
                return this.getJson<void, ErrorBody>(fetch(`${this.baseUrl}/stream-mappings/verify`, {
                  headers: this.getHeaders(),
                  method: 'POST',
                  body: JSON.stringify(mapping)
            Severity: Major
            Found in packages/core/src/rest/Nuclear/StreamMappings.ts and 1 other location - About 2 hrs to fix
            packages/core/src/rest/Nuclear/StreamMappings.ts on lines 53..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 82.

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

            export default function EqualizerReducer(state = getInitialState(), action:EqualizerReducerActions): EqualizerState {
              let newState: EqualizerState;
            
              switch (action.type) {
              case getType(EqualizerActions.changeValue): {
            Severity: Major
            Found in packages/app/app/reducers/equalizer.ts - About 2 hrs to fix

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

              const trackSearch = (terms: string): Promise<MusicbrainzTrackResponse> =>
                new Promise((resolve, reject) => {
                  nb.search('work', { work: terms }, (err, response) => {
                    err ? reject(err) : resolve(response);
                  });
              Severity: Major
              Found in packages/core/src/rest/Musicbrainz.ts and 2 other locations - About 2 hrs to fix
              packages/core/src/rest/Musicbrainz.ts on lines 15..20
              packages/core/src/rest/Musicbrainz.ts on lines 22..27

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

              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

              const releaseSearch = (terms: string): Promise<MusicbrainzReleaseGroupResponse> =>
                new Promise((resolve, reject) => {
                  nb.search('release-group', { release: terms }, (err, response) => {
                    err ? reject(err) : resolve(response);
                  });
              Severity: Major
              Found in packages/core/src/rest/Musicbrainz.ts and 2 other locations - About 2 hrs to fix
              packages/core/src/rest/Musicbrainz.ts on lines 15..20
              packages/core/src/rest/Musicbrainz.ts on lines 29..34

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

              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

              const getReleaseDetails = (releaseId: string): Promise<MusicbrainzRelease> =>
                new Promise((resolve, reject) => {
                  nb.release(releaseId, { inc: 'artists+recordings+genres' }, (err, response) => {
                    err ? reject(err) : resolve(response);
                  });
              Severity: Major
              Found in packages/core/src/rest/Musicbrainz.ts and 2 other locations - About 2 hrs to fix
              packages/core/src/rest/Musicbrainz.ts on lines 49..54
              packages/core/src/rest/Musicbrainz.ts on lines 56..61

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

              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

              const artistSearch = (terms: string): Promise<MusicbrainzArtistResponse> =>
                new Promise((resolve, reject) => {
                  nb.search('artist', { artist: terms }, (err, response) => {
                    err ? reject(err) : resolve(response);
                  });
              Severity: Major
              Found in packages/core/src/rest/Musicbrainz.ts and 2 other locations - About 2 hrs to fix
              packages/core/src/rest/Musicbrainz.ts on lines 22..27
              packages/core/src/rest/Musicbrainz.ts on lines 29..34

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

              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

              const getArtistReleases = (id: string): Promise<MusicbrainzArtist> =>
                new Promise((resolve, reject) => {
                  nb.artist(id, { inc: 'releases+release-groups' }, (err, response) => {
                    err ? reject(err) : resolve(response);
                  });
              Severity: Major
              Found in packages/core/src/rest/Musicbrainz.ts and 2 other locations - About 2 hrs to fix
              packages/core/src/rest/Musicbrainz.ts on lines 56..61
              packages/core/src/rest/Musicbrainz.ts on lines 63..68

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

              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

              const getReleaseGroupDetails = (releaseGroupId: string): Promise<MusicbrainzReleaseGroup> =>
                new Promise((resolve, reject) => {
                  nb.releaseGroup(releaseGroupId, { inc: 'releases' }, (err, response) => {
                    err ? reject(err) : resolve(response);
                  });
              Severity: Major
              Found in packages/core/src/rest/Musicbrainz.ts and 2 other locations - About 2 hrs to fix
              packages/core/src/rest/Musicbrainz.ts on lines 49..54
              packages/core/src/rest/Musicbrainz.ts on lines 63..68

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

              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 isConfigFlagEnabled = (flag: ConfigFlag) => (state: RootState) => {
                const configuration = nuclearSelectors.configuration(state).configuration;
                return configuration.isReady && !configuration.error && configuration.data[flag];
              };
              Severity: Major
              Found in packages/app/app/selectors/nuclear.ts and 1 other location - About 2 hrs to fix
              packages/app/app/selectors/nuclear.ts on lines 12..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 80.

              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 paramValue = (param: ParamKey) => (state: RootState) => {
                const params = nuclearSelectors.configuration(state).params;
                return params.isReady && !params.error && params.data[param];
              };
              Severity: Major
              Found in packages/app/app/selectors/nuclear.ts and 1 other location - About 2 hrs to fix
              packages/app/app/selectors/nuclear.ts on lines 7..10

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

              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 index.js has 259 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import React from 'react';
              import { withRouter } from 'react-router-dom';
              import { connect } from 'react-redux';
              import { bindActionCreators } from 'redux';
              import { compose, withProps } from 'recompose';
              Severity: Minor
              Found in packages/app/app/containers/SoundContainer/index.js - About 2 hrs to fix

                Function mockPodcastResult has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function mockPodcastResult() {
                  global.fetch = jest.fn(() =>
                    Promise.resolve({
                      json: jest.fn(() => ({
                        'resultCount': 1,
                Severity: Major
                Found in packages/core/src/plugins/meta/metaMocks/iTunesPodcastMocks.ts - About 2 hrs to fix
                  Severity
                  Category
                  Status
                  Source
                  Language