helpers icon indicating copy to clipboard operation
helpers copied to clipboard

Collect common review comment to automate

Open gpsaggese opened this issue 7 months ago • 5 comments

          @sonniki where should we collect all your comments somewhere so we can plug them into llm_transform.py / ai_reviewer.py to automate the linting?

I think we can automate 100% of this review work very easily.

Originally posted by @gpsaggese in https://github.com/causify-ai/tutorials/pull/404#discussion_r2080513685

gpsaggese avatar May 08 '25 21:05 gpsaggese

@sonniki how about we use this issue as a catch all issues posting examples of what needs to be automated in code reviews

In llm_transform.py I have a bunch of targets like:

    Use % formatting instead of f-strings (formatted string literals).
    Do not print any comment, just the converted code.

    For instance, convert:
    `f"Hello, {name}. You are {age} years old."`
    to
    `"Hello, %s. You are %d years old." % (name, age)`
    Replace any Python "from import" statement like `from X import Y` with the
    form `import X` and then replace the uses of `Y` with `X.Y`

My idea is to have a mega prompt (or a series of prompts) that fix all the issues and make the code perfect (modulo some false positives). Of course one should run this in a clean client, like we do for the linter, so that one can diffs the results and manually improve stuff.

gpsaggese avatar May 08 '25 21:05 gpsaggese

FYI, when I see a PR that has a problem with our style, I check out the branch, and implement the filters directly in llm_transform and fix them with LLM, and commit. It's a better use of time than just telling people what to do (soon we will just make this part of the linter flow)

gpsaggese avatar May 08 '25 22:05 gpsaggese

@sonniki how about we use this issue as a catch all issues posting examples of what needs to be automated in code reviews

I'm currently compiling a big bullet point list of briefly stated rules and conventions about PRs and code style (for #393). It would cover a lot of these things. Will check in as soon as I can.

FYI, when I see a PR that has a problem with our style, I check out the branch, and implement the filters directly in llm_transform and fix them with LLM, and commit. It's a better use of time than just telling people what to do (soon we will just make this part of the linter flow)

Sg. But I would tell people to do it themselves then:) Or they cannot use the tool because they don't necessarily have an OpenAI key?

sonniki avatar May 09 '25 12:05 sonniki

The doc with the guidelines that cover a lot of common review comments is now checked in at docs/code_guidelines/all.automated_review_guidelines.reference.md

sonniki avatar May 19 '25 11:05 sonniki

Let's use that document as the official reference for humans and machines. We'll move things little by little to llm_transform.py / ai_reviewer.py to automate and delegate the effort to the PR author.

gpsaggese avatar May 19 '25 19:05 gpsaggese