Add configuration file for Buildifier#1062
Conversation
Add `.buildifier.json` to tell Buildifier that it should not complain about the use of "CcInfo" in our Bazel files. We still use an old version of Bazel, and Buildifier complains about uses of CcInfo with a message like this: ``` native-cc-info: Symbol "CcInfo" is not global anymore and needs to be loaded from "@rules_cc//cc/common:cc_info.bzl". ``` But CcInfo works as expected in Bazel 6.5.0.
There was a problem hiding this comment.
Code Review
This pull request introduces a .buildifier.json configuration file. The reviewer pointed out that the file violates the repository's style guide, which requires a license header for any file longer than two lines. Additionally, the reviewer identified that the configuration key used, warningsList, is incorrect and should be warnings for the tool to recognize it. A suggestion was made to condense the JSON to a single line to comply with the style guide without needing a license header.
| { | ||
| "warningsList": [ | ||
| "-native-cc-info" | ||
| ] | ||
| } |
There was a problem hiding this comment.
The repository style guide (line 116) requires a license header for any file longer than 2 lines. Since standard JSON does not support comments, this file should be condensed to a single line to remain valid while complying with the style guide. Additionally, the configuration key for Buildifier is warnings, not warningsList; using the incorrect key will cause the configuration to be ignored by the tool.
{"warnings": ["-native-cc-info"]}References
- Every source code file longer than 2 lines must begin with a header comment with the copyright and license. (link)
Add
.buildifier.jsonto tell Buildifier that it should not complain about the use ofCcInfoin our Bazel files. We still use an old version of Bazel, and Buildifier complains about uses ofCcInfowith a message like this:But CcInfo works as expected in Bazel 6.5.0.