-
Notifications
You must be signed in to change notification settings - Fork 168
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
Rule request: full NatSpec documentation #298
Comments
+1 for this |
This is an interesting feature. The hardest part about implementing this is that comments are not included in the Solidity AST |
Not using the AST, but after solidity compiles it the nat spec comes through to the compiler output. I documented this at https://docs.soliditylang.org/en/latest/natspec-format.html |
I mention the AST because this tool is for linting contracts using the AST. The exact format of the comment shouldn't affect the compiled output. In my opinion, the goal for formatting should be to enforce consistent readable natspec within a codebase. |
@fulldecent @d1onys1us @fedekunse @mvanmeermeck This require a whole new way of working for solhint, so I doubt this can be implemented in the short/mid term... even in long seems kind of out of reach Sorry for that... |
You might want to take a look at https://github.com/defi-wonderland/natspec-smells It aims to solve exactly what @fulldecent was looking for. |
Requesting a new rule and to enable it by default.
natspec-documentation
The following would trigger an error:
public
orexternal
function which does not have a NatSpec comment@notice
set@param
for every parameter@return
for every returnpublic
storage variable which does not have a NatSpec comment@notice
set@param
for every parameter@return
for every returnError
type which does not have a NatSpec comment@notice
setThe Solidity project recommends the above. It is extremely useful. And few people do it. So it will be very helpful to add rules for it.
As a bonus I am also requesting a separate rule that is OFF by default and which is more zealous.
Perhaps name this
natspec-documentation-internal
.internal
function which does not have a NatSpec comment@param
for every parameter@return
for every returnNote that
@notice
is not required in this circumstance because that tag applies to "end users" whereas aninternal
function is useful only to contract developers.Note that
private
functions are not included in this rule. This is because documentation for implementation details is always less important that documentation for an objects' surface area. If you like, this could be another rulenatspec-documentation-private
and should be default OFF.I am a contributor to the Solidity NatSpec specification, the style guide and the above-referenced Solidity project recommendation. Ask me anything.
The text was updated successfully, but these errors were encountered: