Skip to content

Some more recipes from OpenRewrite#15030

Merged
Siedlerchr merged 5 commits intomainfrom
add-openrewrite-recipies
Feb 5, 2026
Merged

Some more recipes from OpenRewrite#15030
Siedlerchr merged 5 commits intomainfrom
add-openrewrite-recipies

Conversation

@koppor
Copy link
Copy Markdown
Member

@koppor koppor commented Feb 4, 2026

User description

Should have no effect.

Mandatory checks


PR Type

Enhancement


Description

  • Add OpenRewrite recipes for code cleanup and modernization

  • Enable Guava, Java migration, and static analysis recipes

  • Add Picnic error-prone refaster rules for code improvements

  • Disable configuration cache in separate rewrite workflow


Diagram Walkthrough

flowchart LR
  A["rewrite.yml"] -->|Add recipes| B["Java migration recipes"]
  A -->|Add recipes| C["Static analysis recipes"]
  A -->|Add recipes| D["Testing cleanup recipes"]
  A -->|Add recipes| E["Picnic refaster rules"]
  F["run-openrewrite.yml"] -->|Disable cache| G["Gradle rewrite task"]
Loading

File Walkthrough

Relevant files
Enhancement
rewrite.yml
Expand OpenRewrite recipe collection significantly             

rewrite.yml

  • Added 20+ new OpenRewrite recipes across multiple categories
  • Enabled Guava migration, Java language features, and static analysis
    recipes
  • Added Picnic error-prone refaster rules for string and class handling
  • Reorganized and uncommented previously disabled recipes with version
    tracking
+36/-5   
Configuration changes
run-openrewrite.yml
Disable configuration cache in rewrite workflow                   

.github/workflows/run-openrewrite.yml

  • Added --no-configuration-cache flag to Gradle rewrite task
  • Prevents configuration cache issues in separate workflow execution
+1/-1     

@koppor koppor added the dev: code-quality Issues related to code or architecture decisions label Feb 4, 2026
@qodo-free-for-open-source-projects
Copy link
Copy Markdown
Contributor

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
🟢
No security concerns identified No security vulnerabilities detected by AI analysis. Human verification advised for critical code.
Ticket Compliance
🎫 No ticket provided
  • Create ticket/issue
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
🟢
Generic: Comprehensive Audit Trails

Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Meaningful Naming and Self-Documenting Code

Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Robust Error Handling and Edge Case Management

Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Error Handling

Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Logging Practices

Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Security-First Input Validation and Data Handling

Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label

@qodo-free-for-open-source-projects
Copy link
Copy Markdown
Contributor

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Remove recipe that incorrectly changes behavior

Remove the PreferSystemGetPropertyOverGetenv recipe because it incorrectly
replaces System.getenv() with System.getProperty(), which are not
interchangeable and will likely break functionality.

rewrite.yml [178]

-- org.openrewrite.staticanalysis.PreferSystemGetPropertyOverGetenv
+# - org.openrewrite.staticanalysis.PreferSystemGetPropertyOverGetenv
  • Apply / Chat
Suggestion importance[1-10]: 10

__

Why: The suggestion correctly points out that the PreferSystemGetPropertyOverGetenv recipe is dangerous as it incorrectly equates system properties with environment variables, which could introduce subtle and critical runtime bugs.

High
Remove non-existent OpenRewrite recipe

Remove the non-existent OpenRewrite recipe
org.openrewrite.java.testing.cleanup.AssertLiteralBooleanRemovedRecipe to
prevent the rewrite process from failing.

rewrite.yml [227-228]

 - org.openrewrite.java.testing.cleanup.AssertLiteralBooleanToFailRecipes
-- org.openrewrite.java.testing.cleanup.AssertLiteralBooleanRemovedRecipe
  • Apply / Chat
Suggestion importance[1-10]: 9

__

Why: The suggestion correctly identifies a non-existent OpenRewrite recipe (AssertLiteralBooleanRemovedRecipe) which would cause the CI workflow to fail, thus preventing the PR from being effective.

High
High-level
Introduce new refactoring rules incrementally

The suggestion advises against enabling numerous OpenRewrite recipes at once, as
this will create a large, difficult-to-review automated pull request. It
recommends introducing the new rules in smaller, themed batches for better
manageability.

Examples:

rewrite.yml [108-255]
  - org.openrewrite.java.migrate.guava.NoMapsAndSetsWithExpectedSize

  - org.openrewrite.java.migrate.io.ReplaceFileInOrOutputStreamFinalizeWithClose
  - org.openrewrite.java.migrate.lang.StringFormatted
  - org.openrewrite.java.migrate.lang.SwitchCaseAssignmentsToSwitchExpression
  - org.openrewrite.java.migrate.lang.SwitchCaseReturnsToSwitchExpression
  - org.openrewrite.java.migrate.lang.SwitchExpressionYieldToArrow
  - org.openrewrite.java.migrate.net.JavaNetAPIs
  - org.openrewrite.java.migrate.net.URLConstructorToURICreate
  - org.openrewrite.java.migrate.net.URLConstructorsToNewURI

 ... (clipped 138 lines)

Solution Walkthrough:

Before:

# rewrite.yml
---
type: specs.openrewrite.org/v1beta/recipe
name: org.jabref.config.rewrite.cleanup
recipeList:
  # Enable many rules at once
  - org.openrewrite.java.migrate.guava.NoMapsAndSetsWithExpectedSize
  - org.openrewrite.java.migrate.lang.StringFormatted
  - org.openrewrite.java.migrate.lang.SwitchCaseAssignmentsToSwitchExpression
  # ... many more migration rules
  - org.openrewrite.staticanalysis.PreferEqualityComparisonOverDifferenceCheck
  - org.openrewrite.staticanalysis.SimplifyBooleanExpression
  # ... many more static analysis rules
  - tech.picnic.errorprone.refasterrules.StringRulesRecipes$EmptyStringRecipe
  # ... many more picnic rules

After:

# rewrite.yml (in the first of several PRs)
---
type: specs.openrewrite.org/v1beta/recipe
name: org.jabref.config.rewrite.cleanup
recipeList:
  # Enable a small, thematic batch of rules
  - org.openrewrite.java.migrate.lang.StringFormatted
  - org.openrewrite.java.migrate.lang.SwitchCaseAssignmentsToSwitchExpression
  - org.openrewrite.java.migrate.lang.SwitchCaseReturnsToSwitchExpression
  - org.openrewrite.java.migrate.lang.SwitchExpressionYieldToArrow

  # Thematic batches for future PRs remain commented out
  # - org.openrewrite.staticanalysis.SimplifyBooleanExpression
  # - org.openrewrite.staticanalysis.SimplifyBooleanReturn
  # - tech.picnic.errorprone.refasterrules.StringRulesRecipes$EmptyStringRecipe
Suggestion importance[1-10]: 8

__

Why: The suggestion correctly identifies the significant risk of enabling many refactoring rules at once, which can lead to a massive, hard-to-review automated PR, and proposes a safer, incremental approach.

Medium
  • More

@koppor koppor added the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Feb 4, 2026
@koppor koppor changed the title Some more recrecipes from OpenRewrite. Some more recipes from OpenRewrite Feb 4, 2026

- name: Run rewrite
run: ./gradlew rewriteRun
run: ./gradlew --no-configuration-cache :rewriteRun
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really not working with cofniguration cache?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I tried out locally.

@Siedlerchr Siedlerchr enabled auto-merge February 5, 2026 17:16
@Siedlerchr Siedlerchr added this pull request to the merge queue Feb 5, 2026
@github-actions github-actions Bot added the status: to-be-merged PRs which are accepted and should go into the merge-queue. label Feb 5, 2026
Merged via the queue into main with commit 8cad3c5 Feb 5, 2026
103 of 114 checks passed
@Siedlerchr Siedlerchr deleted the add-openrewrite-recipies branch February 5, 2026 17:39
Siedlerchr added a commit to Jalina2007/jabref that referenced this pull request Feb 5, 2026
…4902

* upstream/main: (23 commits)
  Some more recipes from OpenRewrite (JabRef#15030)
  feat: Add PDF Upload endpoint to EntryResource (JabRef#14963)
  Heuristics also used at batch (JabRef#15025)
  Fix cleanup-pr.yml
  New Crowdin updates (JabRef#15035)
  Use patched Gradle version (JabRef#15034)
  Add OpenAlex-based Citation Fetcher (JabRef#15023)
  Update null annotaitons at EntryBasedFetcher (JabRef#15024)
  Fix CHANGELOG.md test
  Use _ for unused variables (JabRef#15028)
  Use ubuntu-latest for checkstyle and javadoc
  Update Gradle Wrapper from 9.3.0-jabref-2 to 9.3.1 (JabRef#15021)
  Use "ubuntu-slim" for most workflows (JabRef#15019)
  Refine GroupsTree (JabRef#15013)
  New Crowdin updates (JabRef#15018)
  Added Clear group option (JabRef#15017)
  Chore(deps): Bump com.uber.nullaway:nullaway from 0.12.15 to 0.13.1 in /versions (JabRef#15006)
  Chore(deps): Bump tools.jackson:jackson-bom in /versions (JabRef#15007)
  No rush in Docker building
  Yaml issue workaround
  ...
Siedlerchr added a commit that referenced this pull request Feb 8, 2026
…es/jablib/src/main/resources/csl-styles-6c79ffe

* upstream/main: (68 commits)
  Chore(deps): Bump org.apache.httpcomponents.client5:httpclient5 (#15060)
  Chore(deps): Bump com.google.errorprone:error_prone_core in /versions (#15059)
  Chore(deps): Bump de.undercouch.download:de.undercouch.download.gradle.plugin (#15057)
  Chore(deps): Bump org.postgresql:postgresql in /versions (#15058)
  Chore(deps): Bump de.undercouch.download:de.undercouch.download.gradle.plugin (#15056)
  Updates on Wednesday, not on Sunday
  Add screenshot requirement (#15050)
  Switch image for javadoc
  Better docker layer caching during build (#15042)
  New Crowdin updates (#15045)
  Chore: reuse shared 'setup-gradle' in all places in test-code.yml (#15043)
  Chore: add 'testlens-app/setup-testlens' GH action (#15044)
  Add: HTTP Server and LSP server toggles to quick settings (#14972)
  Some more recipes from OpenRewrite (#15030)
  feat: Add PDF Upload endpoint to EntryResource (#14963)
  Heuristics also used at batch (#15025)
  Fix cleanup-pr.yml
  New Crowdin updates (#15035)
  Use patched Gradle version (#15034)
  Add OpenAlex-based Citation Fetcher (#15023)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dev: code-quality Issues related to code or architecture decisions Review effort 2/5 status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers status: to-be-merged PRs which are accepted and should go into the merge-queue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants