Skip to content

Commit 210d717

Browse files
authored
Merge branch 'main' into feature/annotation-option-parameter-validation
2 parents 1adf8ec + e5d7054 commit 210d717

File tree

276 files changed

+10135
-4195
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

276 files changed

+10135
-4195
lines changed

.claude/commands/execute_issue.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
gh issue view $ARGUMENTS to check the content of a GitHub Issue and proceed with the task.
2+
Follow the steps below to complete the task:
3+
4+
1. Review the content of the Issue.
5+
2. Checkout and pull the latest state of the main branch.
6+
3. Create and checkout an appropriate branch based on the Issue content.
7+
4. Implement test code and test files that cover the cases described in the Issue. Refer to the [Test Case Implementation Guidelines](../guidelines/TEST_CASE_GUIDELINE) for rules on implementing test cases.
8+
5. Run the tests and ensure all tests pass.
9+
6. Create commits with appropriate granularity.
10+
7. Create a PR following the rules below:
11+
- Refer to the [PR Creation Guidelines](../guidelines/CREATE_PR_GUIDELINE.md) for PR rules.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
## Commit Guidelines
2+
- Use imperative mood for commit messages (e.g., "Fix bug" instead of "Fixed
3+
- Write Commit messages in English
4+
5+
## PR Guidelines
6+
- If there are unstaged changes when creating a pull request, please split them appropriately and commit them separately.
7+
- Use the [PR Template](../templates/PR_TEMPLATE.md) for PR descriptions
8+
- PR titles should be concise and descriptive
9+
- Ensure all tests pass before submitting a PR
10+
- Write PR title and descriptions in English
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Test Case Implementation Guidelines
2+
Follow the rules below when implementing test code.
3+
4+
## Code Inspection Functionality
5+
Implement tests for code inspection functionality using the following steps:
6+
7+
### **Implementation of Test Case Classes**
8+
- Implement test case classes in `@src/test/kotlin/org/domaframework/doma/intellij/inspection`.
9+
- Implement test cases for each subclass of **AbstractBaseJavaLocalInspectionTool**.
10+
- Name the test case class as `<InspectionToolName>InspectionTest`.
11+
- The test case class should extend `DomaSqlTest`.
12+
- Override **setUp()** to add mock **Entity** classes or other necessary components to the virtual project for testing.
13+
- Register the target **AbstractBaseJavaLocalInspectionTool** subclass using **myFixture.enableInspections**.
14+
- In test case functions, retrieve the target Dao class using **DomaSqlTest#findDaoClass()** and test the highlighting results using **myFixture.testHighlighting()**.
15+
16+
### Implementation of Test Cases
17+
Create the target Dao class or SQL file for inspection.
18+
Wrap the elements to be error-highlighted with the **<error>** tag and specify the error message to be displayed using the **descr** option.
19+
20+
#### Test Data for Dao Classes
21+
- Implement test data Dao classes in **Java**.
22+
- Annotate test data Dao classes with **@Dao**.
23+
- Place them under the appropriate subpackage in `@src/test/testData/src/main/java/doma/example/dao/inspection`.
24+
- Implement any other necessary classes as needed.
25+
26+
#### Test Data for SQL Files
27+
- Create and place SQL files in a directory named after the corresponding Dao class under `@src/test/testData/src/main/resources/META-INF/doma/example/dao`.
28+
29+
### Reference
30+
For actual implementation examples using Doma, refer to the [Doma GitHub repository](https://github.com/domaframework/doma/tree/master/integration-test-java/src/main/java/org/seasar/doma/it/dao).

.claude/setting.json

Whitespace-only changes.

.claude/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

.claude/settings.local.json

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

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ out/
1313
*.iws
1414
.kotlin
1515
secrets.properties
16-
/certificate/**
16+
/certificate/**
17+
.claude/settings.local.json

CHANGELOG.md

Lines changed: 162 additions & 124 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 64 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Checks that bind variables are used appropriately for DAO and SQL associations.
3434
The plugin also provides quick fixes for DAO methods where the required SQL files do not exist.
3535

3636
- Quick fix to generate SQL template file.
37+
3738
![quickfix.png](images/quickfix.png)
3839
- Checks for unused DAO method arguments.
3940
![inspection.png](images/inspection.png)
@@ -69,17 +70,78 @@ Along with DAO changes, the plugin will refactor the SQL file directory and file
6970
- After refactoring the DAO package, the SQL directory will also be updated.
7071
![RenameDao.gif](images/gif/RenameDao.gif)
7172

72-
## Formatter (Preview)
73+
## Formatter
7374
Provides code formatting for SQL syntax.
7475
This feature is in preview. You cannot customize the indentation or keywords to be broken down!
7576

77+
The formatting applies to SQL written in SQL files and in value fields (text blocks) within org.seasar.doma.Sql annotations.
78+
79+
![Format.gif](images/gif/Format.gif)
80+
7681
Automatic indentation on newlines provided by the SQL formatting feature is disabled by default.
7782

7883
To enable auto-indentation, toggle the corresponding flag in the settings screen below.
7984

8085
`Settings > Other Settings > Doma Tools > Enable auto-indent for SQL`
8186

82-
![Format.gif](images/gif/Format.gif)
87+
### Limitations
88+
The current formatter has the following limitations:
89+
90+
- **No customizable indentation**: The number of spaces for indentation is fixed and cannot be changed
91+
- **No customizable line breaks**: You cannot configure which keywords trigger line breaks
92+
- **No custom function registration**: User-defined functions cannot be registered for formatting rules
93+
- **No formatting style options**: Cannot choose between different formatting styles or conventions
94+
95+
### Formatting Features
96+
The SQL formatter supports the following formatting capabilities:
97+
98+
- **SQL Keywords**: Converts keywords to uppercase (SELECT, FROM, WHERE, INSERT, UPDATE, DELETE, etc.)
99+
- **Statement Structure**: Properly formats different SQL statement types:
100+
- SELECT statements with proper column and clause alignment
101+
- INSERT statements with formatted column lists and VALUES clauses
102+
- UPDATE statements with aligned SET clauses
103+
- DELETE statements with formatted conditions
104+
- WITH clauses (CTE) with proper indentation
105+
- **Joins**: Formats JOIN operations with appropriate indentation and alignment
106+
- **Subqueries**: Properly indents nested queries and subselects
107+
- **Functions**: Formats function calls with proper parameter alignment
108+
- **Comments**: Preserves single-line (--) and multi-line (/* */) comments
109+
- **Doma Directives**: Maintains proper formatting for Doma-specific directives:
110+
- Bind variables: `/* paramName */` with proper spacing
111+
- Conditional directives: `/*%if condition */` ... `/*%end*/`
112+
- Loop directives: `/*%for item : collection */` ... `/*%end*/`
113+
- Expand directive: `/*%expand */`
114+
- Populate directive: `/*%populate */`
115+
- Static property calls: `/* @ClassName@property */`
116+
- Literal values: `/*^ literalValue */`
117+
- Embedded variables: `/*# variable */`
118+
119+
### Examples
120+
121+
**Before formatting:**
122+
```sql
123+
SELECT COUNT(DISTINCT x) AS count_x, o.*, COALESCE(nbor.nearest, 999)
124+
AS nearest FROM ( SELECT p.objid, p.psfmag_g - p.extinction_g AS rpm
125+
FROM phototag p JOIN usno u ON p.objid = u.objid
126+
WHERE p.TYPE = 'Star' /*%if status == 2 */ and u.propermotion > 2.0 /*%end*/ ) as o
127+
```
128+
129+
**After formatting:**
130+
```sql
131+
SELECT COUNT(DISTINCT x) AS count_x
132+
, o.*
133+
, COALESCE(nbor.nearest
134+
, 999) AS nearest
135+
FROM ( SELECT p.objid
136+
, p.psfmag_g - p.extinction_g AS rpm
137+
FROM phototag p
138+
JOIN usno u
139+
ON p.objid = u.objid
140+
WHERE p.TYPE = 'Star'
141+
/*%if status == 2 */
142+
AND u.propermotion > 2.0
143+
/*%end*/ ) AS o
144+
```
83145

84146
## Reference Contributor
85147
Ctrl+Click on a bind variable in an SQL file to jump to its source symbol.

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
pluginGroup = org.domaframework.doma.intellij
22
pluginName = Doma Tools for IntelliJ
33
pluginRepositoryUrl = https://github.com/domaframework/doma-tools-for-intellij
4-
pluginVersion = 1.1.2-beta
4+
pluginVersion = 2.0.1-beta
55

66
pluginSinceBuild=231
77

0 commit comments

Comments
 (0)