Skip to content

Instantly share code, notes, and snippets.

@quadrophobiac
Created September 11, 2015 19:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save quadrophobiac/b2578166831b3c2bebec to your computer and use it in GitHub Desktop.
Save quadrophobiac/b2578166831b3c2bebec to your computer and use it in GitHub Desktop.
strange conditional logic in CSVLint
if type == :stray_quote && !wrapper.line.match(csv.row_sep)
# above evaluates to true && false
# however it is false only by placing bang against wrapper.line.match(csv.row_sep) which evals to either
# nil or MatchData - seems a strange way to order flow
# basically it want's whatever is matched against the row_sep (generated from the CSV.new of data inputted) to not match
# because if it matches then bang generates a false and only a stray_quote is logged
build_errors(:line_breaks, :structure)
# the tests that exist pass \r rather than \r\n when testing for line breaks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment