Skip to content

chore: Enable the C408 lint in ruff - #3362

Merged
mdboom merged 1 commit into
NVIDIA:mainfrom
mdboom:remove-c408
Nov 4, 2026
Merged

mdboom merged 1 commit into
NVIDIA:mainfrom
mdboom:remove-c408

Conversation

@mdboom

@mdboom mdboom commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

After implementing #3360, I decided to audit our other disabled ruff lints.

C408 catches potential performance issues, so should be re-enabled. Dictionary literals have special bytecodes for their construction and may be constant-constructed if all of the keys and values are also immutable constants. dict() can not perform such guarantees (dict itself could be overridden).

None of the fixes here are on hot paths (they are mostly in test code), so I don't consider anything here a performance improvement, but having this lint turned on will help us find performance opportunities in the future.

@mdboom mdboom added this to the CI milestone Nov 4, 2026
@github-actions github-actions Bot added the cuda.core Everything related to the cuda.core module label Nov 4, 2026
@mdboom mdboom self-assigned this Nov 4, 2026
@mdboom mdboom added the CI/CD CI/CD infrastructure label Nov 4, 2026
@mdboom
mdboom requested a review from juenglin November 4, 2026 14:26
@coderabbitai

coderabbitai Bot commented Nov 4, 2026

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Style

    • Updated several test cases to use consistent dictionary literal formatting.
    • Adjusted linting rules for dictionary construction patterns.
  • Tests

    • Test inputs and expected behavior remain unchanged.

The global Ruff configuration no longer ignores C408. Three mappings in tests and a helper now use dictionary literals instead of dict() calls. Their keys, values, and test expectations remain unchanged.

Changes: Ruff C408 cleanup

Layer / File(s) Summary
Enable C408 and update mappings
ruff.toml, cuda_core/tests/test_program_cache.py, cuda_core/tests/test_tensor_map.py, cuda_python_test_helpers/cuda_python_test_helpers/cython_cache.py
The global ignore list no longer suppresses C408. Three mappings use dictionary literals with unchanged contents and test expectations.

Suggested reviewers: cpcloud

Change: Other

Merge Risk: Minimal · up to fc8ec

No actionable risk remains; the cleanup is safe to merge.

- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between deb3d04 and fc8ec8f.

Files selected for processing: 4
  • cuda_core/tests/test_program_cache.py
  • cuda_core/tests/test_tensor_map.py
  • cuda_python_test_helpers/cuda_python_test_helpers/cython_cache.py
  • ruff.toml
Files with no reviewable changes: 1
  • ruff.toml

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 10 remain after this review.

@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor
Doc Preview CI
Preview removed because the pull request was closed or merged.

@juenglin juenglin 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.

Good to know!

@mdboom
mdboom merged commit f707a1f into NVIDIA:main Nov 4, 2026
222 of 225 checks passed
github-actions Bot pushed a commit that referenced this pull request Nov 5, 2026
Removed preview folders for the following PRs:
- PR #3134
- PR #3240
- PR #3272
- PR #3326
- PR #3349
- PR #3352
- PR #3354
- PR #3360
- PR #3362
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI/CD CI/CD infrastructure cuda.core Everything related to the cuda.core module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants