P007 SuppressedDiagnostics
- Applies to
- Pull requests, through the GitHub App
- Severity
- Warning (fails the check under fail-on-warnings)
- Summary
- A change silences a compiler or linter warning.
- Flags
- Added lines in code, config, and .editorconfig files, outside string literals: #pragma warning disable, [SuppressMessage], ReSharper disable, <NoWarn>, dotnet_diagnostic.*.severity = none; eslint-disable, @ts-ignore, @ts-nocheck; # noqa, # type: ignore, # pylint: disable, # pyright: ignore; //nolint; #[allow(...)]; @SuppressWarnings. Generated files (<auto-generated in the first 10 lines) are skipped.
Before
#pragma warning disable CS8602
var name = customer.Name.Trim();
After
var name = customer?.Name?.Trim() ?? string.Empty;
Fix
- Fix the warning. If the suppression stays, scope it to one line and state the reason.