nukeop/nuclear

View on GitHub

Showing 89 of 309 total issues

Function generateMdFile has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const generateMdFile = (data: Record<string, Record<string, string[]>>) => {
  const stream = fs.createWriteStream(FILE_PATH, {
    encoding: 'utf-8'
  });

Severity: Minor
Found in packages/i18n/scripts/helpers/md.ts - About 1 hr to fix

    Function usePlayerControlsProps has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const usePlayerControlsProps = () => {
      const dispatch = useDispatch();
      const queue = useSelector(queueSelector);
      const playbackStatus = useSelector(playerSelectors.playbackStatus);
      const playbackStreamLoading = useSelector(playerSelectors.playbackStreamLoading);
    Severity: Minor
    Found in packages/app/app/containers/PlayerBarContainer/hooks.ts - About 1 hr to fix

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

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

          Function renderOptionsButtons has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            renderOptionsButtons (album) {
              return (
                <ContextPopup
                  trigger={
                    <a href='#' className={styles.more_button}>
          Severity: Minor
          Found in packages/app/app/components/AlbumView/index.js - About 1 hr to fix

            Function fetchArtistDetails has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              async fetchArtistDetails(artistId: string): Promise<ArtistDetails> {
                const discogsInfo: DiscogsArtistInfo = await (await Discogs.artistInfo(artistId)).json();
                discogsInfo.name = cleanName(discogsInfo.name);
            
                const lastFmInfo: LastFmArtistInfo = (await (await this.lastfm.getArtistInfo(discogsInfo.name)).json()).artist;
            Severity: Minor
            Found in packages/core/src/plugins/meta/discogs.ts - About 1 hr to fix

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

                render () {
                  const { options, settings, t } = this.props;
                  const optionsGroups = _.groupBy(options, 'category');
              
                  return (
              Severity: Minor
              Found in packages/app/app/components/Settings/index.js - About 1 hr to fix

                Function fetchAcousticIdBatch has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  fetchAcousticIdBatch(metas: NuclearMeta[], onProgress?: ProgressHandler): Promise<void[]> {
                    let scanProgress = 0;
                    const scanTotal = metas.length;
                
                    this.logger.log(`start fetching metadata from acoustic-id api for ${scanTotal} tracks`);
                Severity: Minor
                Found in packages/main/src/services/local-library/index.ts - About 1 hr to fix

                  Function EqualizerViewContainer has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const EqualizerViewContainer = () => {
                    const equalizer = useSelector(state => state.equalizer);
                    const preset = equalizer.presets[equalizer.selected];
                    const dispatch = useDispatch();
                    const actions = useMemo(() => bindActionCreators(EqualizerActions, dispatch), [dispatch]);
                  Severity: Minor
                  Found in packages/app/app/containers/EqualizerViewContainer/index.js - About 1 hr to fix

                    Function renderPane has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      renderPane (collection, onClick) {
                        const selectedProvider = _.find(this.props.metaProviders, { sourceName: this.props.selectedPlugins.metaProviders });
                    
                        return (
                          <Tab.Pane loading={this.props.unifiedSearchStarted} attached={false}>
                    Severity: Minor
                    Found in packages/app/app/components/SearchResults/index.js - About 1 hr to fix

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

                        render () {
                          return (
                            <Route render={({ location }) => {
                              return (
                                <MainLayout>
                      Severity: Minor
                      Found in packages/app/app/containers/MainContentContainer/index.js - About 1 hr to fix

                        Function useSeekbarProps has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export const useSeekbarProps = () => {
                          const dispatch = useDispatch();
                          const queue = useSelector(queueSelector);
                          const seek = useSelector(playerSelectors.seek);
                          const playbackProgress = useSelector(playerSelectors.playbackProgress);
                        Severity: Minor
                        Found in packages/app/app/containers/PlayerBarContainer/hooks.ts - About 1 hr to fix

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

                            render () {
                              const { player, equalizer, actions, enableSpectrum, currentStream } = this.props;
                          
                              return Boolean(currentStream) && (
                                <Sound
                          Severity: Minor
                          Found in packages/app/app/containers/SoundContainer/index.js - About 1 hr to fix

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

                              listen(): Server {
                                const port = this.store.getOption('api.port');
                                const app = express();
                            
                                initSwagger(app);
                            Severity: Minor
                            Found in packages/main/src/services/http/index.ts - About 1 hr to fix

                              Function reduceRepositionSong has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                              Open

                              function reduceRepositionSong(state, action) {
                                const newQueue = _.cloneDeep(state.queueItems);
                                const [removed] = newQueue.splice(action.payload.itemFrom, 1);
                                newQueue.splice(action.payload.itemTo, 0, removed);
                              
                              
                              Severity: Minor
                              Found in packages/app/app/reducers/queue.js - About 55 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 getChartOptions has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                              Open

                              function getChartOptions(data) {
                                return {
                                  type: 'line',
                                  data,
                                  options: {
                              Severity: Minor
                              Found in packages/app/app/components/Equalizer/chart.js - 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 eventListenerFactory has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                              Open

                              const eventListenerFactory = <T>(metadataKey: symbol): MethodDecorator<T, IpcEventOptions> => (
                                eventName,
                                options
                              ) => {
                                /**
                              Severity: Minor
                              Found in packages/main/src/utils/decorators.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

                              Avoid deeply nested control flow statements.
                              Open

                                        if (!emptyKeys[key]) {
                                          emptyKeys[key] = [];
                                        }
                              Severity: Major
                              Found in packages/i18n/scripts/helpers/object.ts - About 45 mins to fix

                                Function generateNotification has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                function generateNotification(title, details, icon, type, settings) {
                                Severity: Minor
                                Found in packages/app/app/actions/toasts.js - About 35 mins to fix

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

                                  export function formatDuration(duration) {
                                    if (!_.isFinite(parseInt(duration)) || duration < 0) {
                                      return '00:00';
                                    }
                                  
                                  
                                  Severity: Minor
                                  Found in packages/ui/lib/utils.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

                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language