-
Notifications
You must be signed in to change notification settings - Fork 526
Buf Guide
Once you have completed all the installation steps, you will have a buf
file in your opensource/oppia-android-tools
folder.
Note: Currently, Buf is not available for windows.
- Check the version of the buf. As of now on GitHub Actions, we are using
0.37.1
.
../oppia-android-tools/YOUR_BUF_FILE_NAME --version
- Lint check
buf lint --config buf.yaml
We have a configuration file buf.yaml
at the root of the project. Following is the list of things we are checking and the list of things we are excluding from our check.
-
DIRECTORY_SAME_PACKAGE
checks that all files in a given directory are in the same package.- All proto files should be in the same package
-
PACKAGE_SAME_DIRECTORY
checks that all files with a given package are in the same directory.- All proto files with the same package name should be in the same directory
-
PACKAGE_SAME_JAVA_MULTIPLE_FILES
checks that all files with a given package have the same value for the java_multiple_files option.- All proto files should have the same value
option java_multiple_files = true;
- All proto files should have the same value
-
PACKAGE_SAME_JAVA_PACKAGE
checks that all files with a given package have the same value for the java_package option.- All proto files should have the same value
option java_package = "path.to.your.proto.directory";
- All proto files should have the same value
-
ENUM_NO_ALLOW_ALIAS
checks that enums do not have the allow_alias option set.- Should not allows multiple enum values to have the same number.
-
FIELD_NO_DESCRIPTOR
checks that field names are not named capitalization of "descriptor" with any number of prefix or suffix underscores.- No
descriptor
field name should be there, example -descriptor
,Descriptor
,descRiptor
,_descriptor
,descriptor_
,__descriptor__
- No
-
IMPORT_NO_PUBLIC
checks that imports are not public.- Import should not be declared as
public
, example -import public "x.y.proto"
- Import should not be declared as
-
IMPORT_NO_WEAK
checks that imports are not weak.- Import should not be declared as
weak
, example -import weak "x.y.proto"
- Import should not be declared as
-
PACKAGE_DEFINED
checks that all files have a package defined.- All proto files must have a package name specify in it, for example -
package model;
- All proto files must have a package name specify in it, for example -
-
ENUM_PASCAL_CASE
checks that enums are PascalCase.- Enum name should be in pascal case, example -
AudioLanguage
- Enum name should be in pascal case, example -
-
ENUM_VALUE_UPPER_SNAKE_CASE
checks that enum values are UPPER_SNAKE_CASE.- Enum value should be in upper snake case
-
FIELD_LOWER_SNAKE_CASE
checks that field names are lower_snake_case.- Field name should be in lower snake case
-
MESSAGE_PASCAL_CASE
checks that messages are PascalCase.- Message should be in Pascal case, example -
ProfileAvatar
- Message should be in Pascal case, example -
-
ONEOF_LOWER_SNAKE_CASE
checks that oneof names are lower_snake_case.- Oneof should be a lower snake case
-
PACKAGE_LOWER_SNAKE_CASE
checks that packages are lower_snake.case.- Package should be lower snake case, example -
model
- Package should be lower snake case, example -
-
ENUM_ZERO_VALUE_SUFFIX
checks that enum zero values are suffixed with_UNSPECIFIED
(the suffix is configurable).- All the enum whose value is zero should be suffixed with
_UNSPECIFIED
, example -AUDIO_LANGUAGE_UNSPECIFIED = 0;
- All the enum whose value is zero should be suffixed with
-
FILE_LOWER_SNAKE_CASE
checks that filenames are lower_snake_case.- All the proto file names are should be in lower snake case, for example -
topic.proto
- All the proto file names are should be in lower snake case, for example -
-
PACKAGE_DIRECTORY_MATCH
checks that all files are in a directory that matches their package name.- this verifies that all files that declare a given package foo.bar.baz.v1 is in the directory foo/bar/baz/v1 relative to the root
-
ENUM_VALUE_PREFIX
checks that enum values are prefixed withENUM_NAME_UPPER_SNAKE_CASE
.enum Foo { FOO_ONE = 0; }
-
PACKAGE_VERSION_SUFFIX
checks that the last component of all packages is a version of the form v\d+, v\d+test.*, v\d+(alpha|beta)\d+, or v\d+p\d+(alpha|beta)\d+, where numbers are >=1.-
foo.v1
,foo.bar.v1alpha1
,foo.bar.v1beta1
,foo.bar.v1test
-
Have an idea for how to improve the wiki? Please help make our documentation better by following our instructions for contributing to the wiki.
Core documentation
Developing Oppia
- Contributing to Oppia Android
- Bazel
- Key Workflows
- Testing
- Developing Skills
- Frequent Errors and Solutions
- RTL Guidelines
- Working on UI
- Writing Design Docs
Developer Reference
- Code style
- Background Processing
- Dark mode
- Buf Guide
- Firebase Console Guide
- Platform Parameters & Feature Flags
- Work Manager
- Dependency Injection with Dagger
- Revert & regression policy
- Upgrading target SDK version
- Spotlight Guide
- Triaging Process
- Bazel
- Internationalization
- Terminology in Oppia
- Past Events