-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(xtask): Added 'buf' xtask subcommand
This subcommand checks that you have the tool `buf` installed, and then uses it to lint against our protobuf definition files. This is intended to make it easier to lint these definitions in the future. Signed-off-by: Andrew Lilley Brinker <[email protected]>
- Loading branch information
1 parent
32ae9d0
commit b49ef7b
Showing
4 changed files
with
24 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
version: v2 | ||
lint: | ||
use: | ||
- DEFAULT | ||
- STANDARD | ||
rpc_allow_same_request_response: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
use crate::workspace; | ||
use anyhow::{Context, Result}; | ||
use pathbuf::pathbuf; | ||
use which::which; | ||
use xshell::{cmd, Shell}; | ||
|
||
/// Run the `buf lint` command | ||
pub fn run() -> Result<()> { | ||
let sh = Shell::new().context("could not init shell")?; | ||
which("buf").context("could not find 'buf'")?; | ||
|
||
let root = workspace::root()?; | ||
let config = pathbuf![&root, ".buf.yaml"]; | ||
let target = pathbuf![&root, "hipcheck", "proto"]; | ||
|
||
cmd!(sh, "buf lint --config {config} {target}").run()?; | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
|
||
//! Commands supported by 'xtask' | ||
|
||
pub mod buf; | ||
pub mod changelog; | ||
pub mod check; | ||
pub mod ci; | ||
|