Skip to content

Commit 7c6a3b6

Browse files
[skills] Update nullable review rule to check project-level setting (#11073)
Skip flagging missing per-file #nullable enable when the project's `.csproj` already has `<Nullable>enable</Nullable>`. Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent fccdfda commit 7c6a3b6

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

.github/skills/android-reviewer/references/review-rules.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ cause performance regressions, or silently delete files.
4848

4949
| Check | What to look for |
5050
|-------|-----------------|
51-
| **`#nullable enable`** | New files should have `#nullable enable` at the top with no preceding blank lines. |
51+
| **`#nullable enable`** | New files should have `#nullable enable` at the top with no preceding blank lines**unless** nullable is already enabled at the project level (for example via the `Nullable` MSBuild property in the project or imported props), in which case it is not needed per-file. |
5252
| **Never use `!` (null-forgiving operator)** | The postfix `!` null-forgiving operator (e.g., `foo!.Bar`) is banned. If the value can be null, add a proper null check. If it can't be null, make the type non-nullable. AI-generated code frequently sprinkles `!` to silence warnings — this turns compile-time safety into runtime `NullReferenceException`s. Note: this rule is about the postfix `!` operator, not the logical negation `!` (e.g., `if (!someBool)` or `if (!string.IsNullOrEmpty (s))`). |
5353
| **Use `IsNullOrEmpty()` extension** | Use the `NullableExtensions` instance methods (`str.IsNullOrEmpty()`, `str.IsNullOrWhiteSpace()`) instead of the static `string.IsNullOrEmpty(str)` / `string.IsNullOrWhiteSpace(str)` — they integrate with `[NotNullWhen]` for NRT flow analysis. |
5454
| **`ArgumentNullException.ThrowIfNull`** | Android-targeted code (.NET 10+) should use `ArgumentNullException.ThrowIfNull(param)`. |

0 commit comments

Comments
 (0)