Skip to content

Fix #7722 Improved header validation on CSV import#7950

Merged
Bargs merged 1 commit intoelastic:masterfrom
ck-lee:better-csv-import-errors-messages
Aug 17, 2016
Merged

Fix #7722 Improved header validation on CSV import#7950
Bargs merged 1 commit intoelastic:masterfrom
ck-lee:better-csv-import-errors-messages

Conversation

@ck-lee
Copy link
Copy Markdown
Contributor

@ck-lee ck-lee commented Aug 6, 2016

@elasticmachine
Copy link
Copy Markdown
Contributor

Can one of the admins verify this patch?

@ck-lee
Copy link
Copy Markdown
Contributor Author

ck-lee commented Aug 6, 2016

Screenshot for reference...
image

@Bargs Bargs self-assigned this Aug 8, 2016
@Bargs
Copy link
Copy Markdown
Contributor

Bargs commented Aug 8, 2016

@ck-lee Thanks for the contribution! I'll try to review this as soon as I can

@Bargs Bargs added the review label Aug 8, 2016
Copy link
Copy Markdown
Contributor

@Bargs Bargs Aug 12, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use const here, and if you need mutability prefer let over var. This applies to the whole file, but I'll just leave this one note here

@Bargs
Copy link
Copy Markdown
Contributor

Bargs commented Aug 12, 2016

@ck-lee this looks great! I really appreciate the thorough tests you included. I added some comments, but it's all pretty minor stuff

@ck-lee
Copy link
Copy Markdown
Contributor Author

ck-lee commented Aug 13, 2016

@Bargs: Thanks again. Please review.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need for a newline here

@Bargs
Copy link
Copy Markdown
Contributor

Bargs commented Aug 16, 2016

@thomasneirynck could you do a second review?

@thomasneirynck
Copy link
Copy Markdown
Contributor

@Bargs will do!

@ck-lee ck-lee force-pushed the better-csv-import-errors-messages branch 2 times, most recently from 18a9188 to 78e23e0 Compare August 16, 2016 19:37
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd remove this guard clause. This isn't really public API for 3rd party clients, where throwing runtime errors can be helpful.

Some clean JSDoc on the function signature would tell the story just as well IMO, and it'd be less code.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I disagree with that, I still think it's a good idea to enforce your preconditions. Especially when using lodash where many of the functions can operate on both objects and arrays, not checking your arguments could lead to hard to find bugs that don't throw errors.

That said, it's not in our styleguide and it's a minor issue here, so it's not worth holding up this PR.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. This is a minor one. And I think it is worth considering in the future if the validateHeaders module grows more than a couple validation checks.

@thomasneirynck
Copy link
Copy Markdown
Contributor

great! minor suggestions to reduce code footprint, but LGTM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants