lawrencechanyewlong/wherewolfpro

View on GitHub

Showing 15 of 767 total issues

Method select_contacts has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

  def select_contacts
    user = User.where(:id => session[:id]).take
    if user
      @receiver_all = []
      @receiver_name_all = []
Severity: Minor
Found in app/controllers/event_controller.rb - About 5 hrs 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

File event_controller.rb has 343 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class EventController < ApplicationController
  attr_accessor :latlng
  attr_accessor :formatted_address
  #attr_accessor :latitud
  #attr_accessor :longitud
Severity: Minor
Found in app/controllers/event_controller.rb - About 4 hrs to fix

    Method toDurationString has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.toDurationString(duration_setting)
            if duration_setting == 'arrive'
                return "Until I Arrive"
            elsif duration_setting[-4..-1] == 'hour' or duration_setting[-5..-1] == 'hours'
                if duration_setting[1] == ' '
    Severity: Minor
    Found in app/helpers/welcome_helper.rb - About 3 hrs 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 select_contacts has 53 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def select_contacts
        user = User.where(:id => session[:id]).take
        if user
          @receiver_all = []
          @receiver_name_all = []
    Severity: Major
    Found in app/controllers/event_controller.rb - About 2 hrs to fix

      Method user_map has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def user_map
          
          def parseDurationToCheckCondition(d)
            # return true if condition is met and stop tracking, else return false if keep tracking
            if d == 'arrive'
      Severity: Minor
      Found in app/controllers/event_controller.rb - About 1 hr to fix

        Method send_mail has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def send_mail
            gmail = Gmail.new('woofwhere', 'battle431101')
            if session[:id]
              user = User.find_by id: session[:id]
              if user
        Severity: Minor
        Found in app/controllers/event_controller.rb - About 1 hr to fix

          Method toDurationString has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def self.toDurationString(duration_setting)
                  if duration_setting == 'arrive'
                      return "Until I Arrive"
                  elsif duration_setting[-4..-1] == 'hour' or duration_setting[-5..-1] == 'hours'
                      if duration_setting[1] == ' '
          Severity: Minor
          Found in app/helpers/welcome_helper.rb - About 1 hr to fix

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

              def user_map
                
                def parseDurationToCheckCondition(d)
                  # return true if condition is met and stop tracking, else return false if keep tracking
                  if d == 'arrive'
            Severity: Minor
            Found in app/controllers/event_controller.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 summary has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def summary
                
                def parseDuration(d)
                  if d
                    if d == 'arrive'
            Severity: Minor
            Found in app/controllers/event_controller.rb - About 1 hr to fix

              Method store_duration has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                def store_duration
                  logger.debug params.inspect
                  if params[:arrive]
                    @duration = 'arrive'
                  elsif params[:until_this_time] != '0'
              Severity: Minor
              Found in app/controllers/event_controller.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 send_mail has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                def send_mail
                  gmail = Gmail.new('woofwhere', 'battle431101')
                  if session[:id]
                    user = User.find_by id: session[:id]
                    if user
              Severity: Minor
              Found in app/controllers/event_controller.rb - 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

              Method parseDurationToCheckCondition has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def parseDurationToCheckCondition(d)
                    # return true if condition is met and stop tracking, else return false if keep tracking
                    if d == 'arrive'
                      # print "\n Inside d=='arrive' \n"
                      # print @event.current_lat, @event.current_lng
              Severity: Minor
              Found in app/controllers/event_controller.rb - About 45 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 parseDuration has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def parseDuration(d)
                    if d
                      if d == 'arrive'
                        return 'Until I arrive'
                      elsif d[d.size-1] == 'm'
              Severity: Minor
              Found in app/controllers/event_controller.rb - About 45 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 summary has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                def summary
                  
                  def parseDuration(d)
                    if d
                      if d == 'arrive'
              Severity: Minor
              Found in app/controllers/event_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

              Avoid too many return statements within this method.
              Open

                      return nil
              Severity: Major
              Found in app/controllers/event_controller.rb - About 30 mins to fix
                Severity
                Category
                Status
                Source
                Language