hifi-finance / hifi

Monorepo implementing the Hifi fixed-rate, fixed-term lending protocol
https://app.hifi.finance
Other
106 stars 15 forks source link

Avoid the endline when the function does not have params #71

Closed PaulRBerg closed 2 years ago

PaulRBerg commented 2 years ago

Related to #70, but in this case the issue is that even if the function does not params, the generate docs still add an empty line in the code snippet:

function balanceSheet(
) external returns (contract IBalanceSheetV1)

Which should instead be:

function balanceSheet() external returns (contract IBalanceSheetV1)
PaulRBerg commented 2 years ago

Done via https://github.com/hifi-finance/hifi/commit/43e08ed4d7fa9aefdae0d07383c9b52fbd0a0a48.

The trick was to add an extra if:

function {{name}}({{#if params}}
    {{#each params}}
    {{type}} {{name}}{{#if @last}}{{else}},{{/if}}
    {{/each}}
{{/if}}) {{visibility}}{{#if returns}} returns ({{printParams returns}}){{/if}}