nukeop/nuclear

View on GitHub

Showing 143 of 665 total issues

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

  private renderPlugins() {
    const { children } = this.props;

    if (Array.isArray(children)) {
      const flatChildren = children.flat() as ReactElement[];
Severity: Minor
Found in packages/app/app/components/HLSPlayer/index.tsx - About 1 hr to fix

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

      const mountComponent = (initialStore?: AnyProps, initStore = true) => {
        const initialState = initialStore ||
          buildStoreState()
            .withPlaylists()
            .withPlugins()

      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 mountComponent has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          const mountComponent = (initialStore?: AnyProps, initStore = true) => {
            const initialState = initialStore ||
              buildStoreState()
                .withPlugins()
                .withPlaylists()

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

            componentWillUnmount() {
              Mousetrap.unbind([
                'space',
                'enter',
                'left',
          Severity: Minor
          Found in packages/app/app/containers/ShortcutsContainer/index.js - About 1 hr to fix

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

                    onCompleted: (file) => {
                      this.window?.send(IpcEvents.DOWNLOAD_FINISHED, uuid);
                      this.logger.log(`Download success: ${artistName} - ${title}, path: ${file.path}`);
                      this.logger.log('');
                      this.downloadItems = this.downloadItems.filter((item) => item.uuid !== uuid);
            Severity: Minor
            Found in packages/main/src/controllers/download.ts - About 1 hr to fix

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

              export const Left = () => {
                const [isCollapsed, onCollapse] = useState(false);
                const {
                  width,
                  onSetWidth
              Severity: Minor
              Found in packages/ui/stories/components/resizablePanel.stories.tsx - About 1 hr to fix

                Function fetchArtistDetails has 26 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 getStreamForId has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const getStreamForId = async (id: string, sourceName: string, useSponsorBlock = true): Promise<StreamData> => {
                    try {
                      const videoUrl = baseUrl + id;
                      const trackInfo = await ytdl.getInfo(videoUrl);
                      const formatInfo = ytdl.chooseFormat(trackInfo.formats, { quality: 'highestaudio' });
                  Severity: Minor
                  Found in packages/core/src/rest/Youtube.ts - About 1 hr to fix

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

                    const ArtistView: React.FC<ArtistViewProps> = ({
                      artist,
                      isFavorite,
                      addTrackToQueue,
                      artistInfoSearchByName,
                    Severity: Minor
                    Found in packages/app/app/components/ArtistView/index.tsx - 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 handleFinishedPlaying has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                      handleFinishedPlaying() {
                        const currentSong = this.props.queue.queueItems[
                          this.props.queue.currentSong
                        ];
                        if (
                    Severity: Minor
                    Found in packages/app/app/containers/SoundContainer/index.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 StreamVerificationContainer has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export const StreamVerificationContainer: React.FC = () => {
                      const { t } = useTranslation('queue');
                      const dispatch = useDispatch();
                      const queue = useSelector(queueSelector);
                      const settings = useSelector(settingsSelector);
                    Severity: Minor
                    Found in packages/app/app/containers/StreamVerificationContainer/index.tsx - 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 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.ts - 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 useCommandPaletteActions has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export const useCommandPaletteActions = (): CommandPaletteAction[] => {
                      const history = useHistory();
                      const dispatch = useDispatch();
                      const { t } = useTranslation('command-palette');
                      const settings = useSelector(settingsSelector);
                    Severity: Minor
                    Found in packages/app/app/containers/CommandPaletteContainer/hooks.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 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

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

                        async getEntries(request?: ListeningHistoryRequest): Promise<PagingResult<ListeningHistoryEntry>> {
                          const qb = this.listeningHistoryRepository.createQueryBuilder('entry');
                    
                          if (request?.artist) {
                            qb.andWhere(`entry.artist = '${request.artist}'`);
                    Severity: Minor
                    Found in packages/main/src/services/listening-history/db.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 exports has a Cognitive Complexity of 8 (exceeds 5 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: Minor
                    Found in packages/app/webpack.config.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 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.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 handleCertificateError has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    export function handleCertificateError(event, webContents, url, error, certificate, callback) {
                    Severity: Minor
                    Found in packages/main/src/main.ts - About 45 mins to fix

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

                      export function formatDuration(duration) {
                        if (typeof duration === 'string') {
                          return duration;
                        }
                      
                      
                      Severity: Minor
                      Found in packages/ui/lib/utils.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

                      Severity
                      Category
                      Status
                      Source
                      Language