Skip to content
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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

feat: introduce todo-bot #4443

wants to merge 2 commits into from

Conversation

chingor13
Copy link
Contributor

This is a proof of concept for scanning a repository for annotations (like TODO or FIXME). 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

Copy link
Contributor

@tmatsuo tmatsuo left a 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}(\\(.*\\))?:'`, {
Copy link
Contributor

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?

Copy link
Contributor Author

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).

Copy link
Contributor Author

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[]> {
Copy link
Contributor

@tmatsuo tmatsuo Sep 22, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New Bot: TODO bot
2 participants