xouabita/friends-radio

View on GitHub

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"
Severity: Minor
Found in src/client/components/Player.js - About 3 hrs to fix

    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)
    Severity: Major
    Found in src/server/schema/connection-helpers.js - About 2 hrs to fix

      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
      Severity: Major
      Found in src/client/components/MediaCard.js - About 2 hrs to fix

        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}>
        Severity: Major
        Found in src/client/components/MediaFormModal.js - About 2 hrs to fix

          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
          Severity: Major
          Found in src/client/pages/Media.js - About 2 hrs to fix

            Player has 22 functions (exceeds 20 allowed). Consider refactoring.
            Open

            export class Player extends Component {
              constructor(props) {
                super(props)
                this.state = {
                  current: null,
            Severity: Minor
            Found in src/client/components/Player.js - About 2 hrs to fix

              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]
                }
              Severity: Minor
              Found in src/server/jobs/importFromGroup.js - About 1 hr to fix

              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} />
              Severity: Minor
              Found in src/client/components/Player.js - About 1 hr to fix

                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>
                Severity: Minor
                Found in src/client/components/Uploader.js - About 1 hr to fix

                  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'"
                  Severity: Critical
                  Found in src/server/schema/connection-helpers.js - About 1 hr to fix

                    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]
                      }
                    Severity: Minor
                    Found in src/server/jobs/importFromGroup.js - About 1 hr to fix

                      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
                      
                      
                      Severity: Minor
                      Found in src/client/components/ReactionButton.js - About 1 hr to fix

                        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
                        Severity: Minor
                        Found in src/client/components/MediaList.js - About 1 hr to fix

                          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
                          Severity: Minor
                          Found in src/client/components/MediaCard.js - About 55 mins to fix

                          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 = () => {},
                          Severity: Minor
                          Found in src/client/components/MediaList.js - About 25 mins to fix

                          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
                          Severity: Minor
                          Found in src/client/pages/Media.js - About 25 mins to fix

                          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))
                          Severity: Minor
                          Found in src/client/components/MediaList.js - About 25 mins to fix

                          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"
                          Severity: Minor
                          Found in src/client/components/Player.js - About 25 mins to fix

                          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

                          Severity
                          Category
                          Status
                          Source
                          Language