pytorch - ✅(Solved) Fix [CI] Linter do not continuously checks for errors [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
pytorch/pytorch#178341Fetched 2026-04-08 01:26:06
View on GitHub
Comments
0
Participants
1
Timeline
47
Reactions
0
Author
Participants
Timeline (top)
subscribed ×28labeled ×8mentioned ×8unlabeled ×2

Fix Action

Fix / Workaround

I've noticed this while running lint on https://github.com/pytorch/pytorch/pull/178339

git checkout 27610bb2baed064d9f0504b2145cfbf981a0a87d
touch c10/test/core/DispatchKeySet_test.cpp
lintrunner --take RAWTHROW

PR fix notes

PR #178339: [c10] Use .contains() instead of .count()/.find() idioms

Description (problem / solution / changelog)

Stack from ghstack (oldest at bottom):

  • -> #178339
  • #178343

Replace .count(x) != 0, .count(x) > 0, and .count(x) == 0 with the clearer C++20 .contains() on std::unordered_map and std::unordered_set in c10.

Authored with Claude.

Changed files

  • c10/cuda/CUDACachingAllocator.cpp (modified, +1/-1)
  • c10/test/core/DispatchKeySet_test.cpp (modified, +2/-2)
  • c10/util/Registry.h (modified, +2/-2)
  • c10/xpu/XPUCachingAllocator.cpp (modified, +1/-1)

Code Example

git checkout 27610bb2baed064d9f0504b2145cfbf981a0a87d
touch c10/test/core/DispatchKeySet_test.cpp
lintrunner --take RAWTHROW
RAW_BUFFERClick to expand / collapse

🐛 Describe the bug

I've noticed this while running lint on https://github.com/pytorch/pytorch/pull/178339

git checkout 27610bb2baed064d9f0504b2145cfbf981a0a87d
touch c10/test/core/DispatchKeySet_test.cpp
lintrunner --take RAWTHROW

Based on the rules lintrunner should always run, but it does not

Also, I've accidentally committed https://github.com/pytorch/pytorch/commit/5834815f5bcff34ff84723f92c5aec9f9dd23227

which should have broken the lint, and it showed one as such on the commit, but it disappeared on the next commit, see https://hud.pytorch.org/hud/pytorch/pytorch/9bff6e149a649234c146fdae8058fb035bfb43b7/1?per_page=50&name_filter=lintrunner-clang-all&mergeEphemeralLF=true

Versions

CI

cc @seemethere @pytorch/pytorch-dev-infra

extent analysis

Fix Plan

The fix involves updating the lintrunner configuration to ensure it always runs when necessary.

Step-by-Step Solution

  • Update the lintrunner configuration file to include the c10/test/core/DispatchKeySet_test.cpp file in the list of files to be checked.
  • Add a rule to the lintrunner configuration to always run when a file in the c10/test/core directory is modified.

Example code snippet:

# lintrunner_config.py
import os

def get_lint_rules():
    rules = []
    # Add rule to always run when a file in c10/test/core is modified
    rules.append({
        'pattern': r'c10/test/core/.*',
        'linters': ['clang']
    })
    return rules
  • Update the lintrunner command to use the updated configuration file.
lintrunner --config lintrunner_config.py --take RAWTHROW

Verification

To verify the fix, run the following command:

git checkout 27610bb2baed064d9f0504b2145cfbf981a0a87d
touch c10/test/core/DispatchKeySet_test.cpp
lintrunner --config lintrunner_config.py --take RAWTHROW

The lintrunner should now run and report any lint errors.

Extra Tips

  • Make sure to update the lintrunner configuration file to include all necessary files and directories.
  • Use the --config option to specify the configuration file when running the lintrunner command.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

pytorch - ✅(Solved) Fix [CI] Linter do not continuously checks for errors [1 pull requests, 1 participants]