-
Notifications
You must be signed in to change notification settings - Fork 137
[hermes] Initial commit of parser #3002
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
base: main
Are you sure you want to change the base?
Conversation
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3002 +/- ##
=======================================
Coverage 91.87% 91.87%
=======================================
Files 20 20
Lines 6057 6057
=======================================
Hits 5565 5565
Misses 492 492 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
029625c to
298708d
Compare
|
/gemini review |
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.
Code Review
This pull request introduces the hermes parser crate. The initial implementation provides a solid foundation for parsing Rust source files and extracting specific documentation blocks. The code is well-structured, using syn for parsing and miette for diagnostics.
My review focuses on improving code quality and dependency management. I've identified a dependency on a yanked version of thiserror, some dead code, and leftover debugging statements that should be addressed.
Overall, this is a great start for the new parser.
| miette = { version = "7.6.0", features = ["derive", "fancy"] } | ||
| proc-macro2 = { version = "1.0.105", features = ["span-locations"] } | ||
| syn = { version = "2.0.114", features = ["full", "visit", "extra-traits", "parsing"] } | ||
| thiserror = "2.0.18" |
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 thiserror dependency is pinned to version 2.0.18, which has been yanked from crates.io. Relying on yanked versions is not recommended as they may contain bugs or security vulnerabilities and can make dependency management difficult. Please update to a stable version of thiserror, such as "1.0".
| thiserror = "2.0.18" | |
| thiserror = "1.0" |
| /// A custom error type that associates a `syn::Error` with the file path | ||
| /// it originated from. | ||
| #[derive(Debug)] | ||
| pub struct ParseError { | ||
| error: Error, | ||
| source_file: Option<PathBuf>, | ||
| } | ||
|
|
||
| impl std::fmt::Display for ParseError { | ||
| fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
| if let Some(path) = &self.source_file { | ||
| write!(f, "{}: {}", path.display(), self.error) | ||
| } else { | ||
| write!(f, "{}", self.error) | ||
| } | ||
| } | ||
| } | ||
| impl std::error::Error for ParseError {} |
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.
| let file_name = { | ||
| let f = source_file | ||
| .as_ref() | ||
| .map(|p| p.display().to_string()) | ||
| .unwrap_or_else(|| "<input>".to_string()); | ||
| dbg!(&f); | ||
| f | ||
| }; | ||
| let _x = source_file | ||
| .as_ref() | ||
| .map(|p| p.display().to_string()) | ||
| .unwrap_or_else(|| "<input>".to_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.
gherrit-pr-id: G3b521f32cf769ffedd72f84e60f1e73a8d590e4c
298708d to
cd1ecc6
Compare
mod foo;declarations #3008Latest Update: v36 — Compare vs v35
📚 Full Patch History
Links show the diff between the row version and the column version.
⬇️ Download this PR
Branch
git fetch origin refs/heads/G3b521f32cf769ffedd72f84e60f1e73a8d590e4c && git checkout -b pr-G3b521f32cf769ffedd72f84e60f1e73a8d590e4c FETCH_HEADCheckout
git fetch origin refs/heads/G3b521f32cf769ffedd72f84e60f1e73a8d590e4c && git checkout FETCH_HEADCherry Pick
git fetch origin refs/heads/G3b521f32cf769ffedd72f84e60f1e73a8d590e4c && git cherry-pick FETCH_HEADPull
Stacked PRs enabled by GHerrit.