-
Notifications
You must be signed in to change notification settings - Fork 155
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
[Feature] Ability to add documentation inside of sol! macro to satisfy missing_docs
lint rule
#588
Comments
missing_docs
lint rulemissing_docs
lint rule
missing_docs
lint rulemissing_docs
lint rule
Came here to open this exact issue! Fwiw, this invocation gives the same warning: sol! {
/// Emitted when `value` tokens are moved from one account (`from`) to
/// another (`to`).
///
/// Note that `value` may be zero.
event Transfer(address indexed from, address indexed to, uint256 value);
/// Emitted when the allowance of a `spender` for an `owner` is set by a
/// call to `approve`. `value` is the new allowance.
event Approval(address indexed owner, address indexed spender, uint256 value);
} |
Is it my understanding that you would prefer something like the following, instead of allowing the lint with sol! {
/// ...
event Approval(
/// ...
address indexed owner,
/// ...
address indexed spender,
/// ...
uint256 value
);
} |
For me this gives a warning as well. |
Yes, it's not implemented, I am asking if that's what you would like |
Yeah, I think that works 👍 |
Main things that changed: - Syntax for conditional compilation was wrong, so fixed that. `#[cfg(erc20)]` -> `#[cfg(feature = "erc20")]`. - Added a `tests` flag as a workaround to rust-lang/cargo#13595 - Moved to using workspace dependencies. - Added example erc20. - `alloy-primitives` did not need to be a dependency of `lib/crypto`. As a result of setting features properly, we now have a missing docs warning that we cannot fix. See alloy-rs/core#588
Ah @DaniPopes, so I was revisiting this and reading the code, and I realized that I probably misunderstood your question twice. I think I'd prefer if we annotated the fields of the generated event struct with I initially thought you meant: sol! {
/// ...
event Approval(
#[allow(missing_docs)]
address indexed owner,
#[allow(missing_docs)]
address indexed spender,
#[allow(missing_docs)]
uint256 value
);
} It's a one-line change, so I'll just open a PR. I'm not entirely sure this addresses the original issue though, let me know if that's the case. |
Component
sol! macro
Describe the feature you would like
When using the following common lint rule:
It will warn users that this
sol!
block is missing documentation with the error:missing documentation for a struct field requested on the command line with "-W missing-docs"
It is however currently not possible to add documentation inside of the
sol!
macro and therefore it requires adding a#[allow(missing_docs)]
for now.Additional context
Added a minimal repro here: https://github.com/zerosnacks/alloy-core-repro-588
Unclear if this should be marked as a feature request or a bug
The text was updated successfully, but these errors were encountered: