Skip to content

Update to the 2024 style edition #1014

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

Merged
merged 1 commit into from
Mar 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 3 additions & 1 deletion flowey/flowey_cli/src/cli/debug/dump_stage0_dag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ impl DumpStage0Dag {
let Some(patchfn) =
flowey_core::patch::patchfn_by_modpath().get(patchfn_name.as_str())
else {
anyhow::bail!("could not find patch with name '{patchfn_name}'. Was it registered with `flowey_core::node::register_patch!`?")
anyhow::bail!(
"could not find patch with name '{patchfn_name}'. Was it registered with `flowey_core::node::register_patch!`?"
)
};
patch_aggregator.apply_patchfn(*patchfn);
}
Expand Down
8 changes: 4 additions & 4 deletions flowey/flowey_cli/src/cli/debug/interrogate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
// Licensed under the MIT License.

use crate::cli::FlowBackendCli;
use flowey_core::node::steps::rust::RustRuntimeServices;
use flowey_core::node::user_facing::ClaimedGhParam;
use flowey_core::node::user_facing::GhPermission;
use flowey_core::node::user_facing::GhPermissionValue;
use flowey_core::node::FlowArch;
use flowey_core::node::FlowBackend;
use flowey_core::node::FlowPlatform;
use flowey_core::node::GhVarState;
use flowey_core::node::NodeHandle;
use flowey_core::node::steps::rust::RustRuntimeServices;
use flowey_core::node::user_facing::ClaimedGhParam;
use flowey_core::node::user_facing::GhPermission;
use flowey_core::node::user_facing::GhPermissionValue;
use flowey_core::pipeline::HostExt;
use flowey_core::pipeline::PipelineBackendHint;
use std::collections::BTreeMap;
Expand Down
8 changes: 4 additions & 4 deletions flowey/flowey_cli/src/cli/exec_snippet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@

use crate::cli::FlowBackendCli;
use anyhow::Context;
use flowey_core::node::steps::rust::RustRuntimeServices;
use flowey_core::node::user_facing::ClaimedGhParam;
use flowey_core::node::user_facing::GhPermission;
use flowey_core::node::user_facing::GhPermissionValue;
use flowey_core::node::FlowArch;
use flowey_core::node::FlowBackend;
use flowey_core::node::FlowPlatform;
use flowey_core::node::GhVarState;
use flowey_core::node::NodeHandle;
use flowey_core::node::steps::rust::RustRuntimeServices;
use flowey_core::node::user_facing::ClaimedGhParam;
use flowey_core::node::user_facing::GhPermission;
use flowey_core::node::user_facing::GhPermissionValue;
use flowey_core::pipeline::HostExt;
use flowey_core::pipeline::PipelineBackendHint;
use serde::Deserialize;
Expand Down
14 changes: 8 additions & 6 deletions flowey/flowey_cli/src/flow_resolver/stage1_dag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
// Licensed under the MIT License.

