csvlint.rb
csvlint.rb copied to clipboard
Spurious invalid header error
In column.rb you have
def validate_header(header, strict)
reset
if strict || @titles
valid_headers = @titles ? @titles.map{ |l,v| v if Column.languages_match(l, lang) }.flatten : []
unless valid_headers.include? header
if strict
build_errors(:invalid_header, :schema, 1, @number, header, @titles)
Now, if @titles is not passed into the Columns class (and as far as I can tell, it is not), then valid_headers will be empty. In that case, all headers will fail the validation test.
What you actually want is
unless valid_headers.empty? or valid_headers.include? header
See See https://github.com/nsip/csvlint.rb for patch