Class: RuboCop::Cop::Dutchie::LaunchDarklyDefaults
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Dutchie::LaunchDarklyDefaults
- Extended by:
- AutoCorrector
- Defined in:
- lib/rubocop/cop/dutchie/launchdarkly_defaults.rb
Overview
Ensures all LaunchDarkly feature flag calls have default values to prevent failures during LaunchDarkly service outages
This cop supports two LaunchDarkly patterns:
- Armageddon pattern: DutchieFeatureFlags.flag(), .context_flag(), etc.
- MenuConnector pattern: ld_client.variation(), MenuConnector::App.variation()
Constant Summary collapse
- MSG_FLAG =
'DutchieFeatureFlags.flag must have a default value as 2nd parameter'- MSG_CONTEXT_FLAG =
'DutchieFeatureFlags.context_flag must have a default: parameter'- MSG_DISPENSARY_FLAG =
'DutchieFeatureFlags.dispensary_flag must have a default: parameter'- MSG_ENTERPRISE_FLAG =
'DutchieFeatureFlags.enterprise_flag must have a default: parameter'- MSG_ON =
'DutchieFeatureFlags.on? should have a default: parameter'- MSG_OFF =
'DutchieFeatureFlags.off? should have a default: parameter'- MSG_VARIATION =
'LaunchDarkly variation must have a default value as 3rd parameter'
Instance Method Summary collapse
Instance Method Details
#on_send(node) ⇒ Object
128 129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/rubocop/cop/dutchie/launchdarkly_defaults.rb', line 128 def on_send(node) # Check Armageddon patterns check_flag_method(node) check_context_flag_method(node) check_dispensary_flag_method(node) check_enterprise_flag_method(node) check_on_method(node) check_off_method(node) # Check MenuConnector patterns check_variation_method(node) check_mock_variation_method(node) end |