Class: EagerEye::Configuration
- Inherits:
-
Object
- Object
- EagerEye::Configuration
- Defined in:
- lib/eager_eye/configuration.rb
Constant Summary collapse
- DEFAULT_DETECTORS =
%i[ loop_association serializer_nesting missing_counter_cache custom_method_query count_in_iteration callback_query pluck_to_array delegation_n_plus_one decorator_n_plus_one scope_chain_n_plus_one validation_n_plus_one ].freeze
- DEFAULT_SEVERITY_LEVELS =
{ loop_association: :error, serializer_nesting: :warning, missing_counter_cache: :info, custom_method_query: :warning, count_in_iteration: :warning, callback_query: :warning, pluck_to_array: :warning, delegation_n_plus_one: :warning, decorator_n_plus_one: :warning, scope_chain_n_plus_one: :warning, validation_n_plus_one: :warning }.freeze
- VALID_SEVERITIES =
%i[info warning error].freeze
Instance Attribute Summary collapse
-
#app_path ⇒ Object
Returns the value of attribute app_path.
-
#enabled_detectors ⇒ Object
Returns the value of attribute enabled_detectors.
-
#excluded_paths ⇒ Object
Returns the value of attribute excluded_paths.
-
#fail_on_issues ⇒ Object
Returns the value of attribute fail_on_issues.
-
#min_severity ⇒ Object
Returns the value of attribute min_severity.
-
#severity_levels ⇒ Object
Returns the value of attribute severity_levels.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #severity_for(detector_name) ⇒ Object
- #valid_severity?(severity) ⇒ Boolean
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
31 32 33 34 35 36 37 38 |
# File 'lib/eager_eye/configuration.rb', line 31 def initialize @excluded_paths = [] @enabled_detectors = DEFAULT_DETECTORS.dup @app_path = "app" @fail_on_issues = true @severity_levels = DEFAULT_SEVERITY_LEVELS.dup @min_severity = :info end |
Instance Attribute Details
#app_path ⇒ Object
Returns the value of attribute app_path.
5 6 7 |
# File 'lib/eager_eye/configuration.rb', line 5 def app_path @app_path end |
#enabled_detectors ⇒ Object
Returns the value of attribute enabled_detectors.
5 6 7 |
# File 'lib/eager_eye/configuration.rb', line 5 def enabled_detectors @enabled_detectors end |
#excluded_paths ⇒ Object
Returns the value of attribute excluded_paths.
5 6 7 |
# File 'lib/eager_eye/configuration.rb', line 5 def excluded_paths @excluded_paths end |
#fail_on_issues ⇒ Object
Returns the value of attribute fail_on_issues.
5 6 7 |
# File 'lib/eager_eye/configuration.rb', line 5 def fail_on_issues @fail_on_issues end |
#min_severity ⇒ Object
Returns the value of attribute min_severity.
5 6 7 |
# File 'lib/eager_eye/configuration.rb', line 5 def min_severity @min_severity end |
#severity_levels ⇒ Object
Returns the value of attribute severity_levels.
5 6 7 |
# File 'lib/eager_eye/configuration.rb', line 5 def severity_levels @severity_levels end |
Instance Method Details
#severity_for(detector_name) ⇒ Object
40 41 42 |
# File 'lib/eager_eye/configuration.rb', line 40 def severity_for(detector_name) severity_levels.fetch(detector_name.to_sym, :warning) end |
#valid_severity?(severity) ⇒ Boolean
44 45 46 |
# File 'lib/eager_eye/configuration.rb', line 44 def valid_severity?(severity) VALID_SEVERITIES.include?(severity.to_sym) end |