Skip to content

Commit 3b6f2a0

Browse files
1 parent d5898b2 commit 3b6f2a0

File tree

2 files changed

+35
-6
lines changed

2 files changed

+35
-6
lines changed

code_style_tools.html

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,14 +179,21 @@ <h1 id="automated-style-checks">Automated style checks</h1>
179179

180180
<ul>
181181
<li>C/C++: See the cpplint <code class="language-plaintext highlighter-rouge">USAGE</code> string at
182-
<a href="https://github.com/google/styleguide/blob/gh-pages/cpplint/cpplint.py">https://github.com/google/styleguide/blob/gh-pages/cpplint/cpplint.py</a>.
182+
<a href="https://github.com/cpplint/cpplint/blob/develop/cpplint.py">https://github.com/cpplint/cpplint/blob/develop/cpplint.py</a>.
183183
<ul>
184184
<li>In particular, note the <code class="language-plaintext highlighter-rouge">// NOLINT(foo/bar)</code> syntax to disable a warning.</li>
185185
</ul>
186186
</li>
187-
<li>Python: See the pycodestyle manual at
188-
<a href="http://pycodestyle.readthedocs.io/en/latest/intro.html">http://pycodestyle.readthedocs.io/en/latest/intro.html</a>.
187+
<li>Python:
189188
<ul>
189+
<li>When the call to <code class="language-plaintext highlighter-rouge">add_lint_tests()</code> has <code class="language-plaintext highlighter-rouge">use_ruff = True</code>, we use <code class="language-plaintext highlighter-rouge">ruff</code> as
190+
the linter. Drake uses both <code class="language-plaintext highlighter-rouge">check</code> mode along with <code class="language-plaintext highlighter-rouge">format --check</code> mode.
191+
See the ruff manual at
192+
<a href="https://docs.astral.sh/ruff/linter/#error-suppression">https://docs.astral.sh/ruff/linter/#error-suppression</a>
193+
and
194+
<a href="https://docs.astral.sh/ruff/formatter/#format-suppression">https://docs.astral.sh/ruff/formatter/#format-suppression</a>.</li>
195+
<li>Otherwise, we use <code class="language-plaintext highlighter-rouge">pycodestyle</code>. See the pycodestyle manual at
196+
<a href="http://pycodestyle.readthedocs.io/en/latest/intro.html">http://pycodestyle.readthedocs.io/en/latest/intro.html</a>.</li>
190197
<li>The syntax <code class="language-plaintext highlighter-rouge"># noqa</code> can be used to quiet the warning about an overly-long
191198
line.</li>
192199
</ul>
@@ -222,6 +229,14 @@ <h3 id="ide-integration">IDE integration</h3>
222229
<li><a href="/vscode.html#c-code-formatting">VS Code</a></li>
223230
</ul>
224231

232+
<h2 id="python-ruff-format">Python: Ruff Format</h2>
233+
234+
<p>To run <code class="language-plaintext highlighter-rouge">ruff</code> auto-formatter:</p>
235+
236+
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>cd drake
237+
bazel run -- //tools/lint:ruff format path/to/my_file.py
238+
</code></pre></div></div>
239+
225240
</article>
226241
</div>
227242
</section>

from_source.html

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,23 @@ <h2 id="drake-specific-cmake-options">Drake-specific CMake Options</h2>
317317
<p>Drake also defines a number of CMake options to control different facets of
318318
the build.</p>
319319

320+
<p>Adjusting installation:</p>
321+
322+
<ul>
323+
<li><code class="language-plaintext highlighter-rouge">DRAKE_INSTALL_JAVA</code> (default <code class="language-plaintext highlighter-rouge">ON</code>). When <code class="language-plaintext highlighter-rouge">OFF</code>, does not install Java-based
324+
tools (currently only the Java lcmtypes). Setting to <code class="language-plaintext highlighter-rouge">OFF</code> might be helpful to
325+
avoid depending on a JDK during the build.</li>
326+
<li><code class="language-plaintext highlighter-rouge">DRAKE_INSTALL_PYTHON</code> (default <code class="language-plaintext highlighter-rouge">ON</code>). When <code class="language-plaintext highlighter-rouge">OFF</code>, does not install
327+
Python-based tools (<code class="language-plaintext highlighter-rouge">pydrake</code>, <code class="language-plaintext highlighter-rouge">pybind11</code> headers, tutorials, and Python
328+
lcmtypes). Setting to <code class="language-plaintext highlighter-rouge">OFF</code> might be helpful to avoid spending time compiling
329+
code that’s not needed.
330+
<ul>
331+
<li>Note that regardless of the <code class="language-plaintext highlighter-rouge">DRAKE_INSTALL_PYTHON</code> option, a working Python
332+
interpreter is still required to build Drake.</li>
333+
</ul>
334+
</li>
335+
</ul>
336+
320337
<p>Adjusting open-source dependencies:</p>
321338

322339
<ul>
@@ -378,9 +395,6 @@ <h2 id="drake-specific-cmake-options">Drake-specific CMake Options</h2>
378395
<li><code class="language-plaintext highlighter-rouge">WITH_LCM_RUNTIME</code> (default <code class="language-plaintext highlighter-rouge">ON</code>). When <code class="language-plaintext highlighter-rouge">OFF</code>, the LGPL-licensed LCM runtime
379396
library will be not installed alongside Drake. See <code class="language-plaintext highlighter-rouge">DrakeLcm::available()</code> to
380397
retrieve this setting at runtime.</li>
381-
<li><code class="language-plaintext highlighter-rouge">DRAKE_INSTALL_JAVA</code> (default <code class="language-plaintext highlighter-rouge">ON</code>). When <code class="language-plaintext highlighter-rouge">OFF</code>, does not install Java-based
382-
tools (currently only the Java lcmtypes). Setting to <code class="language-plaintext highlighter-rouge">OFF</code> might be helpful to
383-
avoid depending on a JDK during the build.</li>
384398
</ul>
385399

386400
<p>Adjusting closed-source (commercial) software dependencies:</p>

0 commit comments

Comments
 (0)