nukeop/nuclear

View on GitHub

Showing 87 of 296 total issues

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

module.exports = (env) => {
  const IS_PROD = env.NODE_ENV === 'production';
  const IS_DEV = env.NODE_ENV === 'development';

  const entry = IS_PROD
Severity: Major
Found in packages/app/webpack.config.js - About 7 hrs to fix

    File index.js has 388 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { SettingType } from '@nuclear/core';
    import { Range } from '@nuclear/ui';
    import React from 'react';
    import PropTypes from 'prop-types';
    import { remote } from 'electron';
    Severity: Minor
    Found in packages/app/app/components/Settings/index.js - About 5 hrs to fix

      Function SearchReducer has 128 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export default function SearchReducer(state = initialState, action) {
        switch (action.type) {
        case UNIFIED_SEARCH_START:
          return {
            ...state,
      Severity: Major
      Found in packages/app/app/reducers/search.js - About 5 hrs to fix

        Function ipcConnect has 103 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const ipcConnect = () => next => {
          next({
            type: UPDATE_LOCAL_FOLDERS,
            payload: { folders: ipcRenderer.sendSync(IpcEvents.LOCALFOLDERS_GET) }
          });
        Severity: Major
        Found in packages/app/app/store/middlewares/ipc.js - About 4 hrs to fix

          Function playerRouter has 80 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function playerRouter(rendererWindow: BrowserWindow['webContents']): ISwaggerizedRouter {
          
            const router = express.Router() as ISwaggerizedRouter;
            
            swagger.swaggerize(router);
          Severity: Major
          Found in packages/main/src/services/http/server/api/player.ts - About 3 hrs to fix

            Function initSwagger has 79 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function initSwagger(app: Express): void {
              swagger.reset();
              swagger.initialise(app, {
                title: 'Nuclear REST API',
                description: 'This Api allow you to remotly control nuclear desktop app',
            Severity: Major
            Found in packages/main/src/services/http/server/swagger.ts - About 3 hrs to fix

              LinuxMediaService has 26 functions (exceeds 20 allowed). Consider refactoring.
              Open

              @systemMediaController() 
              class LinuxMediaService extends MprisService implements NuclearApi {
                tracks: MprisMeta[];
              
                constructor(
              Severity: Minor
              Found in packages/main/src/services/@linux/system-api.ts - About 3 hrs to fix

                Function componentDidMount has 75 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  componentDidMount() {
                    const { actions } = this.props;
                
                    ipcRenderer.send(IpcEvents.STARTED);
                
                
                Severity: Major
                Found in packages/app/app/containers/IpcContainer/index.js - About 3 hrs to fix

                  Function useTreeData has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const useTreeData = (tracks, localFolders) => {
                    return useMemo(() => {
                      const pathToEntryMap = {};
                      function getEntryForFolder(path) {
                        if (pathToEntryMap[path] === undefined) {
                  Severity: Major
                  Found in packages/app/app/components/LibraryView/LibraryFolderTree/index.js - About 2 hrs to fix

                    File App.js has 283 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import React from 'react';
                    import FontAwesome from 'react-fontawesome';
                    import { connect } from 'react-redux';
                    import { bindActionCreators } from 'redux';
                    import { NavLink, withRouter } from 'react-router-dom';
                    Severity: Minor
                    Found in packages/app/app/App.js - About 2 hrs to fix

                      Function PluginsReducer has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export default function PluginsReducer(state=initialState, action) {
                        switch (action.type) {
                        case CREATE_PLUGINS:
                          return {
                            ...state,
                      Severity: Major
                      Found in packages/app/app/reducers/plugins.js - About 2 hrs to fix

                        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

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

                            render() {
                              const {
                                compact,
                                items,
                                settings,
                          Severity: Major
                          Found in packages/app/app/components/PlayQueue/index.js - About 2 hrs to fix

                            File search.ts has 265 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import logger from 'electron-timber';
                            import { rest } from '@nuclear/core';
                            import _ from 'lodash';
                            import artPlaceholder from '../../resources/media/art_placeholder.png';
                            import globals from '../globals';
                            Severity: Minor
                            Found in packages/app/app/actions/search.ts - About 2 hrs to fix

                              File index.js has 265 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              import React from 'react';
                              import PropTypes from 'prop-types';
                              import Img from 'react-image';
                              import _ from 'lodash';
                              import { Dimmer, Icon, Loader } from 'semantic-ui-react';
                              Severity: Minor
                              Found in packages/app/app/components/AlbumView/index.js - About 2 hrs to fix

                                Function EqualizerReducer has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

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

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

                                  module.exports = (env: BuildEnv): import('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

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

                                      render() {
                                        const {
                                          addPlaylist,
                                          updatePlaylist,
                                          clearQueue,
                                    Severity: Major
                                    Found in packages/app/app/components/PlayQueue/QueueMenu/index.js - About 2 hrs to fix

                                      Settings has 21 functions (exceeds 20 allowed). Consider refactoring.
                                      Open

                                      @withTranslation('settings')
                                      class Settings extends React.Component {
                                        toggleScrobbling (
                                          lastFmScrobblingEnabled,
                                          enableScrobbling,
                                      Severity: Minor
                                      Found in packages/app/app/components/Settings/index.js - About 2 hrs to fix

                                        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

                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language