IntelliTect / IntelliTect/CodingGuidelines

Where to include message for #pragma disable?

オープン
#82 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る
documentation
主要言語
C#
スター
12
フォーク
16
平均マージ
2分
マージ済み PR(30日)
7

説明

If I am disabling a warning, what is the format of the justification message.

Here's an idea/approach but it is still ugly, better suggestions welcome:
```
// Justifiction: Properties initialized by Entity Framework.
#nullable disable // CS8618: Non-nullable field is uninitialized. Consider declaring as nullable.
public ApplicationDbContext(
#nullable enable
DbContextOptions? options) : base(options) { }

// Justifiction: Properties initialized by Entity Framework.
#nullable disable // CS8618: Non-nullable field is uninitialized. Consider declaring as nullable.
public ApplicationDbContext(
#nullable enable
```
or, with pragma:
```
// Justification: Uninitialized properties set by Entity Framework.
#pragma warning disable CS8618 // Non-nullable field is uninitialized. Consider declaring as nullable.
public ApplicationDbContext(DbContextOptions options) : base(options) { }
#pragma warning restore CS8618 // Non-nullable field is uninitialized. Consider declaring as nullable.
```

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。