-
Notifications
You must be signed in to change notification settings - Fork 29
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
fix: add ordering check to param meta matching #354
fix: add ordering check to param meta matching #354
Conversation
I get a warning across 19 files at the first line saying the same thing i.e.
I also get one more error warning two files that I haven't even touched so I am assuming they existed before my PR. It's a "missing documentation for a function" warning in Besides that, there are some changes to arena.toml after running the test and I went through a couple of them to find that the ordering of parameters was indeed not consistent. Finally, while working on this PR I looked at some other lint rules and such to understand the codebase better and I think there is a certain inconsistency in the This is my first PR here so I am looking forward to learning how you guys do things around here and I was wondering if there is a separate communication channel where we can connect better. |
I believe that all these errors would be resolved by rebasing onto
Yes, the |
Hi @Nitish-bot. I merged in a very large refactoring just a few minutes ago that is causing a conflict with your PR. The |
…aram_meta_ordering
Co-authored-by: Andrew Frantz <[email protected]>
Hey @a-frantz @peterhuene, I think I have addressed all concerns here and the PR is ready to be merged. |
wdl-lint/CHANGELOG.md
Outdated
@@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), | |||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | |||
|
|||
## Unreleased | |||
### Fixed | |||
|
|||
* Fixed the `MatchingParameterMeta` rule to also check if the order of inputs matches parameter metadata ([#354](https://github.com/stjude-rust-labs/wdl/pull/354)) |
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.
Please move this to the existing ### Fixed
header under ## Unreleased
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.
You mean the previous ### Fixed
pertaining to MatchingParameteMeta
?
edit: nvm I got it now
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.
@@ -1,5 +1,6 @@ | |||
## This is a test for checking for missing and extraneous entries | |||
## in a `parameter_meta` section for a struct. | |||
## in a `parameter_meta` section, and for ensuring that | |||
## the order is the same as `input` section. |
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.
Can you add a new struct
definition with an out of order parameter_meta to this test?
output {} | ||
} | ||
|
||
workflow test { |
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.
Can you add a task test case?
.with_fix(format!( | ||
"order the parameter metadata as:\n{}", | ||
expected_order | ||
)) |
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 don't love this, but I'm not sure what a straightforward improvement would be.
My issue is that the "fix" here can't be copy and pasted, as it just outputs the order of the keys without their associated values. However, it would be difficult to properly format the values for output.
We've discussed vague plans of making wdl-lint
dependent on wdl-format
so that we can supply better fix
messages, and I think we should probably wait for that to come to fruition instead of writing some complicated logic for this.
So for now, I'm fine with this fix message but its not ideal.
@Nitish-bot two other test cases I would like to see in addition to what I just commented.
|
do you mean that it should only trigger an InputSorting diagnostic? because it would also trigger the MatchingParam Diagnostic along with it edit (19/03/25 11 PM +5:30 GMT): I have since updated it to my understanding please check it out |
@claymcleod the revisions have been made, it is indeed awaiting review |
Co-authored-by: Andrew Frantz <[email protected]>
Aside from the review, I moved the struct definition test into |
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 have the one concern about the interaction between InputSorting
and MatchingParameterMeta
, but otherwise this looks good to me 👍
note[MatchingParameterMeta]: parameter metadata in task `input_sorting_test_2` is out of order | ||
┌─ tests/lints/input-and-parameter-meta-sorting/source.wdl:39:5 | ||
│ | ||
39 │ parameter_meta { | ||
│ ^^^^^^^^^^^^^^ parameter metadata must be in the same order as inputs | ||
│ | ||
= fix: order the parameter metadata as: | ||
w | ||
p | ||
t | ||
q | ||
b | ||
|
||
note[InputSorting]: input not sorted | ||
┌─ tests/lints/input-and-parameter-meta-sorting/source.wdl:47:5 | ||
│ | ||
47 │ input { | ||
│ ^^^^^ input section must be sorted | ||
│ | ||
= fix: sort input statements as: | ||
File t | ||
File b | ||
Directory w | ||
Array[String]+ p | ||
Array[String]+ q |
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.
Making a new comment with the same concern I raised in an earlier review.
These diagnostics conflict with each other, and it could be confusing to users. How should we handle this case? @adthrasher
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.
Ideally, I think the MatchingParameterMeta
rule would output the "correct" order that InputSorting
uses. Or it would have a flag on the task/workflow that indicates the input
is not properly sorted and would update the diagnostic accordingly. That's not a straightforward change at this point, so we may have to live with it. To me, the confusion stems from parameter_meta
preceding input
in the source. If the InputSorting
diagnostic was first, then I think it's potentially less confusing for users.
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.
A simple approach would be to update the "fix" message to something like: "fix: Based on current the input
block, order the parameter metadata as:".
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.
A simple approach would be to update the "fix" message to something like: "fix: Based on current the
input
block, order the parameter metadata as:".
I think this seems a decent bandaid for the situation. With an updated fix
message, I'd be ok merging this if it's accompanied by a new issue with these details. We can come back and tinker at it later.
A potential fix is to rely on wdl-format
to get the right order. However wdl-format
currently doesn't do this sort, so that would need to be implemented first.
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 made a suggested change above, please double-check the wording. Also the issue is:
#379
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.
pending the fix
update: looks great. This fix is overdue! Happy to get it merged and into the next Sprocket release 🚀
I have made the required change.
Also you mentioned handling this in wdl-format, I would love to implement this in another PR if this is a priority. |
I will write up some more details of what I had in mind in a new issue. You also need to rebless the tests |
alright I am running the tests, in the meanwhile I found out andrew-t already created an issue #379 wherein he mentions that this would require some discussion within the team. I can open a slack thread to discuss this better. |
issue created: #380 |
Alright this should be ready to get merged |
This pull request modifies an existing rule to
wdl-lint
.MatchingParameterMeta
Closes #259, and now checks for the order of parameter_metadata comparing it to the order of inputs
I have:
CHANGELOG.md
(see"keep a changelog" for more information).
Rule specific checks:
RULES.md
.rules()
function inwdl-lint/src/lib.rs
.wdl-lint/tests/lints
that covers everypossible diagnostic emitted for the rule within the file where the rule
is implemented.
gauntlet --bless
to ensure that there are nounintended changes to the baseline configuration file (
Gauntlet.toml
).gauntlet --bless --arena
to ensure that all of therules added/removed are now reflected in the baseline configuration file
(
Arena.toml
).