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

feat: section ordering lint rule #109

Merged
merged 12 commits into from
Jul 9, 2024
Merged

feat: section ordering lint rule #109

merged 12 commits into from
Jul 9, 2024

Conversation

adthrasher
Copy link
Member

This pull request adds a new rule to wdl-lint.

  • Rule Name: SectionOrdering

This rule ensures that tasks and workflows have their sections in the desired order.

Before submitting this PR, please make sure:

  • You have added a few sentences describing the PR here.
  • You have added yourself or the appropriate individual as the assignee.
  • You have added at least one relevant code reviewer to the PR.
  • Your code builds clean without any errors or warnings.
  • You have added an entry to the relevant CHANGELOG.md (see
    ["keep a changelog"] for more information).
  • Your commit messages follow the [conventional commit] style.

Rule specific checks:

  • You have added the rule as an entry within RULES.md.
  • You have added the rule to the rules() function in wdl-lint/src/lib.rs.
  • You have added a test cases in wdl-lint/tests/lints that covers every
    possible diagnostic emitted for the rule within the file where the rule
    is implemented.
  • You have run wdl-gauntlet --refresh to ensure that there are no
    unintended changes to the baseline configuration file (Gauntlet.toml).
  • You have run wdl-gauntlet --refresh --arena to ensure that all of the
    rules added/removed are now reflected in the baseline configuration file
    (Arena.toml).

@adthrasher adthrasher self-assigned this Jul 3, 2024
@adthrasher adthrasher requested review from a-frantz and peterhuene July 3, 2024 18:03
Copy link
Member

@claymcleod claymcleod left a comment

Choose a reason for hiding this comment

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

I'm good with this. I'd take a look at my question about which span to report and also removing the println!. One last thing to consider is whether we want to report in the fix only the sections that were actually detected rather than a static list of all possible sections. I don't think that's required, but it might be just a tad bit cleaner—if nothing else, for future work.

@claymcleod
Copy link
Member

claymcleod commented Jul 9, 2024

Ah, also need to add this when #110 is merged in. You probably want to rebase on that branch, as doing the inverse would be difficult.

    fn document(&mut self, _: &mut Self::State, reason: VisitReason, _: &Document) {
        if reason == VisitReason::Exit {
            return;
        }

        // Reset the visitor upon document entry
        *self = Default::default();
    }

@peterhuene
Copy link
Collaborator

I'm happy to also rebase my branch if we want to merge this first.

Copy link
Collaborator

@peterhuene peterhuene left a comment

Choose a reason for hiding this comment

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

This looks really good, just a few comments for your review.

wdl-lint/tests/lints/missing-meta/source.wdl Show resolved Hide resolved
wdl-lint/src/rules/section_order.rs Outdated Show resolved Hide resolved
wdl-lint/src/rules/section_order.rs Outdated Show resolved Hide resolved
wdl-lint/src/rules/section_order.rs Outdated Show resolved Hide resolved
wdl-lint/src/rules/section_order.rs Outdated Show resolved Hide resolved
wdl-lint/src/rules/section_order.rs Outdated Show resolved Hide resolved
wdl-lint/src/rules/section_order.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@peterhuene peterhuene left a comment

Choose a reason for hiding this comment

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

Looks good!

@adthrasher adthrasher merged commit 67ab316 into main Jul 9, 2024
7 checks passed
@adthrasher adthrasher deleted the feat/section_order branch July 9, 2024 19:34
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.

3 participants