jwood/auroraalarm

View on GitHub

Showing 10 of 10 total issues

Method conversion_array has 91 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def conversion_array
    [
      83.77,83.62,83.49,83.35,83.22,83.10,82.98,82.86,82.76,82.67,82.58,82.49,82.42,82.36,82.31,82.26,82.22,82.19,82.17,82.16,82.16,82.16,82.18,82.21,82.24,82.29,82.34,82.41,82.47,82.55,82.65,82.75,82.86,82.97,83.10,83.23,83.37,83.51,83.66,83.82,83.98,84.14,84.30,84.47,84.63,84.78,84.93,85.08,85.22,85.33,85.44,85.53,85.61,85.66,85.70,85.71,85.71,85.68,85.63,85.56,85.47,85.37,85.25,85.12,84.99,84.85,84.70,84.54,84.39,84.23,84.08,83.92,
      82.94,82.69,82.45,82.22,82.01,81.81,81.63,81.45,81.30,81.15,81.02,80.90,80.79,80.69,80.61,80.54,80.48,80.44,80.40,80.38,80.37,80.37,80.39,80.42,80.47,80.53,80.61,80.69,80.80,80.92,81.05,81.21,81.38,81.57,81.77,81.99,82.23,82.48,82.75,83.04,83.33,83.65,83.96,84.30,84.64,84.99,85.33,85.68,86.01,86.34,86.65,86.92,87.16,87.35,87.46,87.49,87.44,87.32,87.13,86.89,86.62,86.32,86.00,85.68,85.35,85.02,84.70,84.38,84.07,83.77,83.48,83.20,
      81.63,81.31,81.02,80.75,80.50,80.26,80.04,79.84,79.66,79.50,79.34,79.21,79.09,78.98,78.89,78.80,78.74,78.68,78.63,78.60,78.58,78.59,78.59,78.61,78.66,78.72,78.79,78.88,79.00,79.13,79.29,79.47,79.67,79.90,80.15,80.42,80.72,81.04,81.39,81.77,82.16,82.58,83.02,83.48,83.96,84.46,84.97,85.50,86.04,86.59,87.15,87.70,88.24,88.76,89.15,89.25,88.96,88.49,87.97,87.44,86.90,86.38,85.86,85.35,84.87,84.39,83.94,83.50,83.09,82.69,82.32,81.96,
Severity: Major
Found in app/services/geolocation_service.rb - About 3 hrs to fix

    Method event_to_alert_on has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

      def event_to_alert_on(yesterdays_old_event, yesterdays_event, todays_event)
        yesterday_old = yesterdays_old_event ? yesterdays_old_event.expected_storm_strength : ""
        yesterday = yesterdays_event ? yesterdays_event.geomagnetic_storm_level : ""
        today = todays_event ? todays_event.geomagnetic_storm_level : ""
    
    
    Severity: Minor
    Found in app/monitors/space_weather_monitor.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 current_forecast has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

      def current_forecast
        forecast = []
        data = forecast_data || ""
        data.split("\n").reject(&:blank?).each do |line|
          unless line =~ /^[#:]/
    Severity: Minor
    Found in app/services/kp_index_service.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 aurora_viewable_at_geomagnetic_latitude? has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

      def aurora_viewable_at_geomagnetic_latitude?(geomagnetic_latitude)
        if @kp_value <= 0.9999
          geomagnetic_latitude >= 66.5
        elsif @kp_value <= 1.9999
          geomagnetic_latitude >= 64.5
    Severity: Minor
    Found in app/models/kp_value.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 new_user has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def new_user
        respond_to do |format|
          if user_exists?(params[:user][:mobile_phone])
            @message = "You have already signed up. To confirm your signup, or change your zipcode, text AURORA followed by your zipcode (AURORA 90210) to 839863."
            format.html { render :index }
    Severity: Minor
    Found in app/controllers/site_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_message has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def send_message
        @mobile_phone = params[:mobile_phone]
        @message = params[:message]
        @send_real_sms_messages = (params[:send_real_sms_messages] == "1")
    
    
    Severity: Minor
    Found in app/controllers/test_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 update_kp_index has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def update_kp_index
        remove_old_data
        KpIndexService.current_forecast.reverse.each do |time, kp_index|
          if time.year != -1 # Kp index service will sometimes contain invalid data
            if KpForecast.exists?(forecast_time: time)
    Severity: Minor
    Found in app/services/kp_index_updater.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 handle has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def handle
        if @user && @user.aurora_alert && valid_response?
          if acknowledge_alert?
            update_alert(confirmed_at: Time.now.utc, send_reminder_at: nil)
            send_message(OutgoingSmsMessages.acknowledge_alert)
    Severity: Minor
    Found in app/incoming_sms_handlers/alarmed_user_handler.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 lookup_location_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def lookup_location_data(location_value)
        @location = nil
        if ZipcodeFormat.valid?(location_value)
          service = GeolocationService.new
          @location = service.geocode(location_value)
    Severity: Minor
    Found in app/services/user_factory.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 handle has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def handle
        if @user
          if signup_confirmation?
            handle_signup_confirmation
            return true
    Severity: Minor
    Found in app/incoming_sms_handlers/known_user_handler.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