tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

static_analysis.md (4379B)


Static Analysis

We use several tools for static analysis in chromium.

[TOC]

Autoninja Integration

You can set android_static_analysis = "build_server" in your gn args to run static analysis tasks in the background. This will change the build as follows:

* This means the build will succeed but static analysis might fail later. * If there are background tasks still running, autoninja will say so at the end of the build. * Leads to [30-50% improvement in build times][cbuild- speed improvement] when building debug.

* The output is preceded by an emoji like ⏩. * If the output gets mixed in with what you are doing so it is no longer clear, you can check the task output in the logfile. * E.g.: out/Default/buildserver.log.0.

[cbuild- speed improvement]: https://dashboards.corp.google.com/clankbuildspeed?f=commit:bt:1411615,1422246&f=benchmark:in:basesigcompile,chromenosigcompile&f=server:in:true,false&f=emulator:in:None,api31

[Android Lint](lint.md)

* NewApi (ensureing Build.VERSION.SDK_INT checks are in place).

* and [lint-baseline.xml] files contain individual suppressions.

[are possible]: https://googlesamples.github.io/android-custom-lint-rules/api-guide.md.html [within lint.py]: https://source.chromium.org/chromium/chromium/src/+/main:build/android/gyp/lint.py;l=25 [lint-baseline.xml]: https://source.chromium.org/search?q=f:lint-baseline.xml%20-f:third_party

[ErrorProne]

android_static_analysis).

* Checking correctness of [nullable annotations] (via NullAway plugin). * Enforcement of @GuardedBy, @CheckReturnValue, and @DoNotMock. * Enforcement of /* paramName= */ comments.

* Many checks are currently disabled because there is work involved in fixing violations they introduce. Please help!

[ErrorProne]: https://errorprone.info/ [Useful checks include]: https://errorprone.info/bugpatterns [nullable annotations]: /styleguide/java/nullaway.md [within compile_java.py]: https://source.chromium.org/chromium/chromium/src/+/main:build/android/gyp/compile_java.py;l=46;drc=5dc479e73c3c9c03b59f324b2e349b8bd008401f [a few custom checks]: /tools/android/errorprone_plugin/src/org/chromium/tools/errorprone/plugin/

[Checkstyle](https://checkstyle.sourceforge.io/)

* E.g.: Unused imports and naming conventions.

@SuppressWarnings annotations.

[is ours]: /tools/android/checkstyle/chromium-style-5.0.xml

[PRESUBMIT.py](/PRESUBMIT.py):

* (These should likely be moved to checkstyle).

* Including running Checkstyle.

[Bytecode Processor](/build/android/bytecode/)

* Enforces that targets do not rely on indirect dependencies to populate their classpath. * In other words: that deps are not missing any entries.