Conversation
|
Hi Julow! Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file.In order for us to review and merge your code, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
|
Re |
|
In case of an error, you could not see which file caused it. |
gpetiot
left a comment
There was a problem hiding this comment.
Looks good, this is a nice improvement for the validate function to distinguish the input and the action (a bit verbose but we shouldn't forget any case).
Maybe it's a good step towards splitting this file into Conf/Cli in case we want to have a pure library without the cli in the future.
Structure the code in a way that "impossible" cases are not needed and subtle side effects are removed. It's now an error to pass --name, --impl or --intf with more than 1 input file. It's also an error to pass --print-config with an other "action" (eg. --output, --check).
This PR refactors the code in
Conf.mlthat interprets CLI options telling OCamlformat what to do.This code was very hard to maintain and could contain bugs. Now the code is structured in a way that "impossible" cases are not needed and subtle side effects are removed.
The diffs on the CLI tests are:
It's now an error to pass
--name,--implor--intfwith more than 1 input file.It's also an error to pass
--print-configwith an other "action" (eg.--output,--check), is it a good idea ?To go further, this code should be moved to an other module and the
actiontype could be changed a little to remove an other "impossible" case inocamlformat.ml.