nukeop/nuclear

View on GitHub

Showing 143 of 652 total issues

Function PlaylistView has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const PlaylistView: React.FC<PlaylistViewProps> = ({
  playlist,
  updatePlaylist,
  deletePlaylist,
  exportPlaylist,
Severity: Minor
Found in packages/app/app/components/PlaylistView/index.tsx - About 45 mins 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 getMenu has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  getMenu() {
    const template = [];

    // Playing status
    if (this.playerContext.track) {
Severity: Minor
Found in packages/main/src/services/trayMenu/index.ts - About 45 mins 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 NuclearSignUpFormContainer has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export const NuclearSignUpFormContainer: React.FC<NuclearSignUpFormContainerProps> = ({
  isOpen,
  onClose
}) => {
  const { t } = useTranslation('forms', { keyPrefix: 'nuclear-sign-up' });

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 generateNotification has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

function generateNotification(title: string, details: string, icon:  Node | React.ReactElement<{
  src: string;
}>, type: {[type:string]: boolean}, settings: Setting[] | { [key: string]: unknown }) {
Severity: Minor
Found in packages/app/app/actions/toasts.ts - About 35 mins to fix

    Function useResizablePanel has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    export const useResizablePanel = ({
      initialWidth,
      collapsedWidth,
      collapseThreshold,
      isCollapsed,
    Severity: Minor
    Found in packages/app/app/containers/SidebarMenuContainer/hooks.ts - About 35 mins 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 SpotifyPlaylistImporter has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    const SpotifyPlaylistImporter: React.FC<SpotifyPlaylistImporterProps> = ({ 
      trigger,
      onClose: onCloseProp
    }) => {
      const { t } = useTranslation('playlists');

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

    const eventEmitterControllerFactory = (metadataKey: symbol): ClassDecorator => (prefix?: string) => {
      /**
       * Get the metadata attached to the class by event decorator and add the prefix to eventNames if prefix is defined
       * @param target - the instance of the decorated class
       * @returns - the decorated class ready to use with inversify Container
    Severity: Minor
    Found in packages/main/src/utils/decorators.ts - About 35 mins 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 renderTrackListPane has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      renderTrackListPane(collection) {
        if (typeof collection !== 'undefined') {
    
          return (
            <Tab.Pane loading={this.props.unifiedSearchStarted} attached={false}>
    Severity: Minor
    Found in packages/app/app/components/SearchResults/index.js - About 35 mins 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 play has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      async play() {
        if (this.isReady && this.activity) {
          this.pausedTotal += Date.now() - this.pauseStart;
          if (this.activity) {
            if (this.isPaused) {
    Severity: Minor
    Found in packages/main/src/services/discord/index.ts - About 35 mins 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 useSpotifyPlaylistImporterProps has a Cognitive Complexity of 7 (exceeds 5 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 35 mins 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 LibraryView has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    const LibraryView = ({ 
      tracksMap, 
      filter, 
      expandedFolders, 
      streamProviders, 
    Severity: Minor
    Found in packages/app/app/components/LibraryView/index.js - About 35 mins 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 usePlayerControlsProps has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    export const usePlayerControlsProps = () => {
      const dispatch = useDispatch();
      const queue = useSelector(queueSelector);
      const settings = useSelector(settingsSelector);
      const playbackStatus = useSelector(playerSelectors.playbackStatus);
    Severity: Minor
    Found in packages/app/app/containers/PlayerBarContainer/hooks.ts - About 35 mins 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 useResizablePanel has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    const useResizablePanel = ({
      initialWidth,
      collapsedWidth,
      collapseThreshold,
      isCollapsed,
    Severity: Minor
    Found in packages/ui/stories/components/resizablePanel.stories.tsx - About 35 mins 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 extractTrackData has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    const extractTrackData = (track, streamSource: string = null): PlaylistTrack => {
      const trackStreams = track.streams || streamSource ? [{ source: streamSource, id: track.id }] : [];
    
      return track && (track.name || track.title) && (!track.type || track.type === 'track') ?
        {
    Severity: Minor
    Found in packages/core/src/helpers/playlist/index.ts - About 35 mins 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 TrackRow has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    const TrackRow: React.FC<TrackRowProps> = ({
      track,
      mini,
      displayAlbum,
      displayArtist,
    Severity: Minor
    Found in packages/ui/lib/components/TrackRow/index.tsx - About 35 mins 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 render has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      render() {
        const { queue, player, equalizer, actions, enableSpectrum, currentStream, location, defaultEqualizer } = this.props;
        const currentTrack = queue.queueItems[queue.currentSong];
        const usedEqualizer = enableSpectrum ? equalizer : defaultEqualizer;
    
    
    Severity: Minor
    Found in packages/app/app/containers/SoundContainer/index.js - About 25 mins 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 fetchArtistDetails has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      async fetchArtistDetails(artistId: string): Promise<ArtistDetails> {
        const AudiusInfo: AudiusArtistInfo = (await ((await Audius.getArtist(this.apiEndpoint, artistId)).json())).data;
        AudiusInfo.name = cleanName(AudiusInfo.name);
    
        const lastFmInfo: LastFmArtistInfo = (await (await this.lastfm.getArtistInfo(AudiusInfo.name)).json()).artist;
    Severity: Minor
    Found in packages/core/src/plugins/meta/audius.ts - About 25 mins 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 SearchBox has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    const SearchBox: React.FC<SearchBarProps> = ({
      loading,
      disabled,
      placeholder,
      searchProviders,
    Severity: Minor
    Found in packages/ui/lib/components/SearchBox/index.tsx - About 25 mins 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 retryWithExponentialBackoff has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    export async function retryWithExponentialBackoff<T>(
      apiCall: () => Promise<T>,
      maxRetries = 3,
      delayMs = 1000
    ): Promise<T> {
    Severity: Minor
    Found in packages/core/src/util/retry.ts - About 25 mins 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 PromotedArtistsContainer has a Cognitive Complexity of 6 (exceeds 5 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 25 mins 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

    Severity
    Category
    Status
    Source
    Language