martin-g commented on code in PR #19280:
URL: https://github.com/apache/datafusion/pull/19280#discussion_r2610446866
##########
dev/rust_lint.sh:
##########
@@ -43,9 +43,16 @@ if ! command -v typos &> /dev/null; then
cargo install typos-cli --locked
fi
+# For dependency graph checks
+if ! cargo depgraph --help > /dev/null 2>&1; then
Review Comment:
```suggestion
if ! command -v cargo-depgraph > /dev/null 2>&1; then
```
nit: This is more idiomatic way to check for a binary in the PATH.
##########
docs/scripts/generate_dependency_graph.sh:
##########
@@ -0,0 +1,135 @@
+#!/usr/bin/env bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# See `usage()` for details about this script.
+#
+# The key commands to generate the dependency graph SVG in this script are:
+# cargo depgraph ... | dot -Tsvg > deps.svg
+# See below for the exact command used.
+
+set -euo pipefail
+
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+REPO_DIR="$(cd "${SCRIPT_DIR}/../.." && pwd)"
+OUTPUT_DIR="${REPO_DIR}/docs/source/_static/data"
+DOT_OUTPUT="${OUTPUT_DIR}/deps.dot"
+SVG_OUTPUT="${OUTPUT_DIR}/deps.svg"
+
+usage() {
+ cat <<EOF
+Generate the workspace dependency graph SVG for the docs.
+
+'deps.svg' is embedded in the DataFusion docs (Contributor Guide →
Architecture → Workspace Dependency Graph).
+
+'deps.dot' is the intermediate DOT used to render deps.svg; CI checks it to
ensure the graph is up to date with the codebase.
+
+Outputs:
+ DOT: ${DOT_OUTPUT}
+ SVG: ${SVG_OUTPUT}
+
+Usage: $(basename "$0") [--check]
+
+Options:
+ --check Validate the checked-in graph without modifying files.
+ -h, --help Show this help message.
+EOF
+}
+
+# Default 'generate' mode creates/overrides 'deps.dot' and 'deps.svg', and the
'check'
+# mode verify if the existing 'deps.dot' is up-to-date
+mode="generate"
+while [[ $# -gt 0 ]]; do
+ case "$1" in
+ --check)
+ mode="check"
+ ;;
+ -h|--help)
+ usage
+ exit 0
+ ;;
+ *)
+ echo "Unknown option: $1" >&2
+ usage
+ exit 1
+ ;;
+ esac
+ shift
+done
+
+if ! command -v cargo >/dev/null 2>&1; then
+ echo "cargo is required to build the dependency graph." >&2
+ exit 1
+fi
+
+if ! cargo depgraph --help >/dev/null 2>&1; then
Review Comment:
```suggestion
if ! command -v cargo-depgraph > /dev/null 2>&1; then
```
nit: This is more idiomatic way to check for a binary in the PATH.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]