Skip to content

Commit be27e14

Browse files
committed
Document SuppressLint with a comment
The Android linter is an amazing tool. It helps us navigate the unwieldy world of Android deprecations, bugs, and layout oddities. It's not perfect, however. The `@SuppressLint` annotation helps us mark places where we are intentionally bypassing the linter. This allows us to continue to run the linter while not being bombarded by noise. However, `@SuppressLint` comes at a cost: it can get out of date, be a mystery, or be inserted just to silence the linter. A solution can be a simple comment, describing why the linter was suppressed and under which conditions it can be invoked again. This can come in handy when updating a method; if there's a `@SuppressLint` nearby, check that the comment is still correct. This can also be useful during a code review: the reviewer gets an understanding of why the linter was suppressed, and confidence that the developer was not simply silencing the linter to ignore the error.
1 parent 4a49843 commit be27e14

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

android/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@
1111
- Prefer vector drawables over PNGs or JPEGs.
1212
- Prefer Model-View-ViewModel (MVVM) for your app architecture.
1313
- Prefer `.forEach` over the `for` keyword.
14+
- Document each `@SuppressLint` with a comment.

0 commit comments

Comments
 (0)