xouabita/friends-radio

View on GitHub

Showing 33 of 33 total issues

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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

            if (before) {
              const beforeCursor = this.decode(before)
              const operator = direction === "desc" ? ">" : "<"
              clone.where(cursorFrom, operator, beforeCursor)
            }
      Severity: Minor
      Found in src/server/schema/connection-helpers.js and 1 other location - About 50 mins to fix
      src/server/schema/connection-helpers.js on lines 99..103

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 52.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

            if (after) {
              const afterCursor = this.decode(after)
              const operator = direction === "desc" ? "<" : ">"
              clone.where(cursorFrom, operator, afterCursor)
            }
      Severity: Minor
      Found in src/server/schema/connection-helpers.js and 1 other location - About 50 mins to fix
      src/server/schema/connection-helpers.js on lines 105..109

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 52.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      export function Dislike(props) {
        const Styled = glamorous(Reaction)({left: margin})
        return <Styled type="dislike" {...props} />
      }
      Severity: Minor
      Found in src/client/components/Player.js and 1 other location - About 45 mins to fix
      src/client/components/Player.js on lines 119..122

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 50.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      export function Like(props) {
        const Styled = glamorous(Reaction)({right: margin})
        return <Styled type="like" {...props} />
      }
      Severity: Minor
      Found in src/client/components/Player.js and 1 other location - About 45 mins to fix
      src/client/components/Player.js on lines 123..126

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 50.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

        return knex.schema
          .createTable("vars", t => {
            t.string("name").primary()
            t.string("value")
          })
      Severity: Minor
      Found in migrations/20170920112717_create_vars_table.js and 1 other location - About 40 mins to fix
      migrations/20161008164433_create_user.js on lines 2..5

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 49.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

        return knex.schema.createTable('users', t => {
          t.string('id').primary()
          t.string('name')
        })
      Severity: Minor
      Found in migrations/20161008164433_create_user.js and 1 other location - About 40 mins to fix
      migrations/20170920112717_create_vars_table.js on lines 2..6

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 49.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      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

      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 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 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

      Severity
      Category
      Status
      Source
      Language