Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raise error for duplicate headers in hash mode (fixes #44) #45

Merged
merged 3 commits into from
Dec 1, 2022
Merged

Conversation

martijn
Copy link
Owner

@martijn martijn commented Oct 16, 2022

As discussed in #44 the current behaviour for hash mode has the potential leads to confusion.

This change makes Xsv raise an error when trying to enter hash mode on a sheet with duplicate non-nil header values. I left nil out of scope because it's common for Excel sheets to have empty columns for spacing or trailing on the end of the sheet.

I'm not sure if we really want this behaviour, and I'm planning on bumping the minor version to signal the potential breakage this can cause. @shkm @voxik looking forward to your comments on this one.

@codecov-commenter
Copy link

codecov-commenter commented Oct 16, 2022

Codecov Report

Merging #45 (c8859f7) into main (420dadb) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main      #45   +/-   ##
=======================================
  Coverage   99.71%   99.71%           
=======================================
  Files          21       21           
  Lines         692      707   +15     
=======================================
+ Hits          690      705   +15     
  Misses          2        2           
Impacted Files Coverage Δ
lib/xsv.rb 100.00% <100.00%> (ø)
lib/xsv/sheet.rb 100.00% <100.00%> (ø)
test/sheet_test.rb 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@voxik
Copy link

voxik commented Oct 16, 2022

Although it does not address the #44, I like this 👍 I think it is better to fail then possibly deliver corrupted data.

lib/xsv/sheet.rb Show resolved Hide resolved
@shkm
Copy link
Collaborator

shkm commented Oct 17, 2022

+1 but I think it's worth making that change so we don't have to look up zip again ;-).

@martijn
Copy link
Owner Author

martijn commented Oct 17, 2022

+1 but I think it's worth making that change so we don't have to look up zip again ;-).

Ohh yeah that is much better, thanks!

@martijn martijn merged commit ebcbcf0 into main Dec 1, 2022
@shkm shkm deleted the fix-44 branch December 1, 2022 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants