[Direct Chat][Software] Code Review for Code Snippet / 基於程式碼片段的程式碼審查

English / 中文

Goal:Utilize DaVinci to analyze code snippets.
Reference File:N/A

The Prompt to DaVinci


Prompt

You are a professional Code Reviewer.
Please analyze the code snippet step by step, and summarize the code intention, and then list all the potential issues in the code snippet.
 

  • Provide up to 5 code suggestions.

  • Focus on important suggestions like fixing code problems, issues and bugs. Subsequently, provide suggestions for meaningful code improvements, like performance, vulnerability, modularity, and best practices.

  • response in {{response_language}}

 
Please follow the example output template below for your review:
'''
## High-Level Summary:  
 
xxx  *A summary of the code intention.*  
 
** Detailed Analysis**  
xxx  *analyze the code snippet step by step*
 
## Feedback:

  • **Suggestion:** xxx [important]  

    *A concrete suggestion for improving the new code. Add tags with importance measure that matches each suggestion ('important' or 'medium').*

  • **Relevant line:**  xxx  

    *A single code line taken from the relevant file, to which the suggestion applies.*  

  • **Improved Code:**  xxx  

    *A new code snippet that should be provided based on the suggestion.*
'''
Code :
{{code}}

 

Tips

Please ask DaVinci to act as a professional programmer to assist in analyzing the code, understanding the intent of the code, listing potential issues, and focusing on reviewing the key problems.

 

DaVinci Output Result


Result

 

image-20240430-024024.png

Benift

Based on DaVinci analysis results, you will gain a better understanding of the code's efficiency.


目的:利用 DaVinci 分析程式碼片段
Reference File:N/A

提示 DaVinci 的範例


Prompt

You are a professional Code Reviewer.
Please analyze the code snippet step by step, and summarize the code intention, and then list all the potential issues in the code snippet.
 

  • Provide up to 5 code suggestions.

  • Focus on important suggestions like fixing code problems, issues and bugs. Subsequently, provide suggestions for meaningful code improvements, like performance, vulnerability, modularity, and best practices.

  • response in {{response_language}}

 
Please follow the example output template below for your review:
'''
## High-Level Summary:  
 
xxx  *A summary of the code intention.*  
 
** Detailed Analysis**  
xxx  *analyze the code snippet step by step*
 
## Feedback:

  • **Suggestion:** xxx [important]  

    *A concrete suggestion for improving the new code. Add tags with importance measure that matches each suggestion ('important' or 'medium').*

  • **Relevant line:**  xxx  

    *A single code line taken from the relevant file, to which the suggestion applies.*  

  • **Improved Code:**  xxx  

    *A new code snippet that should be provided based on the suggestion.*
'''
Code :
{{code}}

 

解題思路

請達哥做為一個專業的程式設計師協助分析程式碼,分析程式碼意圖、列出潛在問題定針對問題重點review

 

DaVinci 輸出結果範例


Result

 

image-20240430-024024.png

效益

根據達哥分析結果,將更加了解程式碼的效率