Showing 63 of 446 total issues
Function setUpAutoUpdate
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
const setUpAutoUpdate = () => {
if (global.DEV_MODE) return;
try {
autoUpdater.setFeedURL(`https://update.gpmdp.xyz/update/${platform}/${app.getVersion()}`);
Function constructor
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor() {
let ready = true;
this.__defineGetter__('ready', () => ready);
this.__defineSetter__('ready', (newValue) => {
ready = newValue;
Consider simplifying this complex logical expression. Open
if ((osVersion[0] && parseInt(osVersion[0], 10) > 6) || (parseInt(osVersion[0], 10) === 6 && parseInt(osVersion[1], 10) > 1)) {
// If we are above windows 7 we can use the system notifications but with
// the silent flag forced on
require('../silent_Notification');
} else {
Function render
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
return (
<SettingsTabWrapper>
<PlatformSpecific platform="darwin">
<div style={{ paddingBottom: 16 }}>
Function waitForExternal
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
const waitForExternal = setInterval(() => {
if (serviceReady()) {
clearInterval(waitForExternal);
if (service === 'youtube-music') {
Function handleCommand
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
handleCommand(command) {
if (!command) return;
let matchedFn;
let matchedKey = '';
let fnArg;
Function reset
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
reset() {
this.data = {
playing: false,
song: {
title: null,
Function render
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const actions = [
<FlatButton
label={TranslationProvider.query('button-text-cancel-alarm')}
onTouchTap={this.cancel}
Function render
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
return (
<WindowContainer isMainWindow title={process.platform === 'darwin' ? this.state.title : ''} confirmClose={this._confirmCloseWindow}>
<div className="drag-handle-large"></div>
<div className={`loader ${this.state.loading ? '' : 'hidden'}`}>
Function render
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
return (
<WindowContainer title={TranslationProvider.query('title-settings')}>
<Tabs style={styles.tabContainer} contentContainerStyle={styles.tab}>
<Tab label={TranslationProvider.query('title-settings-general')}>
Function resolveLyrics
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const resolveLyrics = (song) => {
const promises = [() => attemptLyricsWikia(`${song.artist}:${song.title}`)];
let bracketed = song.title.match(bracketedRegex()) || [];
// DEV: Attempt to find lyrics from wikia
Function fetchLyricsPage
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
new Promise((resolve, reject) => {
const search = `http://www.lyricsfreak.com/search.php?a=search&type=song&q=${title.replace(/ /g, '+')}`;
request(search, (err, resp) => {
try {
if (err) return reject(err);
Function render
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const buttonProps = {
primary: true,
};
let authStatus = TranslationProvider.query('lastfm-login-not-authorized');
Function installNowPlayingMenu
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function installNowPlayingMenu() {
installNowPlayingSeperator();
installNowPlayingButton('label-pause-after-song', ':gpmdppause', () => {
Emitter.fireAtGoogle('pauseAfter:show');
});
- Read upRead up
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 default
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export default function (fileName) {
const targetFileName = process.windowsStore ? `${fileName}-uwp` : fileName;
const DIR = path.resolve(`${(app ? app.getPath('userData') : remote.require('electron').app.getPath('userData'))}/json_store`); // eslint-disable-line
const PATH = `${DIR}/${targetFileName}.json`;
- Read upRead up
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 toggleMainWindow
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function toggleMainWindow() {
// the mainWindow variable will be GC'd
// we must find the window ourselves
const win = WindowManager.getAll('main')[0];
if (!win) return;
- Read upRead up
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 add
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
add(window, name = null) {
const newID = Symbol();
this.windows[newID] = window;
this.IDMap[window.id] = newID;
window.on('closed', () => {
Function handleStartupEvent
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
const handleStartupEvent = () => {
if (process.platform !== 'win32') {
return false;
}
Function timeHandler
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.timeHandler = (e, timeObj) => {
$(findDOMNode(this)).find('#lyrics_bar').width(`${(timeObj.total === 0 ? 0 : timeObj.current / timeObj.total) * 100}%`);
let jumped = false;
if (Math.abs(timeObj.current - jumpDetect) > 1000) {
animate = true;
Function render
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const actions = [
<FlatButton
label={TranslationProvider.query('button-text-lets-go')}
primary