Showing 18 of 33 total issues
File Player.js
has 294 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React, {Component} from "react"
import {connect} from "react-redux"
import SoundcloudPlayer from "react-player/lib/players/SoundCloud"
import YoutubePlayer from "react-player/lib/players/YouTube"
Function resolver
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
resolver(query, {cursorFrom = "created_at", direction = "desc"} = {}) {
return async (obj, args, context, info) => {
let clone
if (typeof query === "function") {
clone = query(obj, args, context, info)
Function MediaCard
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const MediaCard = media => {
const likeStatus = media.myReaction
? media.myReaction.type === "LIKE" ? "active" : "inactive"
: "normal"
const dislikeStatus = media.myReaction
Function render
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const submitText = this.props.edit ? "Update song" : "Add a song"
const modalTitle = this.props.edit ? "Edit song" : "Add a song"
return (
<Modal isOpen={this.props.isOpen} toggle={this.props.toggle}>
Function render
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const {data} = this.props
if (data.loading) return <h3>Loading...</h3>
const {media, me} = data
Player
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
export class Player extends Component {
constructor(props) {
super(props)
this.state = {
current: null,
Function fetchInfo
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
async function fetchInfo(post) {
if (!post.url && post.description) {
const urls = Array.from(getUrls(post.description))
post.url = urls[0]
}
- 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 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
return (
<Container>
<PlayerThumb src={this.thumbnail}>
<Prev onClick={::this.prev} style={this.prevStyle} />
Function render
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
return (
<div>
<Div width="calc(100% - 100px)" margin="20px auto">
<InputGroup>
Consider simplifying this complex logical expression. Open
if ((first && before) || (last && after) || (first && last)) {
const params =
first && before
? "'first' and 'before'"
: first && last ? "'first' and 'last'" : "'last' and 'after'"
Function fetchInfo
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function fetchInfo(post) {
if (!post.url && post.description) {
const urls = Array.from(getUrls(post.description))
post.url = urls[0]
}
Function render
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const {status, type, mediaId, perform, ...props} = this.props
const emoji = type === "dislike" ? thumbDown : thumbUp
Function render
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const {data, play, loadMore} = this.props
return (
<div>
{!data || data.loading
Function MediaCard
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export const MediaCard = media => {
const likeStatus = media.myReaction
? media.myReaction.type === "LIKE" ? "active" : "inactive"
: "normal"
const dislikeStatus = media.myReaction
- 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 withMedias
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function withMedias(
graphqlQuery,
uniqueId,
mediasPath = "medias",
vars = () => {},
- 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 a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
render() {
const {data} = this.props
if (data.loading) return <h3>Loading...</h3>
const {media, me} = 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 mapDispatchToProps
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const mapDispatchToProps = (dispatch, ownProps) => ({
play: (player, cursor) => {
if (player.list === ownProps.uniqueId && cursor === player.current)
player.playing ? dispatch(pause()) : dispatch(play())
else dispatch(start(ownProps.uniqueId, cursor))
- 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 likeStatus
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
get likeStatus() {
if (this.props.current && this.props.current.myReaction) {
const {type} = this.props.current.myReaction
if (type === "LIKE") return "active"
if (type === "DISLIKE") return "inactive"
- 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"