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

Simple solution to validate toml in issue #106104 #106559

Closed
wants to merge 6 commits into from
Closed

Simple solution to validate toml in issue #106104 #106559

wants to merge 6 commits into from

Conversation

aadityadhruv
Copy link

@aadityadhruv aadityadhruv commented Jan 7, 2023

Fixes #106104 using the toml crate to validate if the triagebot.toml file is in valid toml.

@rustbot
Copy link
Collaborator

rustbot commented Jan 7, 2023

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @jyn514 (or someone else) soon.

Please see the contribution instructions for more information.

@rustbot rustbot added T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 7, 2023
@aadityadhruv aadityadhruv changed the title Simple solution to validate toml in issue #106104 Simple solution to validate toml in issue https://github.com/rust-lang/rust/issues/106104 Jan 7, 2023
@aadityadhruv aadityadhruv changed the title Simple solution to validate toml in issue https://github.com/rust-lang/rust/issues/106104 Simple solution to validate toml in issue #106104 Jan 7, 2023
@rust-log-analyzer

This comment has been minimized.

walk(path, &mut |path| filter_dirs(path), &mut |entry, contents| {
let file = entry.path();
let filename = file.file_name().unwrap();
if filename != "triagebot.toml" {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe only check the top-level triagebot.toml instead of trying to find it in all subdirectories?

Copy link
Author

Choose a reason for hiding this comment

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

Sure, I'll fix it. I had searched the repo for the triagebot.toml files and saw multiple, hence I thought maybe I should do a walk. Is there a reason we don't check those toml files?

Copy link
Member

Choose a reason for hiding this comment

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

Only the top-level one is actually used by triagebot afaik. Several subdirectories of src/tools are submodules or subtrees. Their copy is only used for the separate repo from which they are pulled in. For example src/tools/miri is a subtree pulled from https://github.com/rust-lang/miri/, so the https://github.com/rust-lang/miri/ repo has a triagebot.toml file which is used when interacting with this repo, but it is also copied into src/tools/miri/triagebot.toml as part of git subtree syncs, as everything is copied.

@jyn514
Copy link
Member

jyn514 commented Jan 10, 2023

Sorry, I meant to reply on the issue. I liked Eric's idea of validating this in triagebot, I don't think it should go in tidy. Fortunately I think nearly all of the code you've written can stay the same :) you'd just need to handle posting a comment on the PR if the check fails.

@jyn514 jyn514 closed this Jan 10, 2023
@aadityadhruv
Copy link
Author

Got it, I'll get to work on that! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Validate triagebot.toml in tidy/CI
5 participants