summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSantiago Pastorino <spastorino@gmail.com>2019-10-03 18:16:07 -0300
committerSantiago Pastorino <spastorino@gmail.com>2019-10-03 18:16:07 -0300
commit0915f3ad24936a53a15f235b0ca27de4741e6578 (patch)
tree13da231e8b0122efa0bba721ec5f9cf413fefd84
parent3be7654fe4eb607cdd8e072de3053132d0732899 (diff)
Add Marker teams setup
-rw-r--r--rust_team_data/src/v1.rs3
-rw-r--r--src/schema.rs8
-rw-r--r--src/static_api.rs2
-rw-r--r--src/validate.rs14
4 files changed, 26 insertions, 1 deletions
diff --git a/rust_team_data/src/v1.rs b/rust_team_data/src/v1.rs
index e970d0d..91a92c8 100644
--- a/rust_team_data/src/v1.rs
+++ b/rust_team_data/src/v1.rs
@@ -8,6 +8,9 @@ pub static BASE_URL: &str = "https://team-api.infra.rust-lang.org/v1";
pub enum TeamKind {
Team,
WorkingGroup,
+ MarkerTeam,
+ #[serde(other)]
+ Unknown,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
diff --git a/src/schema.rs b/src/schema.rs
index 0a25332..aa4bb60 100644
--- a/src/schema.rs
+++ b/src/schema.rs
@@ -109,6 +109,8 @@ pub(crate) struct Team {
name: String,
#[serde(default = "default_false")]
wg: bool,
+ #[serde(default = "default_false")]
+ marker_team: bool,
subteam_of: Option<String>,
people: TeamPeople,
#[serde(default)]
@@ -129,6 +131,10 @@ impl Team {
self.wg
}
+ pub(crate) fn is_marker_team(&self) -> bool {
+ self.marker_team
+ }
+
pub(crate) fn subteam_of(&self) -> Option<&str> {
self.subteam_of.as_ref().map(|s| s.as_str())
}
@@ -160,7 +166,7 @@ impl Team {
}
if self.people.include_all_team_members {
for team in data.teams() {
- if team.is_wg() || team.name == self.name {
+ if team.is_wg() || team.is_marker_team() || team.name == self.name {
continue;
}
for member in team.members(data)? {
diff --git a/src/static_api.rs b/src/static_api.rs
index d360927..d424d9b 100644
--- a/src/static_api.rs
+++ b/src/static_api.rs
@@ -55,6 +55,8 @@ impl<'a> Generator<'a> {
name: team.name().into(),
kind: if team.is_wg() {
v1::TeamKind::WorkingGroup
+ } else if team.is_marker_team() {
+ v1::TeamKind::MarkerTeam
} else {
v1::TeamKind::Team
},
diff --git a/src/validate.rs b/src/validate.rs
index c6e2657..0ef2e40 100644
--- a/src/validate.rs
+++ b/src/validate.rs
@@ -24,6 +24,7 @@ static CHECKS: &[fn(&Data, &mut Vec<String>)] = &[
validate_rfcbot_exclude_members,
validate_team_names,
validate_github_teams,
+ validate_marker_team,
];
static GITHUB_CHECKS: &[fn(&Data, &GitHubApi, &mut Vec<String>)] = &[validate_github_usernames];
@@ -432,6 +433,19 @@ fn validate_github_usernames(data: &Data, github: &GitHubApi, errors: &mut Vec<S
}
}
+/// Ensure teams are not working group and marker team at the same time
+fn validate_marker_team(data: &Data, errors: &mut Vec<String>) {
+ wrapper(data.teams(), errors, |team, _| {
+ if team.is_wg() && team.is_marker_team() {
+ bail!(
+ "`{}` is a working group and marker team at the same time",
+ team.name()
+ );
+ }
+ Ok(())
+ });
+}
+
fn wrapper<T, I, F>(iter: I, errors: &mut Vec<String>, mut func: F)
where
I: Iterator<Item = T>,