null-open-security-community/swachalit

View on GitHub

Showing 12 of 78 total issues

Class Event has 27 methods (exceeds 20 allowed). Consider refactoring.
Open

class Event < ActiveRecord::Base
  audited
  @queue = :event_jobs

  attr_accessible :name, :description, :event_type_id, :chapter_id, :venue_id
Severity: Minor
Found in app/models/event.rb - About 3 hrs to fix

    Class User has 23 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class User < ActiveRecord::Base
      audited
    
      # Include default devise modules. Others available are:
      # :token_authenticatable, :confirmable,
    Severity: Minor
    Found in app/models/user.rb - About 2 hrs to fix

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

        def setup_scheduled_tasks
          return if disable_background_tasks?
      
          remove_scheduled_tasks()
      
      
      Severity: Minor
      Found in app/models/event.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 mass_update has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def mass_update
          @event_registrations = @event.event_registrations
      
          errors = []
          if verified_request?
      Severity: Minor
      Found in app/controllers/leads/event_registrations_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 date_time_validator has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def date_time_validator
          if self.start_time and self.end_time
            errors.add(:start_time, 'cannot be before event start') if self.event.start_time > self.start_time
            errors.add(:end_time, 'cannot be after event end') if self.event.end_time < self.end_time
            errors.add(:end_time, 'cannot modify beyond 30 days after Event End Time') \
      Severity: Minor
      Found in app/models/event_session.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 rsvp_user_reminder has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def rsvp_user_reminder()
          self.event.event_registrations.each do |registration|
            next unless registration.confirmed?
            EventMailer.rsvp_user_reminder_mail(registration.user, event).deliver_now() unless registration.user.nil?
          end
      Severity: Minor
      Found in app/models/event_automatic_notification_task.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 speaker_remind_presentation_update has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def speaker_remind_presentation_update
          self.event.event_sessions.each do |ev_session|
            next if ev_session.placeholder?
            next unless ev_session.presentation_url.to_s.empty?
            EventMailer.session_speaker_presentation_update_mail(ev_session).deliver_now()
      Severity: Minor
      Found in app/models/event_automatic_notification_task.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 s
      Severity: Major
      Found in app/helpers/application_helper.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

            return "http://#{s}" if s !~ /\Ahttp/i   # Force protocol
        Severity: Major
        Found in app/helpers/application_helper.rb - About 30 mins to fix

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

            def registration_active?
              return false unless self.accepting_registration?
          
              if self.registration_start_time and self.registration_end_time
                (Time.now > self.registration_start_time) and (Time.now < self.registration_end_time)
          Severity: Minor
          Found in app/models/event.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

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

            def create
              @event_registration = @event.event_registrations.new(params[:event_registration])
              @event_registration.event = @event
              @event_registration.user = current_user
          
          
          Severity: Minor
          Found in app/controllers/event_registrations_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

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

            def initialize(*args)
              super(*args)
          
              unless self.event.nil?
                self.start_time = self.event.start_time if self.start_time.nil?
          Severity: Minor
          Found in app/models/event_session.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

          Severity
          Category
          Status
          Source
          Language