Skip to content

chore: Enable ty unused-ignore-comment rule - #1858

Merged
vdusek merged 2 commits into
masterfrom
chore/enable-unused-ignore-comment-rule
Apr 27, 2026
Merged

chore: Enable ty unused-ignore-comment rule#1858
vdusek merged 2 commits into
masterfrom
chore/enable-unused-ignore-comment-rule

Conversation

@vdusek

@vdusek vdusek commented Apr 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

Now that ty supports detecting unused suppression comments (upstream issues astral-sh/ty#278 and astral-sh/ty#1501 are closed), enable the unused-ignore-comment rule project-wide so obsolete # ty: ignore[...] comments are caught automatically.

Verified that all current # ty: ignore[...] suppressions in the codebase are still required (none had to be removed).

Closes #1664.

Now that ty supports detecting unused suppression comments (upstream
issues astral-sh/ty#278 and astral-sh/ty#1501 are closed), enable the
rule project-wide so obsolete `# ty: ignore[...]` comments are caught
automatically. Verified all current suppressions are still required.

Closes #1664.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vdusek vdusek added t-tooling Issues with this label are in the ownership of the tooling team. adhoc Ad-hoc unplanned task added during the sprint. labels Apr 27, 2026
@vdusek vdusek self-assigned this Apr 27, 2026
@vdusek
vdusek requested a review from Pijukatel April 27, 2026 07:57
@github-actions github-actions Bot added this to the 139th sprint - Tooling team milestone Apr 27, 2026
@vdusek

vdusek commented Apr 27, 2026

Copy link
Copy Markdown
Collaborator Author

Tested:

% poe type-check
Poe => uv run ty check
error[[unused-ignore-comment](https://ty.dev/rules#unused-ignore-comment)]: Unused `ty: ignore` directive                  --> src/crawlee/_request.py:84:72
   |
82 |         return self.__pydantic_extra__[key]
83 |
84 |     def __setitem__(self, key: str, value: JsonSerializable) -> None:  # ty: ignore[invalid-method-override]
   |                                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
85 |         if key == 'label':
86 |             if value is not None and not isinstance(value, str):
   |
help: Remove the unused suppression comment
81 |     def __getitem__(self, key: str) -> JsonSerializable:
82 |         return self.__pydantic_extra__[key]
83 |
   -     def __setitem__(self, key: str, value: JsonSerializable) -> None:  # ty: ignore[invalid-method-override]
84 +     def __setitem__(self, key: str, value: JsonSerializable) -> None:
85 |         if key == 'label':
86 |             if value is not None and not isinstance(value, str):
87 |                 raise ValueError('`label` must be str or None')

Found 1 diagnostic

@codecov

codecov Bot commented Apr 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.36%. Comparing base (983f14f) to head (a3f1949).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1858      +/-   ##
==========================================
- Coverage   92.41%   92.36%   -0.05%     
==========================================
  Files         158      158              
  Lines       11009    11009              
==========================================
- Hits        10174    10169       -5     
- Misses        835      840       +5     
Flag Coverage Δ
unit 92.36% <ø> (-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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vdusek
vdusek merged commit 3c594fe into master Apr 27, 2026
30 checks passed
@vdusek
vdusek deleted the chore/enable-unused-ignore-comment-rule branch April 27, 2026 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Revisit type: ignore comments once ty supports unused ignore detection

3 participants