-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
standardize graph output indentation with 2 spaces #8007
standardize graph output indentation with 2 spaces #8007
Conversation
Nice catch! And thanks for such a thorough analysis. I'd stick with two spaces, which fits closer to style guide recommendations although I acknowledge this isn't Starlark. I think of Bazel as a space-oriented system in general. |
9dfdef4
to
a1e69f1
Compare
@gregestren thanks a lot for the review. I rebased master due to merge conflicts and switched to 2 spaces in 9eb7b6d let me know if there are other concerns. |
a1e69f1
to
9eb7b6d
Compare
One more quick request before we merge: could you update the PR description to mention that you're using spaces now and maybe throw out an "after" example at the end of what it the sample output looks like with your change? |
sure let me do that real quick |
@gregestren updated the PR description and posted after result |
Thank you! |
Just FYI I'm trying to merge this but running into a silly complication with the merge / export script. Need a bit of patience! |
no problem and no rush. let me know if there's any way i could help. |
Update: still working through this. We still have a few query tests inside Google that haven't yet been exported to GitHub (I'm not aware of any reason why they couldn't be, so consider that a TODO). They embed expectations about the spacing which I think are just test brittleness, nothing wrong with what you're doing. But they highlight the possibility that people have tools/scripts that depend on the current formatting. My current position is to still push this forward and if we find such cases then ask people to update their scripts. I don't believe this formatting is a guarantee of the Bazel user contract. |
Thanks a lot! |
Currently, when outputting graphs from Bazel with `bazel query --output=graph`, the indentations for different types of lines are inconsistent: - `node` is indented with 2 spaces - edges and vertices are not indented - labels are indented with 1 space Example using [rules_go](https://github.com/bazelbuild/rules_go): ``` $ bazel query "deps(//gg/platform:darwin)" --output=graph digraph mygraph { node [shape=box]; "//gg/platform:darwin" "//gg/platform:darwin" -> "//gg/toolchain:darwin" "//gg/toolchain:darwin" "//gg/toolchain:darwin" -> "@bazel_tools//platforms:osx" "@bazel_tools//platforms:osx" "@bazel_tools//platforms:osx" -> "@bazel_tools//platforms:os" "@bazel_tools//platforms:os" } Loading: 0 packages loaded ``` It would be nice for the indentations to be present (for edges and vertices), and consistent. As for the indentation scheme, it seems inconclusive as to which type the language prefers: - the [DOT Language Spec](https://www.graphviz.org/doc/info/lang.html) does not really specify tabs or spaces, but the examples used either contained no indentation (!) or one with 2 spaces - the official [examples](https://www.graphviz.org/gallery/) contain samples of no indentation, tabs, or 2 spaces, with tabs being most popular - the [Wikipedia page](https://en.wikipedia.org/wiki/DOT_(graph_description_language)) uses tabs I'm using 2 spaces to conform with skylark. This is the result from the same query with this PR: ```plaintext $ /Users/ricky/workspace/bazel/bazel-bin/src/bazel query "deps(//gg/platform:darwin)" --output=graph Starting local Bazel server and connecting to it... DEBUG: /private/var/tmp/_bazel_ricky/5c63e3be3c60ec773878bdf16f25adcc/external/bazel_toolchains/rules/version_check.bzl:45:9: Current running Bazel is not a release version and one was not defined explicitly in rbe_autoconfig target. Falling back to '0.23.0' digraph mygraph { node [shape=box]; "//gg/platform:darwin" "//gg/platform:darwin" -> "//gg/toolchain:darwin" "//gg/toolchain:darwin" "//gg/toolchain:darwin" -> "@bazel_tools//platforms:osx" "@bazel_tools//platforms:osx" "@bazel_tools//platforms:osx" -> "@bazel_tools//platforms:os" "@bazel_tools//platforms:os" } Loading: 3 packages loaded ``` Closes bazelbuild#8007. PiperOrigin-RevId: 251296052
Currently, when outputting graphs from Bazel with `bazel query --output=graph`, the indentations for different types of lines are inconsistent: - `node` is indented with 2 spaces - edges and vertices are not indented - labels are indented with 1 space Example using [rules_go](https://github.com/bazelbuild/rules_go): ``` $ bazel query "deps(//gg/platform:darwin)" --output=graph digraph mygraph { node [shape=box]; "//gg/platform:darwin" "//gg/platform:darwin" -> "//gg/toolchain:darwin" "//gg/toolchain:darwin" "//gg/toolchain:darwin" -> "@bazel_tools//platforms:osx" "@bazel_tools//platforms:osx" "@bazel_tools//platforms:osx" -> "@bazel_tools//platforms:os" "@bazel_tools//platforms:os" } Loading: 0 packages loaded ``` It would be nice for the indentations to be present (for edges and vertices), and consistent. As for the indentation scheme, it seems inconclusive as to which type the language prefers: - the [DOT Language Spec](https://www.graphviz.org/doc/info/lang.html) does not really specify tabs or spaces, but the examples used either contained no indentation (!) or one with 2 spaces - the official [examples](https://www.graphviz.org/gallery/) contain samples of no indentation, tabs, or 2 spaces, with tabs being most popular - the [Wikipedia page](https://en.wikipedia.org/wiki/DOT_(graph_description_language)) uses tabs I'm using 2 spaces to conform with skylark. This is the result from the same query with this PR: ```plaintext $ /Users/ricky/workspace/bazel/bazel-bin/src/bazel query "deps(//gg/platform:darwin)" --output=graph Starting local Bazel server and connecting to it... DEBUG: /private/var/tmp/_bazel_ricky/5c63e3be3c60ec773878bdf16f25adcc/external/bazel_toolchains/rules/version_check.bzl:45:9: Current running Bazel is not a release version and one was not defined explicitly in rbe_autoconfig target. Falling back to '0.23.0' digraph mygraph { node [shape=box]; "//gg/platform:darwin" "//gg/platform:darwin" -> "//gg/toolchain:darwin" "//gg/toolchain:darwin" "//gg/toolchain:darwin" -> "@bazel_tools//platforms:osx" "@bazel_tools//platforms:osx" "@bazel_tools//platforms:osx" -> "@bazel_tools//platforms:os" "@bazel_tools//platforms:os" } Loading: 3 packages loaded ``` Closes bazelbuild#8007. PiperOrigin-RevId: 251296052
Currently, when outputting graphs from Bazel with
bazel query --output=graph
, the indentations for different types of lines are inconsistent:node
is indented with 2 spacesExample using rules_go:
It would be nice for the indentations to be present (for edges and vertices), and consistent.
As for the indentation scheme, it seems inconclusive as to which type the language prefers:
I'm using 2 spaces to conform with skylark. This is the result from the same query with this PR: