Skip to content

SG-44418 Replace flake8 with ruff for tk-core linting - #1125

Open
stevelittlefish wants to merge 3 commits into
masterfrom
ticket/SG-44418-add-ruff-precommit
Open

SG-44418 Replace flake8 with ruff for tk-core linting#1125
stevelittlefish wants to merge 3 commits into
masterfrom
ticket/SG-44418-add-ruff-precommit

Conversation

@stevelittlefish

Copy link
Copy Markdown
Contributor

Summary

  • Replace the flake8 pre-commit hook with ruff (ruff-check v0.16.0) for linting and code analysis
  • Move lint configuration from .flake8 to pyproject.toml, preserving the existing rule set and exclusions
  • Disable Hound Python linting (ruff is enforced via pre-commit and Azure CI)
  • Fix a handful of lint violations ruff catches that flake8 did not (E721 type comparisons, F601 duplicate dict key, E731 lambda assignment)

Azure CI requires no pipeline changes — tk-ci-tools already runs pre-commit run --all, which will pick up ruff automatically.

Jira: https://autodesk.atlassian.net/browse/SG-44418

Test plan

  • pre-commit run --all-files passes locally
  • Azure CI code style validation job passes

Made with Cursor

stevelittlefish and others added 2 commits July 27, 2026 12:38
Migrate pre-commit and CI linting from flake8 to ruff, preserving the
existing rule set and fixing a handful of violations ruff catches that
flake8 did not.

Co-authored-by: Cursor <cursoragent@cursor.com>
Consolidate import sorting and formatting into ruff-check and ruff-format,
and apply the new tooling across the repository.

Co-authored-by: Cursor <cursoragent@cursor.com>
@codecov

codecov Bot commented Jul 27, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.65217% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 80.08%. Comparing base (047a54c) to head (7cd3d12).

Files with missing lines Patch % Lines
python/tank/path_cache.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1125      +/-   ##
==========================================
- Coverage   80.11%   80.08%   -0.03%     
==========================================
  Files         203      203              
  Lines       19541    19525      -16     
==========================================
- Hits        15655    15637      -18     
- Misses       3886     3888       +2     
Flag Coverage Δ
Linux 79.52% <95.65%> (-0.02%) ⬇️
Python-3.10 79.90% <95.65%> (-0.02%) ⬇️
Python-3.11 79.79% <95.65%> (-0.02%) ⬇️
Python-3.13 79.79% <95.65%> (-0.02%) ⬇️
Python-3.9 79.86% <95.65%> (-0.03%) ⬇️
Windows 79.56% <95.65%> (-0.03%) ⬇️
macOS 79.49% <95.65%> (-0.02%) ⬇️

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

☔ View full report in Codecov by Harness.
📢 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.

@carlos-villavicencio-adsk carlos-villavicencio-adsk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me. I like the ruff style.

Comment thread .hound.yml Outdated
Comment thread pyproject.toml Outdated
Comment thread tests/util_tests/test_version_compare.py
Now that Python linting is fully handled by ruff via pre-commit and
Azure CI, .hound.yml served no remaining purpose (it only existed to
disable checks Hound no longer needs to run), so remove it entirely
per review feedback.

Also fixes the pyproject.toml copyright header year (2025 -> 2026).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.

3 participants