mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Run clippy for graphviz target in CI and add instructions on how to consume the output.
This commit is contained in:
parent
b5b7de9532
commit
b5ae6227c0
@ -6,7 +6,7 @@ code-quality:
|
|||||||
script:
|
script:
|
||||||
- ln -s /dockercache/target target
|
- ln -s /dockercache/target target
|
||||||
- rm -r target/debug/incremental/* || echo "all good" # TMP FIX FOR 2021-03-22-nightly
|
- rm -r target/debug/incremental/* || echo "all good" # TMP FIX FOR 2021-03-22-nightly
|
||||||
- cargo clippy --all-targets --locked --features="bin_csv,bin_bot,asset_tweak" -- -D warnings
|
- cargo clippy --all-targets --locked --features="bin_csv,bin_graphviz,bin_bot,asset_tweak" -- -D warnings
|
||||||
- cargo fmt --all -- --check
|
- cargo fmt --all -- --check
|
||||||
|
|
||||||
security:
|
security:
|
||||||
|
@ -15,10 +15,9 @@ fn main() {
|
|||||||
let mut graph = Graph::new();
|
let mut graph = Graph::new();
|
||||||
let mut nodes = HashMap::new();
|
let mut nodes = HashMap::new();
|
||||||
let mut add_node = |graph: &mut Graph<_, _>, node: &str| {
|
let mut add_node = |graph: &mut Graph<_, _>, node: &str| {
|
||||||
nodes
|
*nodes
|
||||||
.entry(node.to_owned())
|
.entry(node.to_owned())
|
||||||
.or_insert_with(|| graph.add_node(node.to_owned()))
|
.or_insert_with(|| graph.add_node(node.to_owned()))
|
||||||
.clone()
|
|
||||||
};
|
};
|
||||||
for (_, recipe) in recipes.iter() {
|
for (_, recipe) in recipes.iter() {
|
||||||
let output = recipe.output.0.item_definition_id();
|
let output = recipe.output.0.item_definition_id();
|
||||||
@ -40,6 +39,8 @@ fn main() {
|
|||||||
graph.add_edge(in_node, out_node, ());
|
graph.add_edge(in_node, out_node, ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// you can render the dot file as a png with `dot -Tpng recipe_graph.dot >
|
||||||
|
// recipe_graph.png` or interactively view it with `xdot recipe_graph.dot`
|
||||||
let mut f = File::create("recipe_graph.dot").unwrap();
|
let mut f = File::create("recipe_graph.dot").unwrap();
|
||||||
writeln!(f, "digraph {{").unwrap();
|
writeln!(f, "digraph {{").unwrap();
|
||||||
writeln!(f, "rankdir = \"LR\"").unwrap();
|
writeln!(f, "rankdir = \"LR\"").unwrap();
|
||||||
|
Loading…
Reference in New Issue
Block a user