MarshallOfSound/Google-Play-Music-Desktop-Player-UNOFFICIAL-

View on GitHub

Showing 63 of 446 total issues

Function handleWSMessage has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

const handleWSMessage = (ws) =>
  (data) => {
    try {
      const command = JSON.parse(data);
      if (command.type === 'disconnect') {
Severity: Minor
Found in src/main/features/core/websocketAPI.js - About 4 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 setPresence has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

const setPresence = () => {
  if (!Settings.get('discordRichPresence', false)) {
    if (client) {
      client.disconnect();
      client = null;
Severity: Minor
Found in src/main/features/core/discordRichPresence.js - About 4 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

File gulpfile.babel.js has 362 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* eslint arrow-body-style: 0 */

import gulp from 'gulp';

import { spawn, exec } from 'child_process';
Severity: Minor
Found in gulpfile.babel.js - About 4 hrs to fix

    Function setContextMenu has 95 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const setContextMenu = (track) => {
      const contextMenu = Menu.buildFromTemplate([
        {
          label: 'Service',
          enabled: false,
    Severity: Major
    Found in src/main/features/core/tray.js - About 3 hrs to fix

      Function mprisService has 89 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function mprisService() {
        const mainWindow = WindowManager.getAll('main')[0];
      
        const player = mpris({
          name: 'google_play_music_desktop_player',
      Severity: Major
      Found in src/main/features/linux/mprisService.js - About 3 hrs to fix

        PlaybackAPI has 29 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class PlaybackAPI extends EventEmitter {
          constructor(filePrefix = '') {
            super();
        
            this.PATH = createJSON(`${filePrefix}playback`);
        Severity: Minor
        Found in src/main/utils/PlaybackAPI.js - About 3 hrs to fix

          Function componentDidMount has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
          Open

            componentDidMount() {
              let animate = false;
              let animationTimer;
              let noLyricsTimer;
              let jumpDetect;
          Severity: Minor
          Found in src/renderer/ui/components/generic/LyricsViewer.js - About 3 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 componentDidMount has 73 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            componentDidMount() {
              let animate = false;
              let animationTimer;
              let noLyricsTimer;
              let jumpDetect;
          Severity: Major
          Found in src/renderer/ui/components/generic/LyricsViewer.js - About 2 hrs to fix

            Function waitForBody has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
            Open

            const waitForBody = setInterval(() => {
              if (document.body) {
                clearInterval(waitForBody);
                document.querySelectorAll('.top-bar')[0].setAttribute('style', '-webkit-app-region: drag');
                setInterval(() => {
            Severity: Minor
            Found in src/renderer/lastFM.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

            File websocketAPI.js has 287 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import { app } from 'electron';
            import fs from 'fs';
            import os from 'os';
            import path from 'path';
            import uuid from 'uuid';
            Severity: Minor
            Found in src/main/features/core/websocketAPI.js - About 2 hrs to fix

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

                render() {
                  return (
                    <SettingsTabWrapper>
                      <ToggleableOption label={TranslationProvider.query('settings-option-min-to-tray')} settingsKey={"minToTray"} />
                      <PlatformSpecific platform="linux">
              Severity: Major
              Found in src/renderer/ui/components/settings/tabs/GeneralTab.js - About 2 hrs to fix

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

                const enableAPI = () => {
                  let portOpen = true;
                  if (process.platform === 'win32') {
                    const testResult = spawnSync(
                      'netsh',
                Severity: Major
                Found in src/main/features/core/websocketAPI.js - About 2 hrs to fix

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

                  const setPresence = () => {
                    if (!Settings.get('discordRichPresence', false)) {
                      if (client) {
                        client.disconnect();
                        client = null;
                  Severity: Major
                  Found in src/main/features/core/discordRichPresence.js - About 2 hrs to fix

                    File customUI.js has 263 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import { remote } from 'electron';
                    import _ from 'lodash';
                    
                    import { style, cssRule } from '../generic/_helpers';
                    
                    
                    Severity: Minor
                    Found in src/renderer/windows/GPMWebView/interface/gpm/customUI.js - About 2 hrs to fix

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

                        (data) => {
                          try {
                            const command = JSON.parse(data);
                            if (command.type === 'disconnect') {
                              connectClientShouldReconnect = false;
                      Severity: Major
                      Found in src/main/features/core/websocketAPI.js - About 2 hrs to fix

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

                          render() {
                            const muiTheme = generateTheme(this.state.theme, this.state.themeColor, this.state.themeType);
                        
                            const fadedBackground = {};
                            if (this.state.theme && this.state.themeType === 'FULL') {
                        Severity: Major
                        Found in src/renderer/ui/components/generic/WindowContainer.js - About 2 hrs to fix

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

                            _save(force) {
                              const now = (new Date()).getTime();
                              // During some save events (like resize) we need to queue the disk writes
                              // so that we don't blast the disk every millisecond
                              if ((now - this.lastSync > 250 || force)) {
                          Severity: Minor
                          Found in src/main/utils/Settings.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 receiverFn has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            new Promise((resolve, reject) => {
                              let dialog = document.createElement('paper-dialog');
                              trigID++;
                              const body = document.getElementsByTagName('body')[0];
                              const title = 'Choose Cast Device'; // TODO: New translate key needed
                          Severity: Major
                          Found in src/renderer/windows/GPMWebView/chromecast.js - About 2 hrs to fix

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

                              connect: (extensionId) => {
                                const createChannel = (label) => { // eslint-disable-line
                                  const fns = [];
                                  return {
                                    addListener: (...args) => {
                            Severity: Minor
                            Found in src/renderer/windows/GPMWebView/runtime.js - About 2 hrs to fix

                              Function waitForBody has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              const waitForBody = setInterval(() => {
                                if (document.body) {
                                  clearInterval(waitForBody);
                                  document.querySelectorAll('.top-bar')[0].setAttribute('style', '-webkit-app-region: drag');
                                  setInterval(() => {
                              Severity: Minor
                              Found in src/renderer/lastFM.js - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language