Showing 30 of 59 total issues

Function render has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  render() {
    const emailForm = () => {
      const emailFields = this.state.emails.map((email, index) => {
        return(
          <div className="row" key={`${email}-${index}`}>
Severity: Minor
Found in client/app/bundles/Room/components/Invitation/index.jsx - 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

Method set_story_point has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def self.set_story_point room, current_user, params
    payload = params["data"]
    user_room = UserRoom.find_by_with_cache(user_id: current_user.id, room_id: room.id)

    if user_room&.moderator? && room.valid_vote_point?(payload["point"])
Severity: Minor
Found in app/services/room_communication.rb - 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

Method update_entity has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def update_entity room, params
    @params = params.merge(status: nil)
    bulk_edit_stories
    add_sequence_to_stories
    permit_params!
Severity: Minor
Found in app/repositories/room_repository.rb - About 1 hr to fix

    Function render has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

      render() {
        const accessoryLabel = ((() => {
          if (this.props.editable && this.props.currentUserId !== this.props.id) {
            return(
              <span className="accessory pull-right" onClick={this.remove}>
    Severity: Minor
    Found in client/app/bundles/Room/components/Person.jsx - 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 render has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      render() {
        const defaultArray = [];
        const ticketHeading = (() => {
          if (this.state.data.ungroomed && this.state.data.ungroomed.length) {
            return this.state.data.ungroomed[0].link
    Severity: Minor
    Found in client/app/bundles/Room/components/StoryListBox/mobile.jsx - About 35 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

    Method update_entity has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def update_entity room, params
        @params = params.merge(status: nil)
        bulk_edit_stories
        add_sequence_to_stories
        permit_params!
    Severity: Minor
    Found in app/repositories/room_repository.rb - About 35 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

    Method leaflet_submit has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def leaflet_submit
        head(:bad_request) and return if params[:votes].blank? || @room.closed?
    
        params[:votes].values.each do |vote|
          next unless @room.stories.pluck(:uid).include?(vote[:story_id])
    Severity: Minor
    Found in app/controllers/rooms_controller.rb - About 35 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

    Method send_email has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def send_email
        if request.post?
          receivers = params[:receivers]&.split(",")
          content = params[:content]
          receivers.each do |receiver|
    Severity: Minor
    Found in app/controllers/marketing_controller.rb - About 35 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

    Method create has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def create
        @room = repo.new_entity(room_params.merge(created_by: current_user.id))
        if @room.async_mode?
          premium_check(billing_path, "Only premium user can create async rooms, be our premium member.", !current_user.premium?); return if performed?
        end
    Severity: Minor
    Found in app/controllers/rooms_controller.rb - 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() {
        // TODO
        // Gotta find out why it could be null sometimes
        if (!this.state.data) {
          return null
    Severity: Minor
    Found in client/app/bundles/Room/components/ActionBox/ResultPanel/ResultPanel.jsx - 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