use anyhow::Context;
use flowey_core::node::read_var_internals;
use flowey_core::node::steps::rust::RustRuntimeServices;
use flowey_core::node::user_facing::ClaimedGhParam;
use flowey_core::node::user_facing::GhPermission;
use flowey_core::node::user_facing::GhPermissionValue;
use flowey_core::node::FlowArch;
use flowey_core::node::FlowBackend;
use flowey_core::node::FlowPlatform;
use flowey_core::node::GhVarState;
use flowey_core::node::NodeHandle;
use flowey_core::node::read_var_internals;
use flowey_core::node::steps::rust::RustRuntimeServices;
use flowey_core::node::user_facing::ClaimedGhParam;
use flowey_core::node::user_facing::GhPermission;
use flowey_core::node::user_facing::GhPermissionValue;
use parking_lot::Mutex;
use std::collections::BTreeMap;
use std::collections::BTreeSet;
Expand Down Expand Up @@ -534,7 +534,9 @@ pub(crate) fn stage1_dag(
output_graph[idx].1.as_ref().unwrap().step.label()
);
}
log::error!("found buggy node that emitted unreachable steps! use `--viz-mode flow-dot` to debug");
log::error!(
"found buggy node that emitted unreachable steps! use `--viz-mode flow-dot` to debug"
);
Some(FoundUnreachableNodes)
} else {
None
Expand Down
6 changes: 4 additions & 2 deletions flowey/flowey_cli/src/pipeline_resolver/ado_yaml.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

use super::common_yaml::FloweySource;
use super::common_yaml::check_generated_yaml_and_json;
use super::common_yaml::job_flowey_bootstrap_source;
use super::common_yaml::write_generated_yaml_and_json;
use super::common_yaml::FloweySource;
use super::generic::ResolvedJobArtifact;
use super::generic::ResolvedJobUseParameter;
use crate::cli::exec_snippet::FloweyPipelineStaticDb;
Expand Down Expand Up @@ -127,7 +127,9 @@ pub fn ado_yaml(
let _ = (artifact, publish);

if ado_bootstrap_template.is_empty() {
anyhow::bail!("Did not specify flowey bootstrap template. Please provide one using `Pipeline::ado_set_flowey_bootstrap_template`")
anyhow::bail!(
"Did not specify flowey bootstrap template. Please provide one using `Pipeline::ado_set_flowey_bootstrap_template`"
)
}

let ado_bootstrap_template = ado_bootstrap_template
Expand Down
12 changes: 9 additions & 3 deletions flowey/flowey_cli/src/pipeline_resolver/direct_run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ use crate::pipeline_resolver::generic::ResolvedJobArtifact;
use crate::pipeline_resolver::generic::ResolvedJobUseParameter;
use crate::pipeline_resolver::generic::ResolvedPipeline;
use crate::pipeline_resolver::generic::ResolvedPipelineJob;
use flowey_core::node::steps::rust::RustRuntimeServices;
use flowey_core::node::FlowArch;
use flowey_core::node::FlowBackend;
use flowey_core::node::FlowPlatform;
use flowey_core::node::NodeHandle;
use flowey_core::node::RuntimeVarDb;
use flowey_core::node::steps::rust::RustRuntimeServices;
use flowey_core::pipeline::internal::Parameter;
use petgraph::prelude::NodeIndex;
use petgraph::visit::EdgeRef;
Expand Down Expand Up @@ -198,10 +198,16 @@ fn direct_run_do_work(
Step::Anchor { .. } => continue,
Step::Rust { label, code, idx } => (label, code, idx),
Step::AdoYaml { .. } => {
anyhow::bail!("{} emitted ADO YAML. Fix the node by checking `ctx.backend()` appropriately", node_handle.modpath())
anyhow::bail!(
"{} emitted ADO YAML. Fix the node by checking `ctx.backend()` appropriately",
node_handle.modpath()
)
}
Step::GitHubYaml { .. } => {
anyhow::bail!("{} emitted GitHub YAML. Fix the node by checking `ctx.backend()` appropriately", node_handle.modpath())
anyhow::bail!(
"{} emitted GitHub YAML. Fix the node by checking `ctx.backend()` appropriately",
node_handle.modpath()
)
}
};
steps.push((idx, label, code.lock().take().unwrap()));
Expand Down
18 changes: 9 additions & 9 deletions flowey/flowey_cli/src/pipeline_resolver/generic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,12 @@
// Licensed under the MIT License.

use anyhow::Context;
use flowey_core::node::user_facing::GhPermission;
use flowey_core::node::user_facing::GhPermissionValue;
use flowey_core::node::FlowArch;
use flowey_core::node::FlowPlatform;
use flowey_core::node::NodeHandle;
use flowey_core::node::user_facing::GhPermission;
use flowey_core::node::user_facing::GhPermissionValue;
use flowey_core::patch::ResolvedPatches;
use flowey_core::pipeline::internal::AdoPool;
use flowey_core::pipeline::internal::ArtifactMeta;
use flowey_core::pipeline::internal::InternalAdoResourcesRepository;
use flowey_core::pipeline::internal::Parameter;
use flowey_core::pipeline::internal::ParameterMeta;
use flowey_core::pipeline::internal::PipelineFinalized;
use flowey_core::pipeline::internal::PipelineJobMetadata;
use flowey_core::pipeline::AdoCiTriggers;
use flowey_core::pipeline::AdoPrTriggers;
use flowey_core::pipeline::AdoScheduleTriggers;
Expand All @@ -23,6 +16,13 @@ use flowey_core::pipeline::GhPrTriggers;
use flowey_core::pipeline::GhRunner;
use flowey_core::pipeline::GhScheduleTriggers;
use flowey_core::pipeline::Pipeline;
use flowey_core::pipeline::internal::AdoPool;
use flowey_core::pipeline::internal::ArtifactMeta;
use flowey_core::pipeline::internal::InternalAdoResourcesRepository;
use flowey_core::pipeline::internal::Parameter;
use flowey_core::pipeline::internal::ParameterMeta;
use flowey_core::pipeline::internal::PipelineFinalized;
use flowey_core::pipeline::internal::PipelineJobMetadata;
use std::collections::BTreeMap;
use std::collections::BTreeSet;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
#![allow(unused)]

use flowey_core::pipeline::GhRunner;
use serde::ser::SerializeMap;
use serde::ser::SerializeSeq;
use serde::Deserialize;
use serde::Serialize;
use serde::Serializer;
use serde::ser::SerializeMap;
use serde::ser::SerializeSeq;
use std::collections::BTreeMap;

/// Valid names may only contain alphanumeric characters and '_' and may not
Expand Down
10 changes: 6 additions & 4 deletions flowey/flowey_cli/src/pipeline_resolver/github_yaml/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ use crate::cli::exec_snippet::VAR_DB_SEEDVAR_FLOWEY_WORKING_DIR;
use crate::cli::pipeline::CheckMode;
use crate::flow_resolver::stage1_dag::OutputGraphEntry;
use crate::flow_resolver::stage1_dag::Step;
use crate::pipeline_resolver::common_yaml::job_flowey_bootstrap_source;
use crate::pipeline_resolver::common_yaml::FloweySource;
use crate::pipeline_resolver::common_yaml::job_flowey_bootstrap_source;
use crate::pipeline_resolver::generic::ResolvedPipeline;
use crate::pipeline_resolver::generic::ResolvedPipelineJob;
use anyhow::Context;
use flowey_core::node::user_facing::GhPermission;
use flowey_core::node::user_facing::GhPermissionValue;
use flowey_core::node::FlowArch;
use flowey_core::node::FlowBackend;
use flowey_core::node::FlowPlatform;
use flowey_core::node::FlowPlatformKind;
use flowey_core::node::NodeHandle;
use flowey_core::node::user_facing::GhPermission;
use flowey_core::node::user_facing::GhPermissionValue;
use flowey_core::pipeline::GhRunner;
use flowey_core::pipeline::GhRunnerOsLabel;
use std::collections::BTreeMap;
Expand Down Expand Up @@ -127,7 +127,9 @@ pub fn github_yaml(
// actual artifact publish happens at the end of the job
if let FloweySource::Bootstrap(_artifact, _publish) = &flowey_source {
if gh_bootstrap_template.is_empty() {
anyhow::bail!("Did not specify flowey bootstrap template. Please provide one using `Pipeline::gh_set_flowey_bootstrap_template`")
anyhow::bail!(
"Did not specify flowey bootstrap template. Please provide one using `Pipeline::gh_set_flowey_bootstrap_template`"
)
}

let gh_bootstrap_template = gh_bootstrap_template
Expand Down
10 changes: 5 additions & 5 deletions flowey/flowey_cli/src/pipeline_resolver/viz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,17 +347,17 @@ pub fn viz_flow_dot(

impl std::fmt::Debug for VizNode {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
if self.0 .1.is_none() {
return write!(f, "{:?} - ???", self.0 .0);
if self.0.1.is_none() {
return write!(f, "{:?} - ???", self.0.0);
}

let entry = &self.0 .1.as_ref().unwrap();
let entry = &self.0.1.as_ref().unwrap();

write!(
f,
"{}:{}\n\n{}",
self.0 .0.step_idx,
self.0 .0.node.modpath(),
self.0.0.step_idx,
self.0.0.node.modpath(),
match &entry.step {
crate::flow_resolver::stage1_dag::Step::Anchor { label } => {
format!("<anchor:{label}>")
Expand Down
32 changes: 14 additions & 18 deletions flowey/flowey_core/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ use self::user_facing::GhPermission;
use self::user_facing::GhPermissionValue;
use crate::node::github_context::GhContextVarReader;
use github_context::state::Root;
use serde::de::DeserializeOwned;
use serde::Deserialize;
use serde::Serialize;
use serde::de::DeserializeOwned;
use std::cell::RefCell;
use std::collections::BTreeMap;
use std::path::PathBuf;
Expand All @@ -29,14 +29,6 @@ use user_facing::GhParam;
/// Node types which are considered "user facing", and re-exported in the
/// `flowey` crate.
pub mod user_facing {
pub use super::steps::ado::AdoResourcesRepositoryId;
pub use super::steps::ado::AdoRuntimeVar;
pub use super::steps::ado::AdoStepServices;
pub use super::steps::github::ClaimedGhParam;
pub use super::steps::github::GhParam;
pub use super::steps::github::GhPermission;
pub use super::steps::github::GhPermissionValue;
pub use super::steps::rust::RustRuntimeServices;
pub use super::ClaimVar;
pub use super::ClaimedReadVar;
pub use super::ClaimedWriteVar;
Expand All @@ -57,6 +49,14 @@ pub mod user_facing {
pub use super::VarEqBacking;
pub use super::VarNotClaimed;
pub use super::WriteVar;
pub use super::steps::ado::AdoResourcesRepositoryId;
pub use super::steps::ado::AdoRuntimeVar;
pub use super::steps::ado::AdoStepServices;
pub use super::steps::github::ClaimedGhParam;
pub use super::steps::github::GhParam;
pub use super::steps::github::GhPermission;
pub use super::steps::github::GhPermissionValue;
pub use super::steps::rust::RustRuntimeServices;
pub use crate::flowey_request;
pub use crate::new_flow_node;
pub use crate::new_simple_flow_node;
Expand Down Expand Up @@ -781,11 +781,7 @@ impl FlowPlatform {

/// The suffix to use for executables on this platform.
pub fn exe_suffix(&self) -> &'static str {
if self == &Self::Windows {
".exe"
} else {
""
}
if self == &Self::Windows { ".exe" } else { "" }
}

/// The full name for a binary on this platform (i.e. `name + self.exe_suffix()`).
Expand Down Expand Up @@ -1855,8 +1851,8 @@ pub mod steps {
use crate::node::FlowBackend;
use crate::node::FlowPlatform;
use crate::node::RuntimeVarDb;
use serde::de::DeserializeOwned;
use serde::Serialize;
use serde::de::DeserializeOwned;

pub fn new_rust_runtime_services(
runtime_var_db: &mut dyn RuntimeVarDb,
Expand Down Expand Up @@ -1989,9 +1985,9 @@ pub trait FlowNodeBase {
}

pub mod erased {
use crate::node::user_facing::*;
use crate::node::FlowNodeBase;
use crate::node::NodeCtx;
use crate::node::user_facing::*;

pub struct ErasedNode<N: FlowNodeBase>(pub N);

Expand Down Expand Up @@ -2134,8 +2130,8 @@ mod node_luts {
lookup
}

pub(super) fn erased_node_by_typeid(
) -> &'static HashMap<NodeHandle, fn() -> Box<dyn FlowNodeBase<Request = Box<[u8]>>>> {
pub(super) fn erased_node_by_typeid()
-> &'static HashMap<NodeHandle, fn() -> Box<dyn FlowNodeBase<Request = Box<[u8]>>>> {
static LOOKUP: OnceLock<
HashMap<NodeHandle, fn() -> Box<dyn FlowNodeBase<Request = Box<[u8]>>>>,
> = OnceLock::new();
Expand Down
4 changes: 2 additions & 2 deletions flowey/flowey_core/src/node/github_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@

//! Core types and traits used to read GitHub context variables.

use crate::node::spec::GhContextVarReaderEventPullRequest;
use crate::node::ClaimVar;
use crate::node::GhUserSecretVar;
use crate::node::NodeCtx;
use crate::node::ReadVar;
use crate::node::StepCtx;
use serde::de::DeserializeOwned;
use crate::node::spec::GhContextVarReaderEventPullRequest;
use serde::Serialize;
use serde::de::DeserializeOwned;
use std::collections::BTreeMap;

pub mod state {
Expand Down
10 changes: 5 additions & 5 deletions flowey/flowey_core/src/pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
//! Core types and traits used to create and work with flowey pipelines.

use self::internal::*;
use crate::node::steps::ado::AdoResourcesRepositoryId;
use crate::node::user_facing::AdoRuntimeVar;
use crate::node::user_facing::GhPermission;
use crate::node::user_facing::GhPermissionValue;
use crate::node::FlowArch;
use crate::node::FlowNodeBase;
use crate::node::FlowPlatform;
Expand All @@ -17,10 +13,14 @@ use crate::node::IntoRequest;
use crate::node::NodeHandle;
use crate::node::ReadVar;
use crate::node::WriteVar;
use crate::node::steps::ado::AdoResourcesRepositoryId;
use crate::node::user_facing::AdoRuntimeVar;
use crate::node::user_facing::GhPermission;
use crate::node::user_facing::GhPermissionValue;
use crate::patch::PatchResolver;
use crate::patch::ResolvedPatches;
use serde::de::DeserializeOwned;
use serde::Serialize;
use serde::de::DeserializeOwned;
use std::collections::BTreeMap;
use std::collections::BTreeSet;
use std::path::PathBuf;
Expand Down
12 changes: 9 additions & 3 deletions flowey/flowey_hvlite/src/pipelines/build_igvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,17 @@ pub fn bail_if_running_in_ci() -> anyhow::Result<()> {
log::warn!("Detected that {ci_env} is set");
log::warn!("");
log::warn!("Do not use `build-igvm` in CI scripts!");
log::warn!("This is a local-only, inner-dev-loop tool to build IGVM files, with an UNSTABLE CLI.");
log::warn!(
"This is a local-only, inner-dev-loop tool to build IGVM files, with an UNSTABLE CLI."
);
log::warn!("");
log::warn!("Automated pipelines should use the underlying `flowey` nodes that power build-igvm directly, _without_ relying on its CLI!");
log::warn!(
"Automated pipelines should use the underlying `flowey` nodes that power build-igvm directly, _without_ relying on its CLI!"
);
log::warn!("");
log::warn!("If you _really_ know what you're doing, you can set {OVERRIDE_ENV} to disable this error.");
log::warn!(
"If you _really_ know what you're doing, you can set {OVERRIDE_ENV} to disable this error."
);
anyhow::bail!("attempted to run `build-igvm` in CI")
}
}
Expand Down
Loading