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

Improve PineAPPL's CLI #95

Merged
merged 43 commits into from
Jan 1, 2022
Merged

Improve PineAPPL's CLI #95

merged 43 commits into from
Jan 1, 2022

Conversation

cschwan
Copy link
Contributor

@cschwan cschwan commented Dec 6, 2021

This branch is supposed to rework the CLI to

  • use clap's derive feature that makes it much easier to write an easy-to-understand subcommand and
  • to make sure no regressions are introduced by testing each of the subcommands;
    • channels
    • convolute
    • diff
    • info
    • luminosity
    • merge
    • optimize
    • orders
    • pdf_uncertainty
    • plot
    • pull
    • remap
    • set
    • subgrids
    • sum
    • upgrade

@cschwan cschwan added the enhancement New feature or request label Dec 6, 2021
@cschwan cschwan self-assigned this Dec 6, 2021
@alecandido
Copy link
Member

Are you really sure you want to test the full hardcoded docstring? If at some point you'll want to update clap version and they even change something minor (say spacing) it will break all the tests...

@cschwan
Copy link
Contributor Author

cschwan commented Dec 6, 2021

The --help tests are just a basic implementation of the more general idea to test coverage of all subcommands. Note that the version of clap is pinned.

@alecandido
Copy link
Member

I agree that clap won't update on its own (and that's a good thing), nevertheless at some point you might want to do it manually (and this was the meaning of the original observation).

I agree that coverage is a good thing, but nor 100% is granting to be bug free, neither any other reason exists to make 100% strictly required: for as long as you know what you are testing, and more important what not, that's perfectly fine (but this of course is only my personal point of view).

@cschwan
Copy link
Contributor Author

cschwan commented Dec 7, 2021

My point is more that we don't have any tests for the CLI, which is potentially dangerous. While writing tests I already discovered a problem that is also present in master (fixed in commit 10c659e). I agree that the --help tests are unnecessarily fragile, but once we have proper tests we can probably remove them.

PineAPPL's CLI must be built before running its tests
@cschwan cschwan changed the title Improve pineappl CLI Improve PineAPPL's CLI Dec 7, 2021
@codecov
Copy link

codecov bot commented Dec 29, 2021

Codecov Report

Merging #95 (8fa4fb1) into master (38cb9f8) will decrease coverage by 0.09%.
The diff coverage is 88.47%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #95      +/-   ##
==========================================
- Coverage   86.00%   85.91%   -0.10%     
==========================================
  Files          14       31      +17     
  Lines        2080     3025     +945     
==========================================
+ Hits         1789     2599     +810     
- Misses        291      426     +135     
Impacted Files Coverage Δ
pineappl_cli/src/plot.rs 92.10% <ø> (ø)
pineappl_cli/src/merge.rs 53.33% <53.33%> (ø)
pineappl_cli/src/remap.rs 68.83% <68.83%> (ø)
pineappl_cli/src/diff.rs 69.53% <73.33%> (ø)
pineappl_cli/src/subgrids.rs 77.27% <77.27%> (ø)
pineappl_cli/src/helpers.rs 91.01% <85.71%> (ø)
pineappl_cli/src/sum.rs 94.11% <94.11%> (ø)
pineappl_cli/src/info.rs 96.96% <96.96%> (ø)
pineappl_cli/src/pull.rs 97.59% <97.59%> (ø)
pineappl_cli/src/pdfunc.rs 97.82% <97.82%> (ø)
... and 19 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 38cb9f8...8fa4fb1. Read the comment docs.

@cschwan cschwan added this to the v0.5.0 milestone Jan 1, 2022
@cschwan cschwan merged commit 8b8224c into master Jan 1, 2022
@cschwan cschwan deleted the clap-derive branch January 1, 2022 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants