Showing 143 of 661 total issues
Function onStartDownload
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
@ipcEvent(IpcEvents.DOWNLOAD_START)
async onStartDownload(event: IpcMessageEvent, data: NuclearMeta) {
try {
const { uuid } = data;
const downloadRef = this.downloadItems.find((item => item.uuid === uuid));
Function Range
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
const Range = ({
value,
min,
max,
thumbSize,
- 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 getTracksFromDOM
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getTracksFromDOM(processedIndex) {
const cookieBanner = document.getElementById('onetrust-banner-sdk');
if (cookieBanner) {
cookieBanner.style.setProperty('display', 'none', 'important');
Function ScrobblingReducer
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function ScrobblingReducer(state=initialState, action) {
switch (action.type) {
case Scrobbling.LASTFM_CONNECT:
return Object.assign({}, state, {
lastFmAuthToken: action.payload
Function extractPlaylist
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function extractPlaylist(): Promise<SpotifyPlaylist> {
const playlist = getPlaylistGeneralInfo();
ipcRenderer.sendToHost('import-spotify-playlist-metadata', playlist);
Function createChart
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
const createChart = (canvas) => {
const context = canvas.getContext('2d');
const lineGradient = context.createLinearGradient(0, 0, 0, 400);
lineGradient.addColorStop(0, 'rgb(80, 250, 123, 0.3)');
Function SettingsContainer
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
const SettingsContainer: React.FC = () => {
const dispatch = useDispatch();
const scrobbling = useSelector(scrobblingSelector);
const importfavs = useSelector(importfavsSelector);
const mastodon = useSelector(mastodonSelector);
Function useTrackInfoProps
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const useTrackInfoProps = () => {
const dispatch = useDispatch();
const history = useHistory();
const queue = useSelector(queueSelector);
const hasTracks = queue.queueItems.length > 0;
Function useArtistViewProps
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const useArtistViewProps = () => {
const dispatch = useDispatch();
const history = useHistory();
const { artistId } = useParams<{ artistId: string }>();
const artistDetails = useSelector(searchSelectors.artistDetails);
Function listen
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
listen(): void {
const ipc = this.get<IpcMain>(ipcService);
const logger = this.get<Logger>($ipcLogger);
this.controllers.forEach((Controller) => {
Function init
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
init() {
if (this.platform.isMac()) {
const logo = new TouchBarButton({
icon: touchbarIcons.logo,
backgroundColor: '#000000'
Function render
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const {
favorites,
favoritesActions,
searchActions,
Function default
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function (paths) {
return next => (reducer, initialState, enhancer) => {
if (typeof initialState === 'function' && typeof enhancer === 'undefined') {
enhancer = initialState;
Function DownloadsList
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
const DownloadsList: React.FC<DownloadsListProps> = ({
items,
clearFinishedTracks,
pauseDownload,
resumeDownload,
- 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 logEvent
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
logEvent({ direction, event, data, once }: EventMessage) {
const message = `${once ? 'once' : ''} ${direction === 'in' ? '==>' : '<=='} ${event}`;
let dataMessage: string = typeof data;
- 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 render
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
return (
<ErrorBoundary>
<div className={styles.app_container}>
<MiniPlayerContainer />
Function UserPanelContainer
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const UserPanelContainer: React.FC = () => {
const { t } = useTranslation('app');
const dispatch = useDispatch();
const [isSignUpFormOpen, setSignUpFormOpen] = useState(false);
Function renderTrigger
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
renderTrigger(track) {
const {
displayCover,
displayTrackNumber,
displayArtist,
Function PromotedArtistsContainer
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const PromotedArtistsContainer: React.FC = () => {
const dispatch = useDispatch();
const history = useHistory();
const isPromotedArtistFeatureEnabled = useSelector(isConfigFlagEnabled(ConfigFlag.PROMOTED_ARTISTS));
const promotedArtistBackground = useSelector(paramValue(ParamKey.PROMOTED_ARTIST_BACKGROUND));
Function createPopup
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
createPopup() {
const {
url,
width,
height,