Skip to content

Fix Ruff linter violations across the codebase#172

Merged
yunzheng merged 11 commits intofox-it:mainfrom
B0TAxy:fix/ruff_errors
Jun 22, 2025
Merged

Fix Ruff linter violations across the codebase#172
yunzheng merged 11 commits intofox-it:mainfrom
B0TAxy:fix/ruff_errors

Conversation

@B0TAxy
Copy link
Contributor

@B0TAxy B0TAxy commented Jun 19, 2025

This PR addresses and fixes multiple Ruff linter warnings and errors to improve code quality and consistency across the project. The changes include:

  • Adding missing tz parameters to datetime.now() calls to ensure timezone-aware datetimes (DTZ005).
  • Replacing deprecated or discouraged patterns according to the active Ruff ruleset.
  • Formatting code to comply with style rules (e.g., unused imports, quote styles, whitespace issues).
  • General cleanup to reduce lint noise and prevent potential runtime issues.

No functional changes were made — these updates are strictly linter-related.

Copy link
Member

@yunzheng yunzheng left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, the example scripts were long overdue for this.

I added some small suggestions.

@B0TAxy B0TAxy requested a review from yunzheng June 22, 2025 11:00
Copy link
Member

@yunzheng yunzheng left a comment

Choose a reason for hiding this comment

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

There are still some tests failing when I run tox -e py3, could you look into this?

I think mainly due to some imports that have moved to global imports. If that caused the side effect I think for now it would be better to change it back and add a specific # noqa: flag to the inline import.

@codecov
Copy link

codecov bot commented Jun 22, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.95%. Comparing base (6e8c6db) to head (fe15422).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #172      +/-   ##
==========================================
+ Coverage   82.90%   82.95%   +0.05%     
==========================================
  Files          34       34              
  Lines        3592     3591       -1     
==========================================
+ Hits         2978     2979       +1     
+ Misses        614      612       -2     
Flag Coverage Δ
unittests 82.95% <100.00%> (+0.05%) ⬆️

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.

@B0TAxy B0TAxy requested a review from yunzheng June 22, 2025 12:50
@B0TAxy
Copy link
Contributor Author

B0TAxy commented Jun 22, 2025

There are still some tests failing when I run tox -e py3, could you look into this?

I think mainly due to some imports that have moved to global imports. If that caused the side effect I think for now it would be better to change it back and add a specific # noqa: flag to the inline import.

You're right — I moved the imports back inside the functions since placing them at the top-level causes some tests to fail, though the exact reason isn't clear. The current version of Ruff doesn't flag these as violations, but newer versions do, so we should revisit this and possibly add # noqa once we upgrade.

Copy link
Member

@yunzheng yunzheng left a comment

Choose a reason for hiding this comment

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

LGTM

@yunzheng yunzheng merged commit 8fe4343 into fox-it:main Jun 22, 2025
24 checks passed
@B0TAxy B0TAxy deleted the fix/ruff_errors branch December 24, 2025 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants