hifi-finance / hifi

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

Exclude the "Name" column when the returned value does not have a name #70

Closed PaulRBerg closed 2 years ago

PaulRBerg commented 2 years ago

The generate-docs scripts generates a pretty Markdown report that we use in our official docs. The problem is that this report needs some polishing before is easy for use.

One issue is related to the "Name" column in table under the "Returned Values" section. When the returned value does not have a name, but the NatSpec comments make a reference to it, in the table we find the first word after the @return keyword, which often is "The".

To solve this, we should add an #if statement, and check whether the returned value has a name or not.

scorpion9979 commented 2 years ago

@paulrberg I believe this is no longer an issue.

Example:

### getPrice

```solidity
function getPrice(
    string symbol
) external returns (uint256)
```

Gets the official price for a symbol in the default format used by Chainlink, which
has 8 decimals.

Requirements:

- The feed must be set.
- The price returned by the oracle cannot be zero.

#### Parameters

| Name     | Type   | Description                        |
| :------- | :----- | :--------------------------------- |
| `symbol` | string | The symbol to fetch the price for. |

#### Return Values

| Name  | Type    | Description                                    |
| :---- | :------ | :--------------------------------------------- |
| `[0]` | uint256 | The price denominated in USD, with 8 decimals. |
PaulRBerg commented 2 years ago

Yeah, they indeed solved this in the v0.6.0 release of solidity-docgen.