Commit 704dd1d4 authored by Vitali Tatarintev's avatar Vitali Tatarintev Committed by Douglas Barbosa Alexandre

Fix Rubocop complains

Fixes:

1. You specified required: true, in Rails > 5.0 the required option
   is deprecated and you want to use optional: false.
   In most configurations, this is the default
   and you can omit this option altogether

2. Enum defined as an array found in operator enum declaration.
   Use hash syntax instead.
parent 462b5e20
...@@ -9,9 +9,9 @@ class PrometheusAlert < ApplicationRecord ...@@ -9,9 +9,9 @@ class PrometheusAlert < ApplicationRecord
gt: ">" gt: ">"
}.freeze }.freeze
belongs_to :environment, required: true, validate: true, inverse_of: :prometheus_alerts belongs_to :environment, optional: false, validate: true, inverse_of: :prometheus_alerts
belongs_to :project, required: true, validate: true, inverse_of: :prometheus_alerts belongs_to :project, optional: false, validate: true, inverse_of: :prometheus_alerts
belongs_to :prometheus_metric, required: true, validate: true, inverse_of: :prometheus_alerts belongs_to :prometheus_metric, optional: false, validate: true, inverse_of: :prometheus_alerts
has_many :prometheus_alert_events, inverse_of: :prometheus_alert has_many :prometheus_alert_events, inverse_of: :prometheus_alert
has_many :related_issues, through: :prometheus_alert_events has_many :related_issues, through: :prometheus_alert_events
...@@ -22,7 +22,7 @@ class PrometheusAlert < ApplicationRecord ...@@ -22,7 +22,7 @@ class PrometheusAlert < ApplicationRecord
validate :require_valid_environment_project! validate :require_valid_environment_project!
validate :require_valid_metric_project! validate :require_valid_metric_project!
enum operator: [:lt, :eq, :gt] enum operator: { lt: 0, eq: 1, gt: 2 }
delegate :title, :query, to: :prometheus_metric delegate :title, :query, to: :prometheus_metric
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment