-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Presubmit checks
Chromium has a system of presubmit checks which contains a lot of Chromium-specific validators we can use. The system is greatly explained here: https://www.chromium.org/developers/how-tos/depottools/presubmit-scripts/
To run presubmits in Brave: npm run presubmit
, the result will be printed to the console.
There're few options you may find useful:
--base <base branch> set the destination branch for the PR
--all run presubmit on all files
--files <file list> semicolon-separated list of files to run presubmit on
--verbose [arg] pass --verbose 2 for more debugging info
--fix try to fix found issues automatically
If you need to configure some upstream checks, i.e. disable or add a file filter, please use: chromium_presubmit_config.json5.
- license header check
In addition to manually written checks, the presubmit system also runs:
- code format (clang-format, yapf)
- cpplint
- pylint
- checkdeps
- eslint
It can be extended to support other checks, such as chromium_src
macro validation.
The system also supports Android style check, but it's currently disabled via config file, because most .java
files require style rework.
Currently upstream checks are modified in such way:
- Make it compatible with our directory structure.
- Disable Gerrit-specific checks.
- Disable
OWNERS
/AUTHORS
checks. - Add ability to fully disable a check or filter some files.
- Force some checks to trigger errors instead of warnings.
Under the hood we run git cl presubmit
in src/brave
directory, which runs all checks from src/brave/**/PRESUBMIT.py
and upstream checks from src/PRESUBMIT.py
.
src/PRESUBMIT.py
is modified using chromium_presubmit_overrides.py to support chromium_presubmit_config.json5
.