-
Notifications
You must be signed in to change notification settings - Fork 197
Rule request: full NatSpec documentation #298
Description
Requesting a new rule and to enable it by default.
natspec-documentation
The following would trigger an error:
- A
publicorexternalfunction which does not have a NatSpec comment- NatSpec comment does not have a
@noticeset - NatSpec comment does not have a
@paramfor every parameter - NatSpec comment does not have a
@returnfor every return
- NatSpec comment does not have a
- A
publicstorage variable which does not have a NatSpec comment- NatSpec comment does not have a
@noticeset - NatSpec comment does not have a
@paramfor every parameter - NatSpec comment does not have a
@returnfor every return
- NatSpec comment does not have a
- An
Errortype which does not have a NatSpec comment- NatSpec commend does not have a
@noticeset
- NatSpec commend does not have a
The 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.
It is recommended that Solidity contracts are fully annotated using NatSpec for all public interfaces (everything in the ABI).
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.
- An
internalfunction which does not have a NatSpec comment- NatSpec comment does not have a
@paramfor every parameter - NatSpec comment does not have a
@returnfor every return
- NatSpec comment does not have a
Note that @notice is not required in this circumstance because that tag applies to "end users" whereas an internal 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 rule natspec-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.