OpenZeppelin / solidity-docgen

Documentation generator for Solidity projects
MIT License
451 stars 118 forks source link

Error: Item does not contain return parameters should point to source line #420

Open mwawrusch opened 2 years ago

mwawrusch commented 2 years ago

The following is an output from running docgen. Would be helpful to have information which line and source filed casued it.

Error: Item does not contain return parameters

    at parseNatspec (/Users/martinwawrusch/Dev/roji/smartcontracts/roji-smartcontracts-evm-nfts/node_modules/solidity-docgen/src/utils/natspec.ts:71:15)
    at natspec (/Users/martinwawrusch/Dev/roji/smartcontracts/roji-smartcontracts-evm-nfts/node_modules/solidity-docgen/src/common/properties.ts:18:22)
    at /Users/martinwawrusch/Dev/roji/smartcontracts/roji-smartcontracts-evm-nfts/node_modules/solidity-docgen/src/site.ts:115:51
    at Object.get [as natspec] (/Users/martinwawrusch/Dev/roji/smartcontracts/roji-smartcontracts-evm-nfts/node_modules/solidity-docgen/src/utils/memoized-getter.ts:17:19)
    at lookupProperty (/Users/martinwawrusch/Dev/roji/smartcontracts/roji-smartcontracts-evm-nfts/node_modules/handlebars/lib/handlebars/runtime.js:130:26)
    at Object.eval (eval at createFunctionContext (/Users/martinwawrusch/Dev/roji/smartcontracts/roji-smartcontracts-evm-nfts/node_modules/handlebars/lib/handlebars/compiler/javascript-compiler.js:265:23), <anonymous>:16:64)
    at main (/Users/martinwawrusch/Dev/roji/smartcontracts/roji-smartcontracts-evm-nfts/node_modules/handlebars/lib/handlebars/runtime.js:230:22)
    at ret (/Users/martinwawrusch/Dev/roji/smartcontracts/roji-smartcontracts-evm-nfts/node_modules/handlebars/lib/handlebars/runtime.js:250:12)
    at ret (/Users/martinwawrusch/Dev/roji/smartcontracts/roji-smartcontracts-evm-nfts/node_modules/handlebars/lib/handlebars/compiler/compiler.js:548:21)
    at /Users/martinwawrusch/Dev/roji/smartcontracts/roji-smartcontracts-evm-nfts/node_modules/solidity-docgen/src/render.ts:74:14
frangio commented 2 years ago

I added source location in the error message in the latest version, but I haven't been able to test it because these errors are supposed to be unreachable. :slightly_smiling_face:

Please try it now and let me know what piece of code is causing it.

frangio commented 1 year ago

Closing for lack of follow up.

DenkevichOleg commented 2 months ago

piece of code that causing it (any public variable):

pragma solidity 0.8.23;

contract Test {
  /// @notice Shows the address where protocol fee are received
  /// @dev variable. changing in setFeeDestination()
  /// @return Address where protocol fee are received
  address public protocolFeeDestination;
}

Error: ItemError: Item does not contain return parameters (contracts/Test.sol:7)

even if put /// @return to public variables description is not good idea (or it is good?) - some contracts are already deployed with that. so should it cause error?