Skip to content

Commit 911384f

Browse files
committed
docs: update for refs
1 parent b491a9a commit 911384f

File tree

8 files changed

+247
-247
lines changed

8 files changed

+247
-247
lines changed

docs/development/code-review-prompting.md

Lines changed: 56 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -11,66 +11,64 @@ parent: Development
1111

1212
link: https://github.com/domvwt/chatgpt-code-review/blob/main/chatgpt_code_review/query.py
1313

14-
Please review the code below and identify any syntax or logical errors, suggest
15-
ways to refactor and improve code quality, enhance performance, address security
16-
concerns, and align with best practices. Provide specific examples for each area
17-
and limit your recommendations to three per category.
18-
19-
Use the following response format, keeping the section headings as-is, and provide
20-
your feedback. Use bullet points for each response. The provided examples are for
21-
illustration purposes only and should not be repeated.
22-
23-
**Syntax and logical errors (example)**:
24-
- Incorrect indentation on line 12
25-
- Missing closing parenthesis on line 23
26-
27-
**Code refactoring and quality (example)**:
28-
- Replace multiple if-else statements with a switch case for readability
29-
- Extract repetitive code into separate functions
30-
31-
**Performance optimization (example)**:
32-
- Use a more efficient sorting algorithm to reduce time complexity
33-
- Cache results of expensive operations for reuse
34-
35-
**Security vulnerabilities (example)**:
36-
- Sanitize user input to prevent SQL injection attacks
37-
- Use prepared statements for database queries
38-
39-
**Best practices (example)**:
40-
- Add meaningful comments and documentation to explain the code
41-
- Follow consistent naming conventions for variables and functions
14+
Please review the code below and identify any syntax or logical errors, suggest
15+
ways to refactor and improve code quality, enhance performance, address security
16+
concerns, and align with best practices. Provide specific examples for each area
17+
and limit your recommendations to three per category.
18+
19+
Use the following response format, keeping the section headings as-is, and provide
20+
your feedback. Use bullet points for each response. The provided examples are for
21+
illustration purposes only and should not be repeated.
22+
23+
**Syntax and logical errors (example)**:
24+
- Incorrect indentation on line 12
25+
- Missing closing parenthesis on line 23
26+
27+
**Code refactoring and quality (example)**:
28+
- Replace multiple if-else statements with a switch case for readability
29+
- Extract repetitive code into separate functions
30+
31+
**Performance optimization (example)**:
32+
- Use a more efficient sorting algorithm to reduce time complexity
33+
- Cache results of expensive operations for reuse
34+
35+
**Security vulnerabilities (example)**:
36+
- Sanitize user input to prevent SQL injection attacks
37+
- Use prepared statements for database queries
38+
39+
**Best practices (example)**:
40+
- Add meaningful comments and documentation to explain the code
41+
- Follow consistent naming conventions for variables and functions
4242

