xouabita/friends-radio

View on GitHub

Showing 33 of 33 total issues

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

exports.up = function(knex, Promise) {
  return knex.schema.table('reactions', t =>
    t.dropForeign('media_id')
  ).then(() => knex.schema.table('reactions', t =>
      t.foreign('media_id').references('medias.id').onDelete('CASCADE')
Severity: Major
Found in migrations/20170607165653_add_cascade_on_delete.js and 1 other location - About 3 hrs to fix
migrations/20170607165653_add_cascade_on_delete.js on lines 9..15

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

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

exports.down = function(knex, Promise) {
  return knex.schema.table('reactions', t =>
    t.dropForeign('media_id')
  ).then(() => knex.schema.table('reactions', t =>
      t.foreign('media_id').references('medias.id').onDelete('CASCADE')
Severity: Major
Found in migrations/20170607165653_add_cascade_on_delete.js and 1 other location - About 3 hrs to fix
migrations/20170607165653_add_cascade_on_delete.js on lines 1..7

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

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

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

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

              <FormGroup>
                <Label for="title">Title</Label>
                <Input
                  name="title"
                  placeholder="Title"
    Severity: Major
    Found in src/client/components/MediaFormModal.js and 2 other locations - About 3 hrs to fix
    src/client/components/MediaFormModal.js on lines 70..78
    src/client/components/MediaFormModal.js on lines 79..87

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

    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 3 locations. Consider refactoring.
    Open

              <FormGroup>
                <Label for="thumbnail">Thumbnail</Label>
                <Input
                  name="thumbnail"
                  placeholder="Thumbnail"
    Severity: Major
    Found in src/client/components/MediaFormModal.js and 2 other locations - About 3 hrs to fix
    src/client/components/MediaFormModal.js on lines 61..69
    src/client/components/MediaFormModal.js on lines 70..78

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

    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 3 locations. Consider refactoring.
    Open

              <FormGroup>
                <Label for="artist">Artist</Label>
                <Input
                  name="artist"
                  placeholder="Artist"
    Severity: Major
    Found in src/client/components/MediaFormModal.js and 2 other locations - About 3 hrs to fix
    src/client/components/MediaFormModal.js on lines 61..69
    src/client/components/MediaFormModal.js on lines 79..87

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

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

      Similar blocks of code found in 2 locations. 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: Major
      Found in src/client/components/Player.js and 1 other location - About 2 hrs to fix
      src/client/components/Player.js on lines 248..256

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

      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

        get dislikeStatus() {
          if (this.props.current && this.props.current.myReaction) {
            const {type} = this.props.current.myReaction
            if (type === "DISLIKE") return "active"
            if (type === "LIKE") return "inactive"
      Severity: Major
      Found in src/client/components/Player.js and 1 other location - About 2 hrs to fix
      src/client/components/Player.js on lines 238..246

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

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

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

                  <BoxCount to={`/u/${id}/dislikes`}>
                    <Count>
                      {dislikeCount}
                    </Count>
                    <div>
          Severity: Major
          Found in src/client/components/UserCard.js and 1 other location - About 2 hrs to fix
          src/client/components/UserCard.js on lines 67..77

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

          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

                  <BoxCount to={`/u/${id}/likes`}>
                    <Count>
                      {likeCount}
                    </Count>
                    <div>
          Severity: Major
          Found in src/client/components/UserCard.js and 1 other location - About 2 hrs to fix
          src/client/components/UserCard.js on lines 78..88

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

          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 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
                      Severity
                      Category
                      Status
                      Source
                      Language