To run all configured lint checks:
This command should have exit code 0 and no output.
Behind the scenes, this command:
- Discovers all Protobuf files per your configuration.
- Copies all Protobuf file content into memory.
- Compiles all Protobuf files.
- Runs the compilation result against the configured lint checkers.
Let's examine the
lint section of the
buf.yaml file we have set up:
This instructs Buf to use the
BASIC lint category, as well as the
FILE_LOWER_SNAKE_CASE lint checker,
but not use the checkers
PACKAGE_SAME_DIRECTORY (all of which are in the
BASIC lint category), and not use any checkers
in the lint category
PACKAGE_AFFINITY (all of which are also in the
BASIC lint category). We
will examine the available lint checkers later.
Let's comment out two of the exceptions:
Then re-run linting:
We can also output this as JSON:
If you'd like to skip ahead in the documentation, you can also lint directly from GitHub:
We can also output errors in a format you can then copy into your
buf.yaml file. This allows you
to ignore all existing lint errors and correct them over time:
If we then copy this into our
We can re-run linting and there will be no output:
Once done, change the config file back to it's original state before continuing the tour: