Skip to content

lint: "invalid natspec" doesn't consider ignore config #12458

@frontier159

Description

@frontier159

Component

Forge

Have you ensured that all of these are up to date?

  • Foundry
  • Foundryup

What version of Foundry are you on?

1.4.4-stable

What version of Foundryup are you on?

1.3.0

What command(s) is the bug in?

forge build

Operating System

None

Describe the bug

forge build (or lint) throws a hard error when the natspec parsing fails, even if the file is within the ignore list in foundry.toml

AFAIK there isn't a exclude_lints rule to exclude natspec linting - but could be a skill issue in finding.

The issue is that these could come from upstream libraries which can't easily be updated, so need to be excluded.

Example contract:

pragma solidity ^0.8.19;
// SPDX-License-Identifier: AGPL-3.0-or-later

/// Some editors highlight `@note` or `@todo`
/// @note foo bar

/// @title Foo
contract Foo {
    /**
    some example code in a comment:
    import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
    ...
    */
}

output:

Error: Lint failed

Context:
- solar run failed:

error: invalid natspec tag '@note', custom tags must use format '@custom:name'
 --> contracts/external/cowprotocol/GPv2Order.sol:6:1
  |
6 | /// @note Forked from https://github.com/cowprotocol/contracts/blob/main/src/contracts/libraries/GPv2Order.sol
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: invalid natspec tag '@note`', custom tags must use format '@custom:name'
 --> contracts/investments/sky/Foo.sol:4:1
  |
4 | /// Some editors highlight `@note` or `@todo`
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-bugType: bugT-needs-triageType: this issue needs to be labelled

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions