implement the shortcut handler#1381
Conversation
|
Now it will also ping the appropriate people by leaving a comment:
|
parser/src/command/shortcut.rs
Outdated
| impl ShortcutCommand { | ||
| pub fn parse<'a>(input: &mut Tokenizer<'a>) -> Result<Option<Self>, Error<'a>> { | ||
| let mut toks = input.clone(); | ||
| if let Some(Token::Word("ready")) = toks.peek_token()? { |
There was a problem hiding this comment.
I'm wondering if we can remove some of this duplicated code. Maybe something like
let shortcuts = [
("ready", ShortcutCommand::Ready),
("author", ShortcutCommand::Author),
];
for (word, command) in shortcuts {
if let Some(Token::Word(word)) = toks.peek_token()? { ... }
}
Ok(None)There was a problem hiding this comment.
By using an Hashmap we can avoid looping at all, while having clear the available options
|
@Llandy3d ok, I'm ready to merge, but it needs a rebase |
|
@nikomatsakis rebased & resolved conflicts |
There was a problem hiding this comment.
Question @Llandy3d -- do we actually check the config at any point? In other words, shortcuts are just always enabled, right? Are the "label editing" commands always enabled? Maybe that checking already happens in set_labels?
Features are not always enabled by default, the check happens in To maintain the current behaviour it's mandatory to configure the shortcuts, if you don't and try to use them you will be greeted by the standard error message: So the |
|
Got it! Going to merge now, then @Llandy3d can you update the wiki? |
|
@nikomatsakis sure for the wiki, somehow when running tests from the root of the repo it wasn't running parser's tests, fixed a case where it would return a |
|
The corresponding wiki page can be found here |
…omatsakis triagebot shortcut config Enable the new triagebot shortcuts as per [rust-lang#1381/triagebot](rust-lang/triagebot#1381)

#1339
This implements the shorcut handler and already works with two shorcuts:
ready->S-waiting-on-reviewauthor->S-waiting-on-authorIt correctly remove the unnecessary label while keeping previous ones. This functionality is accompanied by unit tests.
I do wonder if the
authorcommand should be allowed to only team members or it's ok as it is allowed now.A follow up to this that require more analysis, would be to ping assigned reviewers.