Python Style

How to Ignore the Bots

Formatting and analysis bots are great because it takes more effort to defy them than to accept their criticism. Nevertheless, for code clarity, they can be honestly wrong, so we need a way to specifically clear their findings.

  • Py Formatting (yapf) # yapf: disable (single line or block) # yapf: enable (resume)

  • C++ Formatting (clang-format) // clang-format off (single line or block) // clang-format on (resume)

  • Py Dynamic Analysis (coverage.py) # pragma: no cover

  • C++ Dynamic Analysis (gcov) https://stackoverflow.com/a/30078276 untested

  • Py Static Analysis (lgtm) # lgtm[py/not-named-self] (click on the “?” to get the “Query ID”)

  • C++ Static Analysis (lgtm) // lgtm[cpp/wrong-type-format-argument] (click on the “?” to get the “Query ID”)