Showing 143 of 652 total issues
Function playlistRouter
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function playlistRouter(store: Store, rendererWindow: BrowserWindow['webContents']): ISwaggerizedRouter {
const router = express.Router() as ISwaggerizedRouter;
swagger.swaggerize(router);
Function getChartOptions
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getChartOptions(data) {
return {
type: 'line',
data,
options: {
Function renderArtistHeader
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
function renderArtistHeader() {
return (
<div className={styles.artist_header_overlay}>
<div className={styles.artist_header_container}>
{
Function settingsRouter
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function settingsRouter(store: Store, rendererWindow: BrowserWindow['webContents']): ISwaggerizedRouter {
const router = express.Router() as ISwaggerizedRouter;
swagger.swaggerize(router);
Function panes
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
panes() {
const artistsHasResults = _.get(this.props.artistSearchResults, ['length'], 0) > 0;
const albumsHasResults = _.get(this.props.albumSearchResults, ['length'], 0) > 0;
const tracksHasResults = _.get(this.props.trackSearchResults, ['info', 'length'], 0) > 0;
const playlistsHasResults = _.get(this.props.playlistSearchResults, ['info', 'length'], 0) > 0;
Function PlayerReducer
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function PlayerReducer(state=initialState, action: PlayerReducerActions): PlayerReducerState {
switch (action.type) {
case getType(PlayerActions.startPlayback):
return Object.assign({}, state, {
playbackStatus: Sound.status.PLAYING
Function Mic
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const Mic = () => {
const [audioNode, setAudioNode] = useState<AudioNode>();
const [audioContext, setAudioContext] = useState<AudioContext>();
const [preset, setPreset] = useState<string>();
useEffect(() => {
Function constructor
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(
@inject(Config) private config: Config,
@inject($mainLogger) private logger: Logger,
@inject($ipcLogger) private ipcLogger: Logger,
@inject(Platform) private platform: Platform,
Function render
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { queue, player, equalizer, actions, enableSpectrum, currentStream, location, defaultEqualizer } = this.props;
const currentTrack = queue.queueItems[queue.currentSong];
const usedEqualizer = enableSpectrum ? equalizer : defaultEqualizer;
Function usePlayerControlsProps
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const usePlayerControlsProps = () => {
const dispatch = useDispatch();
const queue = useSelector(queueSelector);
const settings = useSelector(settingsSelector);
const playbackStatus = useSelector(playerSelectors.playbackStatus);
Function ListeningHistoryContainer
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const ListeningHistoryContainer: React.FC = () => {
const queue = useSelector(queueSelector);
const [limit, setLimit] = useState(10);
const [afterCursor, setAfterCursor] = useState(undefined);
const [beforeCursor, setBeforeCursor] = useState(undefined);
Function webpackFinal
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
webpackFinal: config => {
return {
...config,
module: {
...config.module,
Function addToQueue
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
(item: QueueItem, asNextItem = false) =>
async (dispatch, getState) => {
const { local }: RootState = getState();
item = {
...safeAddUuid(item),
- 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 InputDialog
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
const InputDialog: React.VFC<InputDialogProps> = ({
initialString,
header,
placeholder,
acceptLabel,
- 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 TrackTable
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
function TrackTable<T extends Track>({
className,
tracks,
customColumns = [],
isTrackFavorite,
- 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 SearchBoxContainer
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
const SearchBoxContainer: React.FC = () => {
const { t } = useTranslation('search');
const history = useHistory();
const dispatch = useDispatch();
const unifiedSearchStarted = useSelector(searchSelectors.unifiedSearchStarted);
Function mockTrackResult
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function mockTrackResult() {
global.fetch = jest.fn(() =>
Promise.resolve({
json: jest.fn(() => ({
'resultCount': 1,
Function useSpotifyPlaylistImporterProps
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const useSpotifyPlaylistImporterProps = (t: TFunction<string>) => {
const dispatch = useDispatch();
const onImportFromUrl = useCallback((data: SpotifyPlaylist) => {
dispatch(PlaylistActions.addPlaylistFromUrl(data, t));
}, [dispatch, t]);
Function mockArtistAlbumsResult
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function mockArtistAlbumsResult() {
global.fetch = jest.fn(() =>
Promise.resolve({
json: jest.fn(() => ({
'resultCount': 2,
Function handleFinishedPlaying
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
handleFinishedPlaying() {
const currentSong = this.props.queue.queueItems[
this.props.queue.currentSong
];
if (