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

Added facility to transform into JSON #165

Closed
wants to merge 178 commits into from
Closed

Conversation

JeniT
Copy link

@JeniT JeniT commented Oct 24, 2015

Ideally this should be in a separate gem, but this branch does include changes to the core csvlint.rb code that enable transformation to be carried out without validation. So hoping we can merge for now and then take out the pieces that need to be taken out later.

Jeni Tennison and others added 30 commits September 2, 2015 21:54
& associated support for steps they require
…inputs to be tested while preserving the prior logic
…reaming class, to create a 'client' class that could invoke the Streaming Validator being constructed. Specs have also been copied from validator spec verbatim

Major refactoring has been done within initialise method, with reordering of certain method calls, creation of an instance variable to store 2 other variables which are related to the CSV objects state and a refactoring of the parse CSV method to fit in line with the implementation of a validator stream that is intended to consume string input.
The remaining LOC in the parse_csv method attempt to match the Streaming Validator as closely as possible
Currently errors are thrown by StringIO objects which four specs opt to use instead of String or File input
…validator specs shows that they both fail with the same error - it is a consequence of how StringIO works alongside CSV library
…w from the original validator spec that tested functions in a unit testing fashion
…ciently separated - all three of the other 'context headers' functions can pass without invoking the validate method,
…amer class to effect that specs using validator.valid? as an assertion will pass erroneously henceforth
…refactoring the validator class from a Client/Observer POV
…t capturing the row data of imported CSVs - this is the next significant refactor
… to the normal behaviour - the ensure is never invoked - perhaps this is because the rescue occurs within an enumerable
…ating all the methods in validate and thus warping where the exception was raised
…hing placed correctly however the loop still terminates incorrectly
…branch and return to an earlier less convoluted version now that I understand how better to specify the problem
…to feature-streaming-validation

# Conflicts:
#	lib/csvlint/streaming_validate.rb
… as a method it encapsulates the problems with doing enumerations of CSV content when rescuing the exceptions in such a way that they persist in the Error Builder object
I have rewritten the specs so that the modularity of methods within the streaming_validate class can be explored in cleaner way - adopting a convention of stream for a variable that is neither StringIO or File or CSV instance and data for a variable that matches any of the aforementioned classes
…tant as precedents for unit testing the classes methods without having to invoke an entire validation and because they expect arrays as arguments - this has consequences for what type of object can be passed to the streaming validate class
…rage, however this is earmarked as something to change
…r than string

However now multiple tests which should return errors are returning valid - I believe this is because of not catching CSVmalformed Exceptions
@pezholio
Copy link
Contributor

pezholio commented Nov 2, 2015

Can you rebase this PR against master please @JeniT? There's a lot of commits in this that I squashed before merging into master. Or have https://github.com/theodi/csv2json and https://github.com/theodi/csv2rdf superseded this?

@JeniT JeniT closed this Dec 22, 2015
@JeniT JeniT removed the in progress label Dec 22, 2015
@Floppy Floppy deleted the feature-csvw-transformation branch October 5, 2017 11:56
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.

None yet

3 participants