nukeop/nuclear

View on GitHub

Showing 663 of 663 total issues

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

  router
    .post('/next', (req, res) => {
      rendererWindow.send(IpcEvents.NEXT);
      res.send();
    })
Severity: Major
Found in packages/main/src/services/http/server/api/player.ts and 6 other locations - About 1 hr to fix
packages/main/src/services/http/server/api/player.ts on lines 40..45
packages/main/src/services/http/server/api/player.ts on lines 47..52
packages/main/src/services/http/server/api/player.ts on lines 54..59
packages/main/src/services/http/server/api/player.ts on lines 61..66
packages/main/src/services/http/server/api/player.ts on lines 68..73
packages/main/src/services/http/server/api/player.ts on lines 75..80

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

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

  render() {
    const {
      favorites,
      favoritesActions,
      searchActions,
Severity: Minor
Found in packages/app/app/containers/FavoritesContainer/index.js - About 1 hr to fix

    Function default has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export default function (paths) {
    
      return next => (reducer, initialState, enhancer) => {
        if (typeof initialState === 'function' && typeof enhancer === 'undefined') {
          enhancer = initialState;
    Severity: Minor
    Found in packages/app/app/store/enhancers/syncStorage.js - About 1 hr to fix

      Function DownloadsList has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

      const DownloadsList: React.FC<DownloadsListProps> = ({
        items,
        clearFinishedTracks,
        pauseDownload,
        resumeDownload,
      Severity: Minor
      Found in packages/app/app/components/Downloads/DownloadsList/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 logEvent has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

        logEvent({ direction, event, data, once }: EventMessage) {
          const message = `${once ? 'once' : ''} ${direction === 'in' ? '==>' : '<=='} ${event}`;
      
          let dataMessage: string = typeof data;
      
      
      Severity: Minor
      Found in packages/main/src/services/logger/index.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

      Function UserPanelContainer has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const UserPanelContainer: React.FC = () => {
        const { t } = useTranslation('app');
        const dispatch = useDispatch();
      
        const [isSignUpFormOpen, setSignUpFormOpen] = useState(false);
      Severity: Minor
      Found in packages/app/app/containers/UserPanelContainer/index.tsx - About 1 hr to fix

        Function render has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          render() {
            return (
              <ErrorBoundary>
                <div className={styles.app_container}>
                  <MiniPlayerContainer />
        Severity: Minor
        Found in packages/app/app/App.js - About 1 hr to fix

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

            renderAlbumsSection() {
              const { t, albumSearchResults, albumInfoSearch } = this.props;
          
              return this.renderSection(t('album', { count: albumSearchResults.length }), albumSearchResults, albumInfoSearch);
            }
          packages/app/app/components/SearchResults/AllResults/index.js on lines 83..87

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

          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 TitleCell: React.FC<CellProps<Track> & TrackTableExtraProps<Track>> = ({
            cell,
            row,
            value,
          
          
          Severity: Major
          Found in packages/ui/lib/components/TrackTable/Cells/TitleCell.tsx and 1 other location - About 1 hr to fix
          packages/ui/lib/components/Range/index.tsx on lines 14..107

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

          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

            renderTopAlbums (topAlbums) {
              return (
                <TagTopList
                  topList={topAlbums}
                  onClick={this.albumInfoSearchByName.bind(this)}
          Severity: Major
          Found in packages/app/app/components/TagView/index.js and 1 other location - About 1 hr to fix
          packages/app/app/components/TagView/index.js on lines 35..43

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

          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

            renderTopArtists (topArtists) {
              return (
                <TagTopList
                  topList={topArtists}
                  onClick={this.artistInfoSearchByName.bind(this)}
          Severity: Major
          Found in packages/app/app/components/TagView/index.js and 1 other location - About 1 hr to fix
          packages/app/app/components/TagView/index.js on lines 45..53

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

          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 Range = ({
            value,
            min,
            max,
            thumbSize,
          Severity: Major
          Found in packages/ui/lib/components/Range/index.tsx and 1 other location - About 1 hr to fix
          packages/ui/lib/components/TrackTable/Cells/TitleCell.tsx on lines 9..80

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

          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

            renderArtistsSection() {
              const { t, artistSearchResults, artistInfoSearch } = this.props;
          
              return this.renderSection(t('artist', { count: artistSearchResults.length }), artistSearchResults, artistInfoSearch);
            }
          packages/app/app/components/SearchResults/AllResults/index.js on lines 89..93

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

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

            renderTrigger(track) {
              const {
                displayCover,
                displayTrackNumber,
                displayArtist,
          Severity: Minor
          Found in packages/app/app/components/TrackRow/index.js - About 1 hr to fix

            Function PromotedArtistsContainer has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export const PromotedArtistsContainer: React.FC = () => {
              const dispatch = useDispatch();
              const history = useHistory();
              const isPromotedArtistFeatureEnabled = useSelector(isConfigFlagEnabled(ConfigFlag.PROMOTED_ARTISTS));
              const promotedArtistBackground = useSelector(paramValue(ParamKey.PROMOTED_ARTIST_BACKGROUND));
            Severity: Minor
            Found in packages/app/app/containers/PromotedArtistsContainer/index.tsx - About 1 hr to fix

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

                it('prepares url', () => {
                  const api = setupLastFmApi('test', 'test');
                  const url = 'http://example.com?test=test1&test2=test3';
                  const prepared = api.prepareUrl(url);
              
              
              Severity: Major
              Found in packages/core/src/rest/lastfm.test.ts and 2 other locations - About 1 hr to fix
              packages/core/src/rest/lastfm.test.ts on lines 14..20
              packages/core/src/rest/lastfm.test.ts on lines 22..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 62.

              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 function setNumberOption(option, state, fromMain) {
                setOption(option, state);
              
                return {
                  type: Settings.SET_NUMBER_OPTION,
              Severity: Major
              Found in packages/app/app/actions/settings.ts and 2 other locations - About 1 hr to fix
              packages/app/app/actions/settings.ts on lines 13..21
              packages/app/app/actions/settings.ts on lines 23..31

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

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

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

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

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

              Refactorings

              Further Reading

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

              export type DiscogsReleaseSearchResult = {
                id: number;
                cover_image: string;
                genre: string[];
                style: string[];
              Severity: Major
              Found in packages/core/src/rest/Discogs.types.ts and 1 other location - About 1 hr to fix
              packages/core/src/rest/Audius.types.ts on lines 15..23

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

              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

                        <div className={styles.favorite_part}>
                          <Icon name={isFavorite ? 'heart' : 'heart outline'}
                            size='large'
                            onClick={
                              isFavorite
              Severity: Major
              Found in packages/ui/lib/components/TrackInfo/index.tsx and 1 other location - About 1 hr to fix
              packages/ui/lib/components/MiniPlayer/MiniTrackInfo/index.tsx on lines 31..43

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

              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 function setBooleanOption(option, state, fromMain?) {
                setOption(option, state);
              
                return {
                  type: Settings.SET_BOOLEAN_OPTION,
              Severity: Major
              Found in packages/app/app/actions/settings.ts and 2 other locations - About 1 hr to fix
              packages/app/app/actions/settings.ts on lines 23..31
              packages/app/app/actions/settings.ts on lines 33..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 62.

              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