Skip to content

Add --unsafe-fixes to ruff-check formatter#2847

Merged
koxudaxi merged 1 commit intomainfrom
fix/add-unsafe-fixes-to-ruff-check
Dec 28, 2025
Merged

Add --unsafe-fixes to ruff-check formatter#2847
koxudaxi merged 1 commit intomainfrom
fix/add-unsafe-fixes-to-ruff-check

Conversation

@koxudaxi
Copy link
Copy Markdown
Owner

No description provided.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Dec 28, 2025

Warning

Rate limit exceeded

@koxudaxi has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 22 minutes and 33 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between d0f64f1 and 3042a79.

📒 Files selected for processing (2)
  • src/datamodel_code_generator/format.py
  • tests/test_format.py
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/add-unsafe-fixes-to-ruff-check

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown
Contributor

📚 Docs Preview: https://pr-2847.datamodel-code-generator.pages.dev

@koxudaxi koxudaxi enabled auto-merge (squash) December 28, 2025 19:19
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Dec 28, 2025

CodSpeed Performance Report

Merging #2847 will not alter performance

Comparing fix/add-unsafe-fixes-to-ruff-check (3042a79) with main (d0f64f1)

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

Summary

✅ 11 untouched
⏩ 98 skipped1

Footnotes

  1. 98 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@koxudaxi koxudaxi merged commit 7e00d0e into main Dec 28, 2025
35 checks passed
@koxudaxi koxudaxi deleted the fix/add-unsafe-fixes-to-ruff-check branch December 28, 2025 19:21
@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 28, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.49%. Comparing base (d0f64f1) to head (3042a79).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2847   +/-   ##
=======================================
  Coverage   99.49%   99.49%           
=======================================
  Files          90       90           
  Lines       14376    14376           
  Branches     1723     1723           
=======================================
  Hits        14304    14304           
  Misses         37       37           
  Partials       35       35           
Flag Coverage Δ
unittests 99.49% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions
Copy link
Copy Markdown
Contributor

Breaking Change Analysis

Result: Breaking changes detected

Reasoning: This PR changes the behavior of the ruff-check formatter by adding --unsafe-fixes to all ruff check invocations. Previously, only ruff's "safe" fixes were applied automatically. With this change, "unsafe" fixes are also applied. According to ruff's documentation, unsafe fixes are those that may change the behavior of code in ways that could be incorrect, such as removing unused imports (which might have side effects) or removing unused variables. This is a breaking change because users who previously relied on the conservative safe-only fix behavior will now get different generated code output, potentially affecting their downstream code that depends on the generated models.

Content for Release Notes

Code Generation Changes

  • Ruff unsafe fixes now applied automatically - When using the ruff-check formatter, the --unsafe-fixes flag is now passed to ruff, which enables fixes that may change code behavior in potentially incorrect ways. This includes removing unused imports that might have side effects, removing unused variables that could affect debugging, and other transformations ruff considers "unsafe". Users who relied on the previous conservative safe-only fix behavior may see different generated code output. To restore the previous behavior, users can configure ruff via pyproject.toml or ruff.toml to disable specific unsafe rules. (Add --unsafe-fixes to ruff-check formatter #2847)

This analysis was performed by Claude Code Action

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 1, 2026

🎉 Released in 0.51.0

This PR is now available in the latest release. See the release notes for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant