Skip to content

Commit 11767bd

Browse files
committed
Rename config fields based on review feedback.
1 parent 3fa20a3 commit 11767bd

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

src/config.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,12 @@ pub(crate) struct AssignConfig {
7878
/// If `true`, then posts a warning comment if the PR is opened against a
7979
/// different branch than the default (usually master or main).
8080
#[serde(default)]
81-
pub(crate) non_default_branch: bool,
81+
pub(crate) warn_non_default_branch: bool,
8282
/// A URL to include in the welcome message.
8383
pub(crate) contributing_url: Option<String>,
8484
/// Ad-hoc groups that can be referred to in `owners`.
8585
#[serde(default)]
86-
pub(crate) groups: HashMap<String, Vec<String>>,
86+
pub(crate) adhoc_groups: HashMap<String, Vec<String>>,
8787
/// Users to assign when a new PR is opened.
8888
/// The key is a gitignore-style path, and the value is a list of
8989
/// usernames, team names, or ad-hoc groups.
@@ -367,9 +367,9 @@ mod tests {
367367
allow_unauthenticated: vec!["C-*".into()],
368368
}),
369369
assign: Some(AssignConfig {
370-
non_default_branch: false,
370+
warn_non_default_branch: false,
371371
contributing_url: None,
372-
groups: HashMap::new(),
372+
adhoc_groups: HashMap::new(),
373373
owners: HashMap::new(),
374374
}),
375375
note: Some(NoteConfig { _empty: () }),

src/handlers/assign.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ pub(super) async fn handle_input(
158158

159159
// Compute some warning messages to post to new PRs.
160160
let mut warnings = Vec::new();
161-
if config.non_default_branch {
161+
if config.warn_non_default_branch {
162162
warnings.extend(non_default_branch(event));
163163
}
164164
warnings.extend(modifies_submodule(&input.diff));
@@ -297,7 +297,7 @@ async fn determine_assignee(
297297
}
298298
}
299299

300-
if let Some(fallback) = config.groups.get("fallback") {
300+
if let Some(fallback) = config.adhoc_groups.get("fallback") {
301301
match find_reviewer_from_names(&teams, config, &event.issue, fallback) {
302302
Ok(assignee) => return Ok((Some(assignee), false)),
303303
Err(e) => {
@@ -638,7 +638,7 @@ fn candidate_reviewers_from_names<'a>(
638638
let maybe_group = group_or_user
639639
.strip_prefix(&org_prefix)
640640
.unwrap_or(group_or_user);
641-
if let Some(group_members) = config.groups.get(maybe_group) {
641+
if let Some(group_members) = config.adhoc_groups.get(maybe_group) {
642642
// If a group has already been expanded, don't expand it again.
643643
if seen.insert(maybe_group) {
644644
group_expansion.extend(

src/handlers/assign/tests_candidates.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ fn generic_issue(author: &str, repo: &str) -> serde_json::Value {
7272
fn circular_groups() {
7373
// A cycle in the groups map.
7474
let config = toml::toml!(
75-
[groups]
75+
[adhoc_groups]
7676
compiler = ["other"]
7777
other = ["compiler"]
7878
);
@@ -84,7 +84,7 @@ fn circular_groups() {
8484
fn nested_groups() {
8585
// Test choosing a reviewer from group with nested groups.
8686
let config = toml::toml!(
87-
[groups]
87+
[adhoc_groups]
8888
a = ["@pnkfelix"]
8989
b = ["@nrc"]
9090
c = ["a", "b"]
@@ -97,7 +97,7 @@ fn nested_groups() {
9797
fn candidate_filtered_author_only_candidate() {
9898
// When the author is the only candidate.
9999
let config = toml::toml!(
100-
[groups]
100+
[adhoc_groups]
101101
compiler = ["nikomatsakis"]
102102
);
103103
let issue = generic_issue("nikomatsakis", "rust-lang/rust");
@@ -108,7 +108,7 @@ fn candidate_filtered_author_only_candidate() {
108108
fn candidate_filtered_author() {
109109
// Filter out the author from the candidates.
110110
let config = toml::toml!(
111-
[groups]
111+
[adhoc_groups]
112112
compiler = ["user1", "user2", "user3", "group2"]
113113
group2 = ["user2", "user4"]
114114
);
@@ -126,7 +126,7 @@ fn candidate_filtered_author() {
126126
fn candidate_filtered_assignee() {
127127
// Filter out an existing assignee from the candidates.
128128
let config = toml::toml!(
129-
[groups]
129+
[adhoc_groups]
130130
compiler = ["user1", "user2", "user3", "user4"]
131131
);
132132
let mut issue = generic_issue("user2", "rust-lang/rust");
@@ -145,7 +145,7 @@ fn groups_teams_users() {
145145
team2 = ["t-user2"]
146146
);
147147
let config = toml::toml!(
148-
[groups]
148+
[adhoc_groups]
149149
group1 = ["user1", "rust-lang/team2"]
150150
);
151151
let issue = generic_issue("octocat", "rust-lang/rust");
@@ -163,7 +163,7 @@ fn group_team_user_precedence() {
163163
// How it handles ambiguity when names overlap.
164164
let teams = toml::toml!(compiler = ["t-user1"]);
165165
let config = toml::toml!(
166-
[groups]
166+
[adhoc_groups]
167167
compiler = ["user2"]
168168
);
169169
let issue = generic_issue("octocat", "rust-lang/rust");
@@ -188,7 +188,7 @@ fn what_do_slashes_mean() {
188188
// How slashed names are handled.
189189
let teams = toml::toml!(compiler = ["t-user1"]);
190190
let config = toml::toml!(
191-
[groups]
191+
[adhoc_groups]
192192
compiler = ["user2"]
193193
"foo/bar" = ["foo-user"]
194194
);
@@ -222,7 +222,7 @@ fn what_do_slashes_mean() {
222222
fn invalid_org_doesnt_match() {
223223
let teams = toml::toml!(compiler = ["t-user1"]);
224224
let config = toml::toml!(
225-
[groups]
225+
[adhoc_groups]
226226
compiler = ["user2"]
227227
);
228228
let issue = generic_issue("octocat", "rust-lang/rust");

0 commit comments

Comments
 (0)