-
Notifications
You must be signed in to change notification settings - Fork 128
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
feat: introduce todo-bot #4443
base: main
Are you sure you want to change the base?
feat: introduce todo-bot #4443
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A generic scanner is useful if the interface is generic enough to support other use cases.
In that case, I think it's worth having it as a library.
const contextMatcher = new RegExp( | ||
`${annotation}(?:\\((?<context>.*)\\))?:` | ||
); | ||
const {stdout} = await exec(`grep -rn -E '${annotation}(\\(.*\\))?:'`, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible not to use exec?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could try to rewrite the functionality of scanning every file in a directory for a pattern, but this was expecting to run on Cloud Run where we control the runtime (git
and grep
would be installed).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also assume grep will be way more efficient in terms of speed and memory usage than we can possibly do in node.
|
||
// TODO: example todo | ||
// TODO(context): another example annotation | ||
async findAnnotations(annotations: string[]): Promise<Annotation[]> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about to make the interface receiving a list of regex and returning the match object?
That way it's more generic
This is a proof of concept for scanning a repository for annotations (like
TODO
orFIXME
). The bot does not do anything useful with the results of the scan.Currently implemented is an
AnnotationScanner
class which encapsulates the logic of shallow cloning a repo and scanning for annotations and a CLI to test it out locally.Fixes #1301