-
Notifications
You must be signed in to change notification settings - Fork 82
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
[MISC] argument parser: Move get_help_message to file_validator_base. #1691
Conversation
a989652
to
3cff7d3
Compare
@marehr polite ping |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if omitting text is better for the user. I liked the output before, what are the benefits for the user?
I'm okay with putting a common function in the base to concat the extensions as a function and use it in the get_help_message.
You are right, I didn't notice that there is no mention of the option being an input or output file. I thought there was some more, also regarding the writability stuff. The benefit is, that it poses less of a chance for inconsistencies. I worked on fixing seqan/sharg-parser#77 and adding the compression formats to the help page to each of the two (almost identical...) help page messages called for a DRY version to me.
I'll change it accordingly, and also take a look at the writability |
3cff7d3
to
a2a68e7
Compare
Codecov Report
@@ Coverage Diff @@
## master seqan/seqan3#1691 +/- ##
==========================================
+ Coverage 97.65% 97.68% +0.02%
==========================================
Files 237 237
Lines 9050 9059 +9
==========================================
+ Hits 8838 8849 +11
+ Misses 212 210 -2
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great :)
Can you assign someone with proper english skills to double check the phrases? 🙈
😄 any suggestion? Usually, I would ask @eseiler... |
return detail::to_string("Valid input file formats: [", | ||
extensions | views::join(std::string{", "}), | ||
"]"); | ||
return "The input file must exist and read permissions must be granted. " + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure. Is that really necessary with the permissions? That kind of clutters the output. It is clear that you need to have permissions. If not you will get an exception saying that you don't have permissions.
I think if the description reads: An input file with a valid extension: [ext1, ext2, ...]
The other thing is An output file with a valid extension: [ext1, ext2, ...]
Then the code is
return valid_extensions_help_page_message("input file");
And the help page message assembles the string.
Then also it checks if valid extensions is empty and omits the part with the valid extensions. Also note, that we should talk about extensions and not formats.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure. Is that really necessary with the permissions? That kind of clutters the output. It is clear that you need to have permissions.
Well, although "it is obvious that you need them", it is a feature we provide to check for this and I thought this documentation helps to indicate this?
And whatever we decide about the permissions, I think it is important to note that the output file must not exist. This is not the usual behaviour by default as @joergi-w mentioned in his recent issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And whatever we decide about the permissions, I think it is important to note that the output file must not exist. This is not the usual behaviour by default as @joergi-w mentioned in his recent issue.
Mhmm, I think it is not necessary but I have no strong feelings. But the other points should be adresed. valid formats
➡️ valid extension
and if the extension set is empty this string should not be displayed at all.
1ffebe1
to
ddeebfc
Compare
I just rebased because there were merge conflicts |
if (extensions.empty()) | ||
return ""; | ||
else | ||
return detail::to_string("Valid file extensions are: [", extensions | views::join(std::string{", "}), "]."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return detail::to_string("Valid file extensions are: [", extensions | views::join(std::string{", "}), "]."); | |
return detail::to_string("Valid file extensions are: [", extensions | std::views::join(std::string{", "}), "]."); |
And check that there is no seqan3 views join include.
Regarding detail::to_string
. Isn't this part of the dependencies @marehr tried to remove from the argument parser? This could be written as str1 + str2 + str3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The detail::to_string
is still present in many parts of the code. He sais this one is an open ToDo and he might reimplement the function so using it here won't make a difference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is tough, because the seqan3::views::join
isn't the same as the std::view::join
.
I had to warkaround it, but it is okay for me to use seqan3::views::join
here. Also keep the detail::to_string
.
In this case it is fine as it is.
"Valid file extensions are: [fa, fasta, sam, bam]."); | ||
|
||
seqan3::input_file_validator validator2{}; | ||
EXPECT_EQ(validator2.get_help_page_message(), "The input file must exist and read permissions must be granted. "); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EXPECT_EQ(validator2.get_help_page_message(), "The input file must exist and read permissions must be granted. "); | |
EXPECT_EQ(validator2.get_help_page_message(), "The input file must exist and read permissions must be granted."); |
?
"Valid file formats are: [fa, fasta, sam, bam]."); | ||
seqan3::output_file_validator validator2{}; | ||
EXPECT_EQ(validator2.get_help_page_message(), "The output file must not exist already and write permissions must " | ||
"be granted. "); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"be granted. "); | |
"be granted."); |
?
@rrahn I still have no rights to restart jobs on Jenkins. The error is unrelated. Maybe you can restart Jenkins. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm. I'll check jenkins for the rights.
…seqan#1691) * [MISC] argument parser: Refine get_help_page_message for in/output file validators.
Just DRY out some code