wazeHQ / yaml-validator

Validates locale yml files
MIT License
6 stars 3 forks source link

Crash for projects with locale subfolders without a .yml file #3

Open oliverklee opened 10 years ago

oliverklee commented 10 years ago

https://github.com/braingourmets/gethdo/releases/tag/test%2Fyaml-lint

In this project, we have nested subfolders for the locales. Particularly, we currently have EN and DE locale files directly in the config/locales/ folder, and then some files in config/locales/views/home/index. Running yaml-validator on this causes a crash:

klee@gonzales:~/eclipse/gethdo$ yaml-validator validate config/locales/ Validating config/locales/...

/home/klee/.rvm/gems/ruby-2.0.0-p247/gems/yaml-validator-0.1.9/lib/yaml-validator.rb:223:in get_all_variables': undefined methodeach' for "":String (NoMethodError) from /home/klee/.rvm/gems/ruby-2.0.0-p247/gems/yaml-validator-0.1.9/lib/yaml-validator.rb:29:in en_with_vars' from /home/klee/.rvm/gems/ruby-2.0.0-p247/gems/yaml-validator-0.1.9/lib/yaml-validator.rb:33:invalidate' from /home/klee/.rvm/gems/ruby-2.0.0-p247/gems/yaml-validator-0.1.9/bin/yaml-validator:15:in validate' from /home/klee/.rvm/gems/ruby-2.0.0-p247@global/gems/thor-0.18.1/lib/thor/command.rb:27:inrun' from /home/klee/.rvm/gems/ruby-2.0.0-p247@global/gems/thor-0.18.1/lib/thor/invocation.rb:120:in invoke_command' from /home/klee/.rvm/gems/ruby-2.0.0-p247@global/gems/thor-0.18.1/lib/thor.rb:363:indispatch' from /home/klee/.rvm/gems/ruby-2.0.0-p247@global/gems/thor-0.18.1/lib/thor/base.rb:439:in start' from /home/klee/.rvm/gems/ruby-2.0.0-p247/gems/yaml-validator-0.1.9/bin/yaml-validator:34:in<top (required)>' from /home/klee/.rvm/gems/ruby-2.0.0-p247/bin/yaml-validator:23:in load' from /home/klee/.rvm/gems/ruby-2.0.0-p247/bin/yaml-validator:23:in

' from /home/klee/.rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks:15:in eval' from /home/klee/.rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks:15:in
'

elentok commented 10 years ago

I think it's happening because the en.yml file is empty (it just has the header), so the root yaml_object is a string and not an object.