Class: Textus::Doctor::Check::IllegalKeys
- Inherits:
-
Textus::Doctor::Check
- Object
- Textus::Doctor::Check
- Textus::Doctor::Check::IllegalKeys
- Defined in:
- lib/textus/doctor/check/illegal_keys.rb
Instance Method Summary collapse
Methods inherited from Textus::Doctor::Check
Constructor Details
This class inherits a constructor from Textus::Doctor::Check
Instance Method Details
#call ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/textus/doctor/check/illegal_keys.rb', line 5 def call out = [] store.manifest.entries.each do |entry| next unless entry.nested base = File.join(store.root, "zones", entry.path) next unless File.directory?(base) walk_nested(base) do |abs_path, is_dir| basename = File.basename(abs_path) stem = is_dir ? basename : basename.sub(/#{Regexp.escape(File.extname(basename))}\z/, "") next if stem.match?(Key::Grammar::SEGMENT) proposed = Textus::MigrateKeys.normalize(stem) out << { "code" => "key.illegal", "level" => "error", "subject" => abs_path, "path" => abs_path, "proposed_key" => proposed, "message" => "illegal key segment '#{stem}' at #{abs_path}", "fix" => "run 'textus key migrate --dry-run' then '--write' to rename to '#{proposed}'", } end end out end |