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

View on GitHub

Showing 446 of 446 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

Severity: Major
Found in gulpfile.babel.js and 1 other location - About 3 hrs to fix
gulpfile.babel.js on lines 366..371

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 99.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

              try {
                fs.writeFileSync(this.PATH, JSON.stringify(this.data, null, 4));
              } catch (e) {
                if (this.saving) clearTimeout(this.saving);
                this.saving = setTimeout(this._save.bind(this), 275);
      Severity: Major
      Found in src/main/utils/Settings.js and 1 other location - About 2 hrs to fix
      src/main/utils/PlaybackAPI.js on lines 87..92

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 91.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

            try {
              fs.writeFileSync(this.PATH, JSON.stringify(this.data, null, 4));
            } catch (e) {
              if (this.saving) clearTimeout(this.saving);
              this.saving = setTimeout(this._save.bind(this), 275);
      Severity: Major
      Found in src/main/utils/PlaybackAPI.js and 1 other location - About 2 hrs to fix
      src/main/utils/Settings.js on lines 82..87

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 91.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          {
            label: TranslationProvider.query('tray-label-ytm'),
            click: () => {
              // DEV: default to the other service so it will switch if not set.
              const currentService = Settings.get('service', 'google-play-music');
      Severity: Major
      Found in src/main/features/core/tray.js and 1 other location - About 2 hrs to fix
      src/main/features/core/tray.js on lines 88..99

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 86.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          {
            label: TranslationProvider.query('tray-label-gpm'),
            click: () => {
              // DEV: default to the other service so it will switch if not set.
              const currentService = Settings.get('service', 'youtube-music');
      Severity: Major
      Found in src/main/features/core/tray.js and 1 other location - About 2 hrs to fix
      src/main/features/core/tray.js on lines 100..111

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 86.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      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

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                fireAtGoogle(event, ...details) {
                  if (this.ready) {
                    ipcRenderer.send('passback', {
                      event,
                      details,
              Severity: Major
              Found in src/renderer/rendererEmitter.js and 1 other location - About 2 hrs to fix
              src/renderer/rendererEmitter.js on lines 80..89

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 81.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                speech.registerHandler(['turn shuffle off', 'shuffle off'], () =>
                  new Promise((resolve) => {
                    if (GPM.playback.getShuffle() === window.GMusic.ShuffleStatus.ALL_SHUFFLE) {
                      GPM.playback.toggleShuffle();
                    }
              src/renderer/windows/GPMWebView/interface/voiceControls/index.js on lines 84..91

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 81.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                speech.registerHandler(['turn shuffle on', 'shuffle on'], () =>
                  new Promise((resolve) => {
                    if (GPM.playback.getShuffle() === window.GMusic.ShuffleStatus.NO_SHUFFLE) {
                      GPM.playback.toggleShuffle();
                    }
              src/renderer/windows/GPMWebView/interface/voiceControls/index.js on lines 93..100

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 81.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                fireAtMain(event, ...details) {
                  if (this.ready) {
                    ipcRenderer.send('passback:main', {
                      event,
                      details,
              Severity: Major
              Found in src/renderer/rendererEmitter.js and 1 other location - About 2 hrs to fix
              src/renderer/rendererEmitter.js on lines 91..100

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 81.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              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 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 _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

                  Severity
                  Category
                  Status
                  Source
                  Language