nukeop/nuclear

View on GitHub

Showing 83 of 285 total issues

Function useTreeData has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

const useTreeData = (tracks, localFolders) => {
  return useMemo(() => {
    const pathToEntryMap = {};
    function getEntryForFolder(path) {
      if (pathToEntryMap[path] === undefined) {
Severity: Minor
Found in packages/app/app/components/LibraryView/LibraryFolderTree/index.js - About 2 hrs 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 getChartOptions has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function getChartOptions(data) {
  return {
    type: 'line',
    data,
    options: {
Severity: Minor
Found in packages/app/app/components/Equalizer/chart.js - About 2 hrs to fix

    Function LocalReducer has 50 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export default function LocalReducer(state = initialState, action) {
      switch (action.type) {
      case UPDATE_LOCAL_FOLDERS:
        return {
          ...state,
    Severity: Minor
    Found in packages/app/app/reducers/local.js - About 2 hrs to fix

      Function panes has 50 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        panes () {
          const {
            actions,
            dashboardData,
            history,
      Severity: Minor
      Found in packages/app/app/components/Dashboard/index.js - About 2 hrs to fix

        Function settingsRouter has 50 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function settingsRouter(store: Store, rendererWindow: BrowserWindow['webContents']): ISwaggerizedRouter {
        
          const router = express.Router() as ISwaggerizedRouter;
        
          swagger.swaggerize(router);
        Severity: Minor
        Found in packages/main/src/services/http/server/api/settings.ts - About 2 hrs to fix

          Function playlistRouter has 50 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function playlistRouter(store: Store, rendererWindow: BrowserWindow['webContents']): ISwaggerizedRouter {
          
            const router = express.Router() as ISwaggerizedRouter;
            
            swagger.swaggerize(router);
          Severity: Minor
          Found in packages/main/src/services/http/server/api/playlist.ts - About 2 hrs to fix

            Function renderSidebarMenu has 49 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              renderSidebarMenu () {
                
                return (
                  <VerticalPanel
                    className={classnames(styles.left_panel, {
            Severity: Minor
            Found in packages/app/app/App.js - About 1 hr to fix

              Function renderQueueItems has 48 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                renderQueueItems() {
                  const {compact, currentSong, actions, t, plugins, items} = this.props;
                  
                  if (!items) {
                    return null;
              Severity: Minor
              Found in packages/app/app/components/PlayQueue/index.js - About 1 hr to fix

                Function getMissingKeys has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                export const getMissingKeys = <T = any>(obj: T, base: T): Record<string, string[]> => {
                  const emptyKeys = {};
                
                  for (const [key, value] of Object.entries(obj)) {
                    if (typeof value === 'object') {
                Severity: Minor
                Found in packages/i18n/scripts/helpers/object.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 renderOption has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  renderOption (settings, option, key) {
                    return (
                      <div
                        key={key}
                        className={
                Severity: Minor
                Found in packages/app/app/components/Settings/index.js - About 1 hr to fix

                  Function renderPlaylistInfo has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    renderPlaylistInfo (playlist) {
                      const popupTrigger = (
                        <a href='#' className={styles.more_button}>
                          <Icon name='ellipsis horizontal' />
                        </a>
                  Severity: Minor
                  Found in packages/app/app/components/PlaylistView/index.js - About 1 hr to fix

                    Function PlayerReducer has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export default function PlayerReducer(state=initialState, action) {
                      switch (action.type) {
                      case START_PLAYBACK:
                        return Object.assign({}, state, {
                          playbackStatus: Sound.status.PLAYING
                    Severity: Minor
                    Found in packages/app/app/reducers/player.js - About 1 hr to fix

                      Function onStartDownload has 39 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 fetchAllFmFavorites has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export function fetchAllFmFavorites() {
                          const storage = store.get('lastFm');
                          if (storage) {
                            return dispatch => {
                              dispatch({ type: LASTFM_FAV_IMPORT_START });
                        Severity: Minor
                        Found in packages/app/app/actions/importfavs.js - 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 LASTFM_CONNECT:
                              return Object.assign({}, state, {
                                lastFmAuthToken: action.payload
                          Severity: Minor
                          Found in packages/app/app/reducers/scrobbling.js - About 1 hr to fix

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

                              render () {
                                const { artist, history, albumInfoSearch } = this.props;
                            
                                return (
                                  <div className={styles.artist_view_container}>
                            Severity: Minor
                            Found in packages/app/app/components/ArtistView/index.js - 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.js - About 1 hr to fix

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

                                function addTrackToQueue(streamProviders, item) {
                                  return async (dispatch, getState) => {
                                    item.loading = !item.local;
                                    item = safeAddUuid(item);
                                
                                
                                Severity: Minor
                                Found in packages/app/app/actions/queue.js - About 1 hr to fix

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

                                    renderLastFmLoginButtons () {
                                      const {
                                        lastFmAuthToken,
                                        lastFmName,
                                        lastFmSessionKey
                                  Severity: Minor
                                  Found in packages/app/app/components/Settings/index.js - About 1 hr to fix

                                    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

                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language