4343
## Final
44-
45-
You are a seasoned software developer, and I'm seeking your expertise to review the following code:
46-
47-
- Focus on critical algorithms, logical flow, and design decisions within the code. Discuss how these changes impact the core functionality and the overall structure of the code.
48-
- Identify and highlight any potential issues or risks introduced by these code changes. This will help reviewers pay special attention to areas that may require improvement or further analysis.
49-
- Emphasize the importance of compatibility and consistency with the existing codebase. Ensure that the code adheres to the established standards and practices for code uniformity and long-term maintainability.
50-
51-
You MUST Use 中文 to reply me!
52-
You are working on a project that uses Spring MVC,Spring WebFlux,JDBC to build business logic.
53-
54-
The following user stories are related to these changes:
55-
预定会议室
56-
Commit Message: feat(meeting): add repository #6\n\nCode Changes:\n\nIndex: src/main/java/cc/unitmesh/untitled/demo/repository/MeetingRepository.java
57-
new file mode 100644
58-
--- /dev/null
59-
+++ b/src/main/java/cc/unitmesh/untitled/demo/repository/MeetingRepository.java
60-
@@ -0,0 +1,10 @@
61-
+package cc.unitmesh.untitled.demo.repository;
62-
63-
+import cc.unitmesh.untitled.demo.entity.BlogPost;
64-
+import org.springframework.data.repository.CrudRepository;
65-
+import org.springframework.stereotype.Repository;
66-
+
67-
+@Repository
68-
+public interface MeetingRepository extends CrudRepository<BlogPost, Long> {
69-
+
70-
+}
71-
As your Tech lead, I am only concerned with key code review issues. Please provide me with a critical summary.
72-
Submit your key insights under 5 sentences in here:
73-
44+
45+
You are a seasoned software developer, and I'm seeking your expertise to review the following code:
46+
47+
- Focus on critical algorithms, logical flow, and design decisions within the code. Discuss how these changes impact the core functionality and the overall structure of the code.
48+
- Identify and highlight any potential issues or risks introduced by these code changes. This will help reviewers pay special attention to areas that may require improvement or further analysis.
49+
- Emphasize the importance of compatibility and consistency with the existing codebase. Ensure that the code adheres to the established standards and practices for code uniformity and long-term maintainability.
50+
51+
You are working on a project that uses Spring MVC,Spring WebFlux,JDBC to build business logic.
52+
53+
The following user stories are related to these changes:
54+
预定会议室
55+
Commit Message: feat(meeting): add repository #6\n\nCode Changes:\n\nIndex: src/main/java/cc/unitmesh/untitled/demo/repository/MeetingRepository.java
56+
new file mode 100644
57+
--- /dev/null
58+
+++ b/src/main/java/cc/unitmesh/untitled/demo/repository/MeetingRepository.java
59+
@@ -0,0 +1,10 @@
60+
+package cc.unitmesh.untitled.demo.repository;
61+
62+
+import cc.unitmesh.untitled.demo.entity.BlogPost;
63+
+import org.springframework.data.repository.CrudRepository;
64+
+import org.springframework.stereotype.Repository;
65+
+
66+
+@Repository
67+
+public interface MeetingRepository extends CrudRepository<BlogPost, Long> {
68+
+
69+
+}
70+
As your Tech lead, I am only concerned with key code review issues. Please provide me with a critical summary.
71+
Submit your key insights under 5 sentences in here:
7472

7573
## Commit Message Generate
7674

docs/development/debug-new-language.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ project(":plugin") {
8181
plugins.set(pluginList)
8282
}
8383

84-
...
84+
// ...
8585
}
8686
```
8787

docs/development/dev-new-language.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,16 @@ And, we found that JetBrains' IDE already have a good data structure, so we use
2727
structure and design.
2828

2929
```xml
30-
<fileContextBuilder language="Rust"
31-
implementationClass="cc.unitmesh.rust.context.RustFileContextBuilder"/>
32-
<classContextBuilder language="Rust"
33-
implementationClass="cc.unitmesh.rust.context.RustClassContextBuilder"/>
34-
<methodContextBuilder language="Rust"
35-
implementationClass="cc.unitmesh.rust.context.RustMethodContextBuilder"/>
36-
<variableContextBuilder language="Rust"
37-
implementationClass="cc.unitmesh.rust.context.RustVariableContextBuilder"/>
38-
30+
<extensions defaultExtensionNs="cc.unitmesh">
31+
<fileContextBuilder language="Rust"
32+
implementationClass="cc.unitmesh.rust.context.RustFileContextBuilder"/>
33+
<classContextBuilder language="Rust"
34+
implementationClass="cc.unitmesh.rust.context.RustClassContextBuilder"/>
35+
<methodContextBuilder language="Rust"
36+
implementationClass="cc.unitmesh.rust.context.RustMethodContextBuilder"/>
37+
<variableContextBuilder language="Rust"
38+
implementationClass="cc.unitmesh.rust.context.RustVariableContextBuilder"/>
39+
</extensions>
3940
```
4041

4142
### Chat Context Provider
@@ -80,7 +81,7 @@ multiple Chat Context Providers for same languages.
8081

8182
### contextPrompter
8283

83-
> contextPrompter will provide the context prompt rules for user, like display and request prompts.
84+
> Context Prompter will provide the context prompt rules for user, like display and request prompts.
8485
8586
```xml
8687
<contextPrompter

docs/development/development-faq.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ parent: Development
77

88
## EDT and ReadAction issue
99

10-
### For example
11-
1210
> Synchronous execution under ReadAction: /usr/local/bin/git -c credential.helper= -c core
1311
1412
A solution will be like:

docs/development/development.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ permalink: /development
88

99
{: .no_toc }
1010

11-
1211
# Development
1312

1413
1. `git clone https://github.com/unit-mesh/auto-dev/`
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
---
2+
layout: default
3+
title: Git Commit
4+
nav_order: 10
5+
parent: Development
6+
---
7+
8+
Git commit Prompt example
9+
10+
Write a cohesive yet descriptive commit message for a given diff.
11+
Make sure to include both information What was changed and Why.
12+
Start with a short sentence in imperative form, no more than 50 characters long.
13+
Then leave an empty line and continue with a more detailed explanation, if necessary.
14+
Explanation should have less than 200 characters.
15+
16+
examples:
17+
- fix(authentication): add password regex pattern
18+
- feat(storage): add new test cases
19+
- test(java): fix test case for user controller
20+
21+
Diff:
22+
23+
```diff
24+
modify file src/main/kotlin/cc/unitmesh/devti/prompting/VcsPrompting.kt
25+
private val defaultIgnoreFilePatterns: List<PathMatcher> = listOf(
26+
"**/*.md", "**/*.json", "**/*.jsonl", "**/*.txt", "**/*.xml", "**/*.yml", "**/*.yaml", "**/*.html",
27+
"**/*.log", "**/*.tmp", "**/*.temp", "**/*.bak", "**/*.swp",
28+
- "**/*.svg",
29+
+ "**/*.svg",
30+
).map {
31+
FileSystems.getDefault().getPathMatcher("glob:$it")
32+
}
33+
project: Project,
34+
ignoreFilePatterns: List<PathMatcher> = defaultIgnoreFilePatterns,
35+
): String? {
36+
+ val changeText = project.service<DiffSimplifier>().simplify(selectList, ignoreFilePatterns)
37+
+
38+
+ if (changeText.isEmpty()) {
39+
+ return null
40+
+ }
41+
+
42+
+ val processedText = DiffSimplifier.postProcess(changeText)
43+
val writer = StringWriter()
44+
if (details.isNotEmpty()) {
45+
details.forEach { writer.write(it.fullMessage + "\n\n") }
46+
}
47+
- writer.write("Changes:\n\n")
48+
- val changeText = project.service<DiffSimplifier>().simplify(selectList, ignoreFilePatterns)
49+
-
50+
- if (changeText.isEmpty()) {
51+
- return null
52+
- }
53+
+ writer.write(
54+
+ """
55+
+ Changes:
56+
+
57+
+ ```patch
58+
+ $processedText
59+
+ ```
60+
+ """.trimIndent()
61+
+ )
62+
-
63+
-
64+
- writer.write("```patch\n\n")
65+
- writer.write(DiffSimplifier.postProcess(changeText))
66+
- writer.write("\n\n```\n\n")
67+
-
68+
return writer.toString()
69+
}
70+
fun hasChanges(): List<Change> {
71+
- val changeListManager = ChangeListManagerImpl.getInstance(project)
72+
- val changes = changeListManager.changeLists.flatMap {
73+
- it.changes
74+
- }
75+
-
76+
- return changes
77+
+ val changeListManager = ChangeListManager.getInstance(project)
78+
+ return changeListManager.changeLists.flatMap { it.changes }
79+
}
80+
}
81+
```
82+
83+

docs/development/git-patch-prompting.md

Lines changed: 0 additions & 80 deletions
This file was deleted.

0 commit comments

Comments
 (0)