nukeop/nuclear

View on GitHub

Showing 143 of 661 total issues

Function onStartDownload has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  @ipcEvent(IpcEvents.DOWNLOAD_START)
  async onStartDownload(event: IpcMessageEvent, data: NuclearMeta) {
    try {
      const { uuid } = data;
      const downloadRef = this.downloadItems.find((item => item.uuid === uuid));
Severity: Minor
Found in packages/main/src/controllers/download.ts - About 1 hr to fix

    Function Range has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    const Range = ({
      value,
      min,
      max,
      thumbSize,
    Severity: Minor
    Found in packages/ui/lib/components/Range/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 getTracksFromDOM has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      function getTracksFromDOM(processedIndex) {
        const cookieBanner = document.getElementById('onetrust-banner-sdk');
    
        if (cookieBanner) {
          cookieBanner.style.setProperty('display', 'none', 'important');
    Severity: Minor
    Found in packages/core/src/helpers/playlist/spotify.ts - About 1 hr to fix

      Function ScrobblingReducer has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export default function ScrobblingReducer(state=initialState, action) {
        switch (action.type) {
        case Scrobbling.LASTFM_CONNECT:
          return Object.assign({}, state, {
            lastFmAuthToken: action.payload
      Severity: Minor
      Found in packages/app/app/reducers/scrobbling.ts - About 1 hr to fix

        Function extractPlaylist has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          async function extractPlaylist(): Promise<SpotifyPlaylist> {
            const playlist = getPlaylistGeneralInfo();
            
            ipcRenderer.sendToHost('import-spotify-playlist-metadata', playlist);
        
        
        Severity: Minor
        Found in packages/core/src/helpers/playlist/spotify.ts - About 1 hr to fix

          Function createChart has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const createChart = (canvas) => {
            const context = canvas.getContext('2d');
            
            const lineGradient = context.createLinearGradient(0, 0, 0, 400);
            lineGradient.addColorStop(0, 'rgb(80, 250, 123, 0.3)');   
          Severity: Minor
          Found in packages/app/app/components/Equalizer/chart.ts - About 1 hr to fix

            Function SettingsContainer has 38 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const SettingsContainer: React.FC = () => {
              const dispatch = useDispatch();
              const scrobbling = useSelector(scrobblingSelector);
              const importfavs = useSelector(importfavsSelector);
              const mastodon = useSelector(mastodonSelector);
            Severity: Minor
            Found in packages/app/app/containers/SettingsContainer/index.tsx - About 1 hr to fix

              Function useTrackInfoProps has 37 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export const useTrackInfoProps = () => {
                const dispatch = useDispatch();
                const history = useHistory();
                const queue = useSelector(queueSelector);
                const hasTracks = queue.queueItems.length > 0;
              Severity: Minor
              Found in packages/app/app/containers/PlayerBarContainer/hooks.ts - About 1 hr to fix

                Function useArtistViewProps has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export const useArtistViewProps = () => {
                  const dispatch = useDispatch();
                  const history = useHistory();
                  const { artistId } = useParams<{ artistId: string }>();
                  const artistDetails = useSelector(searchSelectors.artistDetails);
                Severity: Minor
                Found in packages/app/app/containers/ArtistViewContainer/hooks.ts - About 1 hr to fix

                  Function listen has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    listen(): void {
                      const ipc = this.get<IpcMain>(ipcService);
                      const logger = this.get<Logger>($ipcLogger);
                  
                      this.controllers.forEach((Controller) => {
                  Severity: Minor
                  Found in packages/main/src/utils/container.ts - About 1 hr to fix

                    Function init has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        init() {
                          if (this.platform.isMac()) {
                            const logo = new TouchBarButton({
                              icon: touchbarIcons.logo,
                              backgroundColor: '#000000'
                    Severity: Minor
                    Found in packages/main/src/services/touchbar/index.ts - About 1 hr to fix

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

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

                                  Function createPopup has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    createPopup() {
                                      const {
                                        url,
                                        width,
                                        height,
                                  Severity: Minor
                                  Found in packages/app/app/components/OauthPopup/index.js - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language