Class: Yard::Lint::ConfigValidator
- Inherits:
-
Object
- Object
- Yard::Lint::ConfigValidator
- Defined in:
- lib/yard/lint/config_validator.rb
Overview
Validates configuration structure and values to catch typos and invalid settings
Constant Summary collapse
- VALID_CATEGORIES =
Valid category names (from ConfigUpdater::CATEGORY_ORDER)
%w[Documentation Tags Warnings Semantic].freeze
- SPECIAL_KEYS =
Keys that are valid at the root level but are not validators
%w[ AllValidators inherit_from inherit_gem ].freeze
- BOOLEAN_VALUES =
Valid boolean values
[true, false].freeze
Class Method Summary collapse
-
.validate!(raw_config) ⇒ void
Validate configuration and raise error if invalid.
Instance Method Summary collapse
-
#initialize(raw_config) ⇒ ConfigValidator
constructor
A new instance of ConfigValidator.
-
#validate! ⇒ void
Perform validation.
Constructor Details
#initialize(raw_config) ⇒ ConfigValidator
Returns a new instance of ConfigValidator.
23 24 25 26 |
# File 'lib/yard/lint/config_validator.rb', line 23 def initialize(raw_config) @raw_config = raw_config @errors = [] end |
Class Method Details
.validate!(raw_config) ⇒ void
This method returns an undefined value.
Validate configuration and raise error if invalid
32 33 34 35 |
# File 'lib/yard/lint/config_validator.rb', line 32 def self.validate!(raw_config) validator = new(raw_config) validator.validate! end |
Instance Method Details
#validate! ⇒ void
This method returns an undefined value.
Perform validation
40 41 42 43 44 45 46 47 48 |
# File 'lib/yard/lint/config_validator.rb', line 40 def validate! validate_root_keys! validate_global_settings! validate_validators! return if @errors.empty? raise Errors::InvalidConfigError, end |