From 9f36bb5c13afc73482f473d4a402fec028d44332 Mon Sep 17 00:00:00 2001 From: Bogdan Drutu Date: Thu, 29 Oct 2020 13:58:17 -0700 Subject: [PATCH 1/3] Initial list of best practices to follow in our project Signed-off-by: Bogdan Drutu --- CONTRIBUTING.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7224665fdbb..bf796b75978 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -43,6 +43,13 @@ which uses [google-java-format](https://github.com/google/google-java-format) li `./gradlew spotless` +### Best practices that we follow + +* Avoid exposing publicly any class/method/variable that don't need to be public; +* By default, all arguments/members are treated as non-null. Every argument/member that can be `null` must be annotated with `@Nullable`; +* The project aims to provide a consistent experience across all the public APIs. It is important to ensure consistency (same look and feel) across different public packages; +* Use `final` everywhere is possible, this ensures that classes cannot be extended when the API does not intend to offer that functionality; + ### Pre-commit hook To completely delegate code style formatting to the machine, you can add [git pre-commit hook](https://git-scm.com/docs/githooks). From d0470ab8a0d2aee14e115074954918f2e19d0554 Mon Sep 17 00:00:00 2001 From: Bogdan Drutu Date: Thu, 29 Oct 2020 14:00:51 -0700 Subject: [PATCH 2/3] Update CONTRIBUTING.md Co-authored-by: John Watson --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bf796b75978..9272b549b00 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -48,7 +48,7 @@ which uses [google-java-format](https://github.com/google/google-java-format) li * Avoid exposing publicly any class/method/variable that don't need to be public; * By default, all arguments/members are treated as non-null. Every argument/member that can be `null` must be annotated with `@Nullable`; * The project aims to provide a consistent experience across all the public APIs. It is important to ensure consistency (same look and feel) across different public packages; -* Use `final` everywhere is possible, this ensures that classes cannot be extended when the API does not intend to offer that functionality; +* Use `final` classes everywhere it is possible, this ensures that these classes cannot be extended when the API does not intend to offer that functionality; ### Pre-commit hook To completely delegate code style formatting to the machine, From 726ff76df9117c40ebcfcb325fca0f53d852210c Mon Sep 17 00:00:00 2001 From: Bogdan Drutu Date: Fri, 30 Oct 2020 06:51:08 -0700 Subject: [PATCH 3/3] Update CONTRIBUTING.md Co-authored-by: Anuraag Agrawal --- CONTRIBUTING.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9272b549b00..f28b691086c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -45,10 +45,12 @@ which uses [google-java-format](https://github.com/google/google-java-format) li ### Best practices that we follow -* Avoid exposing publicly any class/method/variable that don't need to be public; -* By default, all arguments/members are treated as non-null. Every argument/member that can be `null` must be annotated with `@Nullable`; -* The project aims to provide a consistent experience across all the public APIs. It is important to ensure consistency (same look and feel) across different public packages; -* Use `final` classes everywhere it is possible, this ensures that these classes cannot be extended when the API does not intend to offer that functionality; +* Avoid exposing publicly any class/method/variable that don't need to be public. +* By default, all arguments/members are treated as non-null. Every argument/member that can be `null` must be annotated with `@Nullable`. +* The project aims to provide a consistent experience across all the public APIs. It is important to ensure consistency (same look and feel) across different public packages. +* Use `final` for public classes everywhere it is possible, this ensures that these classes cannot be extended when the API does not intend to offer that functionality. + +If you notice any practice being applied in the project consistently that isn't listed here, please consider a pull request to add it. ### Pre-commit hook To completely delegate code style formatting to the machine,