diff --git a/CHANGELOG.md b/CHANGELOG.md
index e464481..773eacb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
+### Breaking Changes
+
+- Rename recipe `io.github.mhagnumdw.FormatSqlBlockRecipe` to `io.github.mhagnumdw.recipes.FormatSqlTextBlockByAnnotation`
+- Rename recipe `io.github.mhagnumdw.FormatSqlFileRecipe` to `io.github.mhagnumdw.recipes.FormatSqlFile`
+
### Added
- **FormatSqlTextBlockRecipe**: for SQL Text Blocks marked with `// language=sql` (#20)
diff --git a/README.md b/README.md
index 7b20227..b29fdc9 100644
--- a/README.md
+++ b/README.md
@@ -8,14 +8,14 @@
A set of [OpenRewrite](https://docs.openrewrite.org/) recipes for formatting SQL/HQL code.
- [Recipes](#recipes)
- - [FormatSqlBlockRecipe](#formatsqlblockrecipe)
- - [FormatSqlTextBlockRecipe](#formatsqltextblockrecipe)
- - [FormatSqlFileRecipe](#formatsqlfilerecipe)
+ - [FormatSqlTextBlockByAnnotation](#formatsqltextblockbyannotation)
+ - [FormatSqlTextBlockByLanguageInjection](#formatsqltextblockbylanguageinjection)
+ - [FormatSqlFile](#formatsqlfile)
- [Configurable Options](#configurable-options)
- [Examples](#examples)
- - [FormatSqlBlockRecipe Example](#formatsqlblockrecipe-example)
- - [FormatSqlTextBlockRecipe Example](#formatsqltextblockrecipe-example)
- - [FormatSqlFileRecipe Example](#formatsqlfilerecipe-example)
+ - [FormatSqlTextBlockByAnnotation example](#formatsqltextblockbyannotation-example)
+ - [FormatSqlTextBlockByLanguageInjection example](#formatsqltextblockbylanguageinjection-example)
+ - [FormatSqlFile example](#formatsqlfile-example)
- [Usage](#usage)
- [Configuring in `pom.xml`](#configuring-in-pomxml)
- [Without adding anything to the project](#without-adding-anything-to-the-project)
@@ -25,9 +25,9 @@ A set of [OpenRewrite](https://docs.openrewrite.org/) recipes for formatting SQL
Below is a detailed description of each Recipe.
-### FormatSqlBlockRecipe
+### FormatSqlTextBlockByAnnotation
-The `io.github.mhagnumdw.FormatSqlBlockRecipe` recipe automatically formats SQL or HQL embedded in [Text Blocks](https://docs.oracle.com/en/java/javase/13/text_blocks/index.html) present in the following annotations:
+The `io.github.mhagnumdw.recipes.FormatSqlTextBlockByAnnotation` recipe automatically formats SQL or HQL embedded in [Text Blocks](https://docs.oracle.com/en/java/javase/13/text_blocks/index.html) present in the following annotations:
- `org.hibernate.annotations.processing.HQL`
- `org.hibernate.annotations.processing.SQL`
@@ -35,23 +35,23 @@ The `io.github.mhagnumdw.FormatSqlBlockRecipe` recipe automatically formats SQL
> Future enhancements may allow configuration of custom annotations. Please open an issue.
-### FormatSqlTextBlockRecipe
+### FormatSqlTextBlockByLanguageInjection
-The `io.github.mhagnumdw.FormatSqlTextBlockRecipe` recipe formats SQL code in Java [Text Blocks](https://docs.oracle.com/en/java/javase/13/text_blocks/index.html) that are preceded by a `// language=sql` comment (case-insensitive).
+The `io.github.mhagnumdw.recipes.FormatSqlTextBlockByLanguageInjection` recipe formats SQL code in Java [Text Blocks](https://docs.oracle.com/en/java/javase/13/text_blocks/index.html) that are preceded by a `// language=sql` comment (case-insensitive).
This is the same [language injection comment](https://www.jetbrains.com/help/idea/language-injections.html) recognized by IntelliJ IDEA for SQL syntax highlighting.
-### FormatSqlFileRecipe
+### FormatSqlFile
-The `io.github.mhagnumdw.FormatSqlFileRecipe` recipe automatically formats the content of SQL files.
+The `io.github.mhagnumdw.recipes.FormatSqlFile` recipe automatically formats the content of SQL files.
## Configurable Options
-The following options are applicable to `FormatSqlBlockRecipe`, `FormatSqlTextBlockRecipe`, and `FormatSqlFileRecipe`:
+The following options are applicable to `FormatSqlTextBlockByAnnotation`, `FormatSqlTextBlockByLanguageInjection`, and `FormatSqlFile`:
| Type | Name | Description | Example | Default Value |
| :------ | :---------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------- | :------------------------- |
-| String | `filePath` | Optional. The path to the files that the Recipe should process. Accepts a glob expression; multiple patterns can be specified, separated by a semicolon `;`. If omitted, processes all matching files. | `**/*DAO.java`
`**/*.sql` | FormatSqlBlockRecipe: `**/*.java`
FormatSqlTextBlockRecipe: `**/*.java`
FormatSqlFileRecipe: `**/*.sql` |
+| String | `filePath` | Optional. The path to the files that the Recipe should process. Accepts a glob expression; multiple patterns can be specified, separated by a semicolon `;`. If omitted, processes all matching files. | `**/*DAO.java`
`**/*.sql` | FormatSqlTextBlockByAnnotation: `**/*.java`
FormatSqlTextBlockByLanguageInjection: `**/*.java`
FormatSqlFile: `**/*.sql` |
| String | `sqlDialect` | Optional. The SQL dialect to be used for formatting. Valid options: `sql` (StandardSql), `mysql`, `postgresql`, `db2`, `plsql` (Oracle PL/SQL), `n1ql` (Couchbase N1QL), `redshift`, `spark`, `tsql` (SQL Server Transact-SQL). Details [here](https://github.com/vertical-blank/sql-formatter). | `plsql` | `sql` |
| String | `indent` | Optional. The string to be used for indentation. | `" "` for 2 spaces
`"\t"` for a tab | 4 spaces `" "` |
| Integer | `maxColumnLength` | Optional. The maximum length of a line before the formatter tries to break it. | `100` | `120` |
@@ -59,7 +59,7 @@ The following options are applicable to `FormatSqlBlockRecipe`, `FormatSqlTextBl
## Examples
-### FormatSqlBlockRecipe Example
+### FormatSqlTextBlockByAnnotation example
Before
@@ -99,7 +99,7 @@ public interface HolidayRepository {
}
```
-### FormatSqlTextBlockRecipe Example
+### FormatSqlTextBlockByLanguageInjection example
Before
@@ -126,7 +126,7 @@ private static final String QUERY = """
u.name""";
```
-### FormatSqlFileRecipe Example
+### FormatSqlFile example
Consider the following `example.sql` file:
@@ -174,9 +174,9 @@ Inside the plugins section, add:
- io.github.mhagnumdw.FormatSqlBlockRecipe
- io.github.mhagnumdw.FormatSqlTextBlockRecipe
- io.github.mhagnumdw.FormatSqlFileRecipe
+ io.github.mhagnumdw.recipes.FormatSqlTextBlockByAnnotation
+ io.github.mhagnumdw.recipes.FormatSqlTextBlockByLanguageInjection
+ io.github.mhagnumdw.recipes.FormatSqlFile
false
@@ -201,15 +201,15 @@ To customize the recipe configuration, you need to have a `rewrite.yml` file in
```yml
---
type: specs.openrewrite.org/v1beta/recipe
-name: io.github.mhagnumdw.FormatSqlCustomConfig
+name: io.github.mhagnumdw.recipes.FormatSqlCustomConfig
recipeList:
# Add the Recipes you want to use here
- - io.github.mhagnumdw.FormatSqlBlockRecipe:
+ - io.github.mhagnumdw.recipes.FormatSqlTextBlockByAnnotation:
sqlDialect: "plsql"
- - io.github.mhagnumdw.FormatSqlTextBlockRecipe:
+ - io.github.mhagnumdw.recipes.FormatSqlTextBlockByLanguageInjection:
+ sqlDialect: "plsql"
+ - io.github.mhagnumdw.recipes.FormatSqlFile:
sqlDialect: "plsql"
- - io.github.mhagnumdw.FormatSqlFileRecipe:
- sqlDialect: "mysql"
```
> - This file is a way to create your own custom recipe from other recipes.
@@ -220,10 +220,10 @@ recipeList:
And change the `` tag in `pom.xml` to:
```xml
-io.github.mhagnumdw.FormatSqlCustomConfig
+io.github.mhagnumdw.recipes.FormatSqlCustomConfig
```
-> As in this example the `FormatSqlCustomConfig` recipe includes both `FormatSqlBlockRecipe`, `FormatSqlTextBlockRecipe` and `FormatSqlFileRecipe` recipes, in `pom.xml` it is only necessary to define the `FormatSqlCustomConfig` recipe.
+> As in this example the `FormatSqlCustomConfig` recipe includes both `FormatSqlTextBlockByAnnotation`, `FormatSqlTextBlockByLanguageInjection` and `FormatSqlFile` recipes, in `pom.xml` it is only necessary to define the `FormatSqlCustomConfig` recipe.
Then run:
@@ -239,7 +239,7 @@ This mode is indicated if your intention is to run the recipe only once.
```bash
./mvnw org.openrewrite.maven:rewrite-maven-plugin:run \
- -Drewrite.activeRecipes=io.github.mhagnumdw.FormatSqlBlockRecipe,io.github.mhagnumdw.FormatSqlTextBlockRecipe,io.github.mhagnumdw.FormatSqlFileRecipe \
+ -Drewrite.activeRecipes=io.github.mhagnumdw.recipes.FormatSqlTextBlockByAnnotation,io.github.mhagnumdw.recipes.FormatSqlTextBlockByLanguageInjection,io.github.mhagnumdw.recipes.FormatSqlFile \
-Drewrite.recipeArtifactCoordinates=io.github.mhagnumdw:rewrite-format-sql:1.0.0
```
@@ -249,11 +249,11 @@ Then run:
```bash
./mvnw org.openrewrite.maven:rewrite-maven-plugin:run \
- -Drewrite.activeRecipes=io.github.mhagnumdw.FormatSqlCustomConfig \
+ -Drewrite.activeRecipes=io.github.mhagnumdw.recipes.FormatSqlCustomConfig \
-Drewrite.recipeArtifactCoordinates=io.github.mhagnumdw:rewrite-format-sql:1.0.0
```
-> - `io.github.mhagnumdw.FormatSqlCustomConfig` is the `name` defined in the `rewrite.yml` file.
+> - `io.github.mhagnumdw.recipes.FormatSqlCustomConfig` is the `name` defined in the `rewrite.yml` file.
> - For a single recipe, you don't even need to have the `rewrite.yml` file to customize the configuration, see [here](https://docs.openrewrite.org/reference/faq#is-it-possible-to-pass-arguments-to-a-recipe-from-the-command-line).
## For Developers
diff --git a/src/main/java/io/github/mhagnumdw/processors/AnnotationOnlyOneArgumentProcessor.java b/src/main/java/io/github/mhagnumdw/processors/AnnotationOnlyOneArgumentProcessor.java
index c4cef40..22da7c7 100644
--- a/src/main/java/io/github/mhagnumdw/processors/AnnotationOnlyOneArgumentProcessor.java
+++ b/src/main/java/io/github/mhagnumdw/processors/AnnotationOnlyOneArgumentProcessor.java
@@ -4,7 +4,7 @@
import com.github.vertical_blank.sqlformatter.core.FormatConfig;
import com.github.vertical_blank.sqlformatter.languages.Dialect;
-import io.github.mhagnumdw.TextBlockUtil;
+import io.github.mhagnumdw.utils.TextBlockUtil;
import org.openrewrite.Cursor;
import org.openrewrite.java.tree.Expression;
import org.openrewrite.java.tree.J;
diff --git a/src/main/java/io/github/mhagnumdw/FormatSqlFileRecipe.java b/src/main/java/io/github/mhagnumdw/recipes/FormatSqlFile.java
similarity index 87%
rename from src/main/java/io/github/mhagnumdw/FormatSqlFileRecipe.java
rename to src/main/java/io/github/mhagnumdw/recipes/FormatSqlFile.java
index 82f9fea..993bfd3 100644
--- a/src/main/java/io/github/mhagnumdw/FormatSqlFileRecipe.java
+++ b/src/main/java/io/github/mhagnumdw/recipes/FormatSqlFile.java
@@ -1,9 +1,10 @@
-package io.github.mhagnumdw;
+package io.github.mhagnumdw.recipes;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.github.vertical_blank.sqlformatter.core.FormatConfig;
import com.github.vertical_blank.sqlformatter.languages.Dialect;
+import io.github.mhagnumdw.visitors.FormatSqlFileVisitor;
import lombok.EqualsAndHashCode;
import lombok.Value;
import org.jspecify.annotations.Nullable;
@@ -17,12 +18,12 @@
*/
@Value
@EqualsAndHashCode(callSuper = false)
-public class FormatSqlFileRecipe extends FormatSqlRecipeAbstract {
+public class FormatSqlFile extends FormatSqlRecipeAbstract {
private static final String DEFAULT_FILE_PATH = "**/*.sql";
@JsonCreator
- public FormatSqlFileRecipe(@Nullable @JsonProperty("filePath") String filePath,
+ public FormatSqlFile(@Nullable @JsonProperty("filePath") String filePath,
@Nullable @JsonProperty("sqlDialect") String sqlDialect,
@Nullable @JsonProperty("indent") String indent,
@Nullable @JsonProperty("maxColumnLength") Integer maxColumnLength,
diff --git a/src/main/java/io/github/mhagnumdw/FormatSqlRecipeAbstract.java b/src/main/java/io/github/mhagnumdw/recipes/FormatSqlRecipeAbstract.java
similarity index 99%
rename from src/main/java/io/github/mhagnumdw/FormatSqlRecipeAbstract.java
rename to src/main/java/io/github/mhagnumdw/recipes/FormatSqlRecipeAbstract.java
index 45878c8..66bdeab 100644
--- a/src/main/java/io/github/mhagnumdw/FormatSqlRecipeAbstract.java
+++ b/src/main/java/io/github/mhagnumdw/recipes/FormatSqlRecipeAbstract.java
@@ -1,4 +1,4 @@
-package io.github.mhagnumdw;
+package io.github.mhagnumdw.recipes;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.github.vertical_blank.sqlformatter.core.FormatConfig;
diff --git a/src/main/java/io/github/mhagnumdw/FormatSqlBlockRecipe.java b/src/main/java/io/github/mhagnumdw/recipes/FormatSqlTextBlockByAnnotation.java
similarity index 87%
rename from src/main/java/io/github/mhagnumdw/FormatSqlBlockRecipe.java
rename to src/main/java/io/github/mhagnumdw/recipes/FormatSqlTextBlockByAnnotation.java
index 6ccf2af..ba71578 100644
--- a/src/main/java/io/github/mhagnumdw/FormatSqlBlockRecipe.java
+++ b/src/main/java/io/github/mhagnumdw/recipes/FormatSqlTextBlockByAnnotation.java
@@ -1,9 +1,10 @@
-package io.github.mhagnumdw;
+package io.github.mhagnumdw.recipes;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.github.vertical_blank.sqlformatter.core.FormatConfig;
import com.github.vertical_blank.sqlformatter.languages.Dialect;
+import io.github.mhagnumdw.visitors.FormatSqlBlockVisitor;
import lombok.EqualsAndHashCode;
import lombok.Value;
import org.jspecify.annotations.Nullable;
@@ -18,12 +19,12 @@
*/
@Value
@EqualsAndHashCode(callSuper = false)
-public class FormatSqlBlockRecipe extends FormatSqlRecipeAbstract {
+public class FormatSqlTextBlockByAnnotation extends FormatSqlRecipeAbstract {
private static final String DEFAULT_FILE_PATH = "**/*.java";
@JsonCreator
- public FormatSqlBlockRecipe(@Nullable @JsonProperty("filePath") String filePath,
+ public FormatSqlTextBlockByAnnotation(@Nullable @JsonProperty("filePath") String filePath,
@Nullable @JsonProperty("sqlDialect") String sqlDialect,
@Nullable @JsonProperty("indent") String indent,
@Nullable @JsonProperty("maxColumnLength") Integer maxColumnLength,
diff --git a/src/main/java/io/github/mhagnumdw/FormatSqlTextBlockRecipe.java b/src/main/java/io/github/mhagnumdw/recipes/FormatSqlTextBlockByLanguageInjection.java
similarity index 88%
rename from src/main/java/io/github/mhagnumdw/FormatSqlTextBlockRecipe.java
rename to src/main/java/io/github/mhagnumdw/recipes/FormatSqlTextBlockByLanguageInjection.java
index d50565f..26ad18a 100644
--- a/src/main/java/io/github/mhagnumdw/FormatSqlTextBlockRecipe.java
+++ b/src/main/java/io/github/mhagnumdw/recipes/FormatSqlTextBlockByLanguageInjection.java
@@ -1,9 +1,10 @@
-package io.github.mhagnumdw;
+package io.github.mhagnumdw.recipes;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.github.vertical_blank.sqlformatter.core.FormatConfig;
import com.github.vertical_blank.sqlformatter.languages.Dialect;
+import io.github.mhagnumdw.visitors.FormatSqlTextBlockVisitor;
import lombok.EqualsAndHashCode;
import lombok.Value;
import org.jspecify.annotations.Nullable;
@@ -15,12 +16,12 @@
@Value
@EqualsAndHashCode(callSuper = false)
-public class FormatSqlTextBlockRecipe extends FormatSqlRecipeAbstract {
+public class FormatSqlTextBlockByLanguageInjection extends FormatSqlRecipeAbstract {
private static final String DEFAULT_FILE_PATH = "**/*.java";
@JsonCreator
- public FormatSqlTextBlockRecipe(
+ public FormatSqlTextBlockByLanguageInjection(
@Nullable @JsonProperty("filePath") String filePath,
@Nullable @JsonProperty("sqlDialect") String sqlDialect,
@Nullable @JsonProperty("indent") String indent,
diff --git a/src/main/java/io/github/mhagnumdw/TextBlockUtil.java b/src/main/java/io/github/mhagnumdw/utils/TextBlockUtil.java
similarity index 99%
rename from src/main/java/io/github/mhagnumdw/TextBlockUtil.java
rename to src/main/java/io/github/mhagnumdw/utils/TextBlockUtil.java
index 5e7ed78..36035f4 100644
--- a/src/main/java/io/github/mhagnumdw/TextBlockUtil.java
+++ b/src/main/java/io/github/mhagnumdw/utils/TextBlockUtil.java
@@ -1,4 +1,4 @@
-package io.github.mhagnumdw;
+package io.github.mhagnumdw.utils;
import static org.openrewrite.Tree.randomId;
diff --git a/src/main/java/io/github/mhagnumdw/FormatSqlBlockVisitor.java b/src/main/java/io/github/mhagnumdw/visitors/FormatSqlBlockVisitor.java
similarity index 89%
rename from src/main/java/io/github/mhagnumdw/FormatSqlBlockVisitor.java
rename to src/main/java/io/github/mhagnumdw/visitors/FormatSqlBlockVisitor.java
index 05e3913..56786ff 100644
--- a/src/main/java/io/github/mhagnumdw/FormatSqlBlockVisitor.java
+++ b/src/main/java/io/github/mhagnumdw/visitors/FormatSqlBlockVisitor.java
@@ -1,4 +1,4 @@
-package io.github.mhagnumdw;
+package io.github.mhagnumdw.visitors;
import com.github.vertical_blank.sqlformatter.core.FormatConfig;
import com.github.vertical_blank.sqlformatter.languages.Dialect;
@@ -13,7 +13,7 @@ public class FormatSqlBlockVisitor extends JavaIsoVisitor {
private final Dialect dialect;
private final FormatConfig formatConfig;
- FormatSqlBlockVisitor(Dialect dialect, FormatConfig formatConfig) {
+ public FormatSqlBlockVisitor(Dialect dialect, FormatConfig formatConfig) {
this.dialect = dialect;
this.formatConfig = formatConfig;
}
diff --git a/src/main/java/io/github/mhagnumdw/FormatSqlFileVisitor.java b/src/main/java/io/github/mhagnumdw/visitors/FormatSqlFileVisitor.java
similarity index 97%
rename from src/main/java/io/github/mhagnumdw/FormatSqlFileVisitor.java
rename to src/main/java/io/github/mhagnumdw/visitors/FormatSqlFileVisitor.java
index 716ddcc..ff1dec5 100644
--- a/src/main/java/io/github/mhagnumdw/FormatSqlFileVisitor.java
+++ b/src/main/java/io/github/mhagnumdw/visitors/FormatSqlFileVisitor.java
@@ -1,4 +1,4 @@
-package io.github.mhagnumdw;
+package io.github.mhagnumdw.visitors;
import com.github.vertical_blank.sqlformatter.SqlFormatter;
import com.github.vertical_blank.sqlformatter.core.FormatConfig;
diff --git a/src/main/java/io/github/mhagnumdw/FormatSqlTextBlockVisitor.java b/src/main/java/io/github/mhagnumdw/visitors/FormatSqlTextBlockVisitor.java
similarity index 94%
rename from src/main/java/io/github/mhagnumdw/FormatSqlTextBlockVisitor.java
rename to src/main/java/io/github/mhagnumdw/visitors/FormatSqlTextBlockVisitor.java
index 11008bb..a7d8c07 100644
--- a/src/main/java/io/github/mhagnumdw/FormatSqlTextBlockVisitor.java
+++ b/src/main/java/io/github/mhagnumdw/visitors/FormatSqlTextBlockVisitor.java
@@ -1,9 +1,10 @@
-package io.github.mhagnumdw;
+package io.github.mhagnumdw.visitors;
import static org.openrewrite.java.tree.J.Literal;
import com.github.vertical_blank.sqlformatter.core.FormatConfig;
import com.github.vertical_blank.sqlformatter.languages.Dialect;
+import io.github.mhagnumdw.utils.TextBlockUtil;
import org.openrewrite.ExecutionContext;
import org.openrewrite.java.JavaIsoVisitor;
import org.openrewrite.java.tree.Comment;
@@ -24,7 +25,7 @@ public class FormatSqlTextBlockVisitor extends JavaIsoVisitor
private final Dialect dialect;
private final FormatConfig formatConfig;
- FormatSqlTextBlockVisitor(Dialect dialect, FormatConfig formatConfig) {
+ public FormatSqlTextBlockVisitor(Dialect dialect, FormatConfig formatConfig) {
this.dialect = dialect;
this.formatConfig = formatConfig;
}
diff --git a/src/main/resources/META-INF/rewrite/examples.yml b/src/main/resources/META-INF/rewrite/examples.yml
index 215aa43..eb5cf4a 100644
--- a/src/main/resources/META-INF/rewrite/examples.yml
+++ b/src/main/resources/META-INF/rewrite/examples.yml
@@ -1,8 +1,8 @@
---
type: specs.openrewrite.org/v1beta/example
-recipeName: io.github.mhagnumdw.FormatSqlBlockRecipe
+recipeName: io.github.mhagnumdw.recipes.FormatSqlTextBlockByAnnotation
examples:
-- description: '`FormatSqlBlockRecipeTest#shouldFormatSimpleSqlBlock`'
+- description: '`FormatSqlTextBlockByAnnotationTest#shouldFormatSimpleSqlBlock`'
parameters:
- io/github/mhagnumdw/fake/holidays/HolidayRepository.java
- plsql
@@ -45,9 +45,9 @@ examples:
language: java
---
type: specs.openrewrite.org/v1beta/example
-recipeName: io.github.mhagnumdw.FormatSqlTextBlockRecipe
+recipeName: io.github.mhagnumdw.recipes.FormatSqlTextBlockByLanguageInjection
examples:
-- description: '`FormatSqlTextBlockRecipeTest#shouldFormatFieldWithLanguageSqlComment`'
+- description: '`FormatSqlTextBlockByLanguageInjectionTest#shouldFormatFieldWithLanguageSqlComment`'
parameters:
- io/github/mhagnumdw/test/*.java
- sql
diff --git a/src/test/java/io/github/mhagnumdw/FormatSqlFileRecipeTest.java b/src/test/java/io/github/mhagnumdw/recipes/FormatSqlFileTest.java
similarity index 93%
rename from src/test/java/io/github/mhagnumdw/FormatSqlFileRecipeTest.java
rename to src/test/java/io/github/mhagnumdw/recipes/FormatSqlFileTest.java
index 6e004dc..dd26a69 100644
--- a/src/test/java/io/github/mhagnumdw/FormatSqlFileRecipeTest.java
+++ b/src/test/java/io/github/mhagnumdw/recipes/FormatSqlFileTest.java
@@ -1,4 +1,4 @@
-package io.github.mhagnumdw;
+package io.github.mhagnumdw.recipes;
import static org.openrewrite.test.SourceSpecs.other;
import static org.openrewrite.test.SourceSpecs.text;
@@ -9,12 +9,12 @@
import org.openrewrite.test.RewriteTest;
@SuppressWarnings("java:S2699")
-class FormatSqlFileRecipeTest implements RewriteTest {
+class FormatSqlFileTest implements RewriteTest {
@Override
public void defaults(RecipeSpec spec) {
spec.recipe(
- new FormatSqlFileRecipe(
+ new FormatSqlFile(
"file.sql",
"plsql",
null,
@@ -85,7 +85,7 @@ void shouldNotChangeEmptyFile() {
@Test
void shouldFormatWithCustomOptions() {
rewriteRun(
- spec -> spec.recipe(new FormatSqlFileRecipe(null, "plsql", "\t", null, false)),
+ spec -> spec.recipe(new FormatSqlFile(null, "plsql", "\t", null, false)),
text(
"""
select e.emp_id, e.name, d.dept_name from employees e join departments d on e.dept_id = d.dept_id where e.salary > 50000;
diff --git a/src/test/java/io/github/mhagnumdw/FormatSqlBlockRecipeTest.java b/src/test/java/io/github/mhagnumdw/recipes/FormatSqlTextBlockByAnnotationTest.java
similarity index 98%
rename from src/test/java/io/github/mhagnumdw/FormatSqlBlockRecipeTest.java
rename to src/test/java/io/github/mhagnumdw/recipes/FormatSqlTextBlockByAnnotationTest.java
index 9dfaeee..ffcc017 100644
--- a/src/test/java/io/github/mhagnumdw/FormatSqlBlockRecipeTest.java
+++ b/src/test/java/io/github/mhagnumdw/recipes/FormatSqlTextBlockByAnnotationTest.java
@@ -1,4 +1,4 @@
-package io.github.mhagnumdw;
+package io.github.mhagnumdw.recipes;
import static java.util.Collections.emptySet;
import static java.util.Collections.singletonList;
@@ -15,12 +15,12 @@
import org.openrewrite.test.RewriteTest;
@SuppressWarnings("java:S2699")
-class FormatSqlBlockRecipeTest implements RewriteTest {
+class FormatSqlTextBlockByAnnotationTest implements RewriteTest {
@Override
public void defaults(RecipeSpec spec) {
spec.recipe(
- new FormatSqlBlockRecipe(
+ new FormatSqlTextBlockByAnnotation(
"io/github/mhagnumdw/fake/holidays/HolidayRepository.java",
"plsql",
null,
@@ -157,7 +157,7 @@ void shouldFormatSqlBlockWithTabs() {
rewriteRun(
spec -> spec.recipe(
- new FormatSqlBlockRecipe(
+ new FormatSqlTextBlockByAnnotation(
"io/github/mhagnumdw/fake/holidays/HolidayRepository.java",
"plsql",
"\t", // Use tab for SQL block indentation
diff --git a/src/test/java/io/github/mhagnumdw/FormatSqlTextBlockRecipeTest.java b/src/test/java/io/github/mhagnumdw/recipes/FormatSqlTextBlockByLanguageInjectionTest.java
similarity index 98%
rename from src/test/java/io/github/mhagnumdw/FormatSqlTextBlockRecipeTest.java
rename to src/test/java/io/github/mhagnumdw/recipes/FormatSqlTextBlockByLanguageInjectionTest.java
index 1b117b7..4efe2f4 100644
--- a/src/test/java/io/github/mhagnumdw/FormatSqlTextBlockRecipeTest.java
+++ b/src/test/java/io/github/mhagnumdw/recipes/FormatSqlTextBlockByLanguageInjectionTest.java
@@ -1,4 +1,4 @@
-package io.github.mhagnumdw;
+package io.github.mhagnumdw.recipes;
import static org.openrewrite.java.Assertions.java;
import static org.openrewrite.java.Assertions.javaVersion;
@@ -10,12 +10,12 @@
// SonarQube doesn't recognize internal assertions in rewriteRun()
@SuppressWarnings("java:S2699")
-class FormatSqlTextBlockRecipeTest implements RewriteTest {
+class FormatSqlTextBlockByLanguageInjectionTest implements RewriteTest {
@Override
public void defaults(RecipeSpec spec) {
spec.recipe(
- new FormatSqlTextBlockRecipe(
+ new FormatSqlTextBlockByLanguageInjection(
"io/github/mhagnumdw/test/*.java",
"sql",
null,