microsoft / microsoft/typespec

Add ability to have suppressions cascade to emitters so that point suppressions in code can happen at the same time.

Open
#2,713 1 comment 0 reactions 1 assignee Claimed by @m-nash View on GitHub
design:needed triaged:core
Dominant language
Java
Stars
5.9k
Forks
394
Avg merge
1d 23h
Merged PRs (30d)
104

Description

There are 2 levels of warnings that can arise from a spec. The first is the spec itself coming from a linter rule and the way we suppress this is.

```
#suppress "[package]/[rule]"
```

The second is in the generated code itself which might apply its own style rules and the way we suppress this in .NET for example is

```c#
#pragma warning disable [code ]// [description]
//violating code
#pragma warning restore [code ]// [description]
```

It would be nice if adding the suppression at the tsp level could propagate to the emitted code as well.

To support this we would need a way to apply a target to a suppression since some of these linter rules will be emitter specific and we might want to add the suppression to a side car. We also might want to only suppress for a specific emitter.

For example purposes something like this
```
#suppress [target] [scope] "[package]/[rule]"
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.