Showing 143 of 659 total issues
Function settingsRouter
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function settingsRouter(store: Store, rendererWindow: BrowserWindow['webContents']): ISwaggerizedRouter {
const router = express.Router() as ISwaggerizedRouter;
swagger.swaggerize(router);
Function playlistRouter
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function playlistRouter(store: Store, rendererWindow: BrowserWindow['webContents']): ISwaggerizedRouter {
const router = express.Router() as ISwaggerizedRouter;
swagger.swaggerize(router);
Function renderArtistHeader
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function renderArtistHeader() {
return (
<div className={styles.artist_header_overlay}>
<div className={styles.artist_header_container}>
{
Function getChartOptions
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function getChartOptions(data) {
return {
type: 'line',
data,
options: {
Function panes
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
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 constructor
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
constructor(
@inject(Config) private config: Config,
@inject($mainLogger) private logger: Logger,
@inject($ipcLogger) private ipcLogger: Logger,
@inject(Platform) private platform: Platform,
Function Mic
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const Mic = () => {
const [audioNode, setAudioNode] = useState<AudioNode>();
const [audioContext, setAudioContext] = useState<AudioContext>();
const [preset, setPreset] = useState<string>();
useEffect(() => {
Function PlayerReducer
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
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 usePlayerControlsProps
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const usePlayerControlsProps = () => {
const dispatch = useDispatch();
const queue = useSelector(queueSelector);
const settings = useSelector(settingsSelector);
const playbackStatus = useSelector(playerSelectors.playbackStatus);
Function render
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
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 ListeningHistoryContainer
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
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
Open
webpackFinal: config => {
return {
...config,
module: {
...config.module,
Function TrackTable
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
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 addToQueue
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
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 SearchBoxContainer
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const SearchBoxContainer: React.FC = () => {
const { t } = useTranslation('search');
const history = useHistory();
const dispatch = useDispatch();
const unifiedSearchStarted = useSelector(searchSelectors.unifiedSearchStarted);
Function useSpotifyPlaylistImporterProps
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const useSpotifyPlaylistImporterProps = (t: TFunction<string>) => {
const dispatch = useDispatch();
const onImportFromUrl = useCallback((data: SpotifyPlaylist) => {
dispatch(PlaylistActions.addPlaylistFromUrl(data, t));
}, [dispatch, t]);
Function mockTrackResult
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function mockTrackResult() {
global.fetch = jest.fn(() =>
Promise.resolve({
json: jest.fn(() => ({
'resultCount': 1,
Function handleFinishedPlaying
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
handleFinishedPlaying() {
const currentSong = this.props.queue.queueItems[
this.props.queue.currentSong
];
if (
Function DashboardContainer
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const DashboardContainer: React.FC = () => {
const dispatch = useDispatch();
const history = useHistory();
const dashboard = useSelector(dashboardSelector);
Function mockArtistAlbumsResult
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function mockArtistAlbumsResult() {
global.fetch = jest.fn(() =>
Promise.resolve({
json: jest.fn(() => ({
'resultCount': 2,