# require-diagnostic-reason

Require reasons for diagnostic suppressions

A diagnostic suppression without a reason hides why the exception is necessary.
Instead, every `@allow` and `@expect` SHOULD include a concise reason.

- Category: style
- Level: warning
- Fix: none
- Scope: module

## Reported

```ds title="main.ds"
@allow("constant-condition")
function ready(): boolean {
    if (true) {
        return true;
    }

    return false;
}
```

## Accepted

```ds title="main.ds"
@allow("constant-condition", { reason: "required sentinel branch" })
function ready(): boolean {
    if (true) {
        return true;
    }

    return false;
}
```

## Prior art

- [Clippy · allow_attributes_without_reason](https://rust-lang.github.io/rust-clippy/master/index.html#allow_attributes_without_reason)
- [typescript-eslint · ban-ts-comment](https://typescript-eslint.io/rules/ban-ts-comment)

[language/linter/src/rules/style/require_diagnostic_reason.rs:7](https://github.com/destack-sh/destack/blob/main/language/linter/src/rules/style/require_diagnostic_reason.rs#L7)
