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') {
- 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 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;
- 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
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';
Function setContextMenu
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
const setContextMenu = (track) => {
const contextMenu = Menu.buildFromTemplate([
{
label: 'Service',
enabled: false,
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',
PlaybackAPI
has 29 functions (exceeds 20 allowed). Consider refactoring. Open
class PlaybackAPI extends EventEmitter {
constructor(filePrefix = '') {
super();
this.PATH = createJSON(`${filePrefix}playback`);
Function componentDidMount
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
componentDidMount() {
let animate = false;
let animationTimer;
let noLyricsTimer;
let jumpDetect;
- 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 componentDidMount
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
componentDidMount() {
let animate = false;
let animationTimer;
let noLyricsTimer;
let jumpDetect;
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(() => {
- 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
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';
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">
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',
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;
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';
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;
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') {
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)) {
- 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 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
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) => {
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(() => {