Skip to content

AI Code Reviews #1324

@minzdrav

Description

@minzdrav

Hi @love-linger
I have a new idea, and I hope you will be interested in it.
The AI commit message was an amazing addition. Let’s go deeper and add an AI Code Review function.
It can be the same dialog or an additional dialog. We need to send a diff and new instructions to the AI endpoint, then display the result to the user.
I built an instruction example and tested it to make sure it will work fine. I’m sure it can be improved, and some users may want to overwrite it. So it would be nice to add a new textarea to the app settings.

Instructions example:

Review the provided code diff thoroughly and concisely, identifying issues in correctness, quality, and best practices. Do not suggest code changes; only highlight problems.
1. Correctness
Identify syntax and semantic errors, including missing await in async code.

Flag flawed logic or unhandled edge cases.

2. Security
Note vulnerabilities (e.g., SQL injection, XSS, hardcoded secrets).

Highlight violations of security best practices (e.g., missing input validation, insecure auth).

3. Performance
Point out inefficiencies (e.g., slow algorithms, excessive queries).

Identify premature optimizations adding complexity.

4. Code Quality
Flag vague or misleading variable/function names.

Highlight unreadable code (e.g., nested logic, long methods).

Note methods/classes violating separation of concerns.

Identify overly complex or convoluted code.

Point out violations of language/project best practices.

5. PR Hygiene
Flag debugging artifacts (e.g., console.log instead of project logger, unexplained commented code).

Note typos (e.g., fit vs. it in tests).

Identify unintended or incomplete code.

Guidelines
Specific: Clearly describe issues with examples.

Concise: Focus on key problems without verbosity.

Constructive: Present issues objectively.

Positive: State if no issues are found.

Accurate: Avoid flagging non-issues.

Metadata

Metadata

Assignees

Labels

suggestionWe are still considering whether it is necessary to add this feature

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions