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

Revise Ortac/Dune to minimize yet again boilerplate #218

Merged
merged 9 commits into from
Jul 1, 2024

Conversation

n-osborne
Copy link
Collaborator

@n-osborne n-osborne commented Apr 10, 2024

This PR proposes to:

  1. add an optional argument for the library name. Default is the base name of the module under tested.
  2. make the configuration and the generated tests filename arguments optional. Default is the base name of the module under test prefixed with [_config _tests].ml

In the best case scenario, this allows to just write:

(rule
 (alias runtest)
 (mode promote)
 (targets dune.inc)
 (action
  (with-stdout-to
   %{targets}
   (run ortac dune qcheck-stm lib.mli))))

(include dune.inc)

@n-osborne
Copy link
Collaborator Author

n-osborne commented Apr 10, 2024

This PR is based on #214, please consider only the last 5 commits.
Edit: 6 last commits

Copy link
Contributor

@shym shym left a comment

Choose a reason for hiding this comment

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

This is really nice simplification, thank you! Now I wonder if those default names should not be adopted directly in Ortac/QCheck-STM.

  • 8198b4a Remove generation of dune rule generation
    I find the phrasing of the commit message unclear, isn’t a negation missing?
    Suggestion: “as we want...” → “Future commits will simplify calling out directly the dune qcheck-stm” from the command line.” (even if I’m not a big fan a talking about future commits in messages, here that might be the needed context)
  • 9990674 Make config and test name optional
    Change the commit title to names, to make it clearer the config is not optional, just its name?
    I wondered whether it would be worth having tests for the case the options are actually working when explicitly set, for instance by using them in the examples to preserve the file names used before the PR?

plugins/dune-rules/src/dune_rules.ml Outdated Show resolved Hide resolved
plugins/dune-rules/test/test.t Outdated Show resolved Hide resolved
plugins/dune-rules/src/dune_rules.ml Outdated Show resolved Hide resolved
plugins/dune-rules/src/dune_rules.ml Outdated Show resolved Hide resolved
examples/dune Outdated Show resolved Hide resolved
plugins/dune-rules/README.md Outdated Show resolved Hide resolved
plugins/dune-rules/README.md Outdated Show resolved Hide resolved
@n-osborne n-osborne force-pushed the revise-dune-plugin branch 2 times, most recently from 4665003 to 5a54e3e Compare June 26, 2024 15:57
Copy link
Contributor

@shym shym left a comment

Choose a reason for hiding this comment

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

A small comment now that I see how ~absent is rendered.

This stanza assumes that you have written the configuration for
[Ortac/QCheck-STM] in a file named `lib_config.ml` and that the `Lib` module is
part of the `lib` library. It will write the generated tests in `lib_tests.ml`.
If you want more control, you can use the `--config` `--library` and `--output`
Copy link
Contributor

@shym shym Jun 26, 2024

Choose a reason for hiding this comment

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

Suggested change
If you want more control, you can use the `--config` `--library` and `--output`
If you want more control, you can use the `--config`, `--library` and `--output`

This comma sliped in the revision, I think :-)

Comment on lines 29 to 30
"Concatenation of INTERFACE without the extension and \
\"_config.ml\"."
Copy link
Contributor

Choose a reason for hiding this comment

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

Given how the ~absent field is rendered, I think I would prefer no initial capital and no ending period.

Suggested change
"Concatenation of INTERFACE without the extension and \
\"_config.ml\"."
"concatenation of INTERFACE without the extension and \
\"_config.ml\""

The generated dune rules no longer generate the rule to generate
themselves. Future commits will simplify calling out directly the dune
qcheck-stm.
When the argument is missing, Ortac/Dune will assume that the library
has the same name as the module.
The normalisation concerns only the dune and the qcheck-stm plugins for
now.
@n-osborne n-osborne merged commit 3a23cc0 into ocaml-gospel:main Jul 1, 2024
3 checks passed
@n-osborne n-osborne deleted the revise-dune-plugin branch July 1, 2024 12:59
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

2 participants