Repository navigation
feat: point out hotspots among the files a PR changes - #91
Merged
Merged
Conversation
A new Hotspots check, with a context dimension of its own. It reads each changed code file's commits in the year before the merge base and notes files that had a change reverted in the last 90 days, keep needing fixes, or change far more often than most. A hotspot ranks higher on the review path and says why. History comes from wherever it is: the repository for local reviews, and the host for hosted ones, whose depth-1 fetch has none. GitHub answers for up to 20 files in one GraphQL query, and GitLab lists each file's commits. Offline, without a GitHub token, or in a shallow clone, the check is listed as not run. It can be turned off in Settings, which now also lists the file paths it sends to the host.
|
| At a glance | |
|---|---|
| Changes | 87 code units to review |
| Used elsewhere | 100 places this PR did not touch use code it changed |
| Checks | 11 ran: 1 with issues, 10 clean |
| Severity | Finding | Where |
|---|---|---|
| 🟠 Medium | Large change: 595 lines | This PR |
Open the full report. It's a single HTML file; if it downloads, open it in a browser.
Was this useful? React with 👍 or 👎.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Item 7 on the roadmap: hotspots. A new Hotspots check with a
contextdimension of its own. It's not a security finding and not a checklist question, but a hotspot file ranks higher on the review path and gives the reason.Rules
For each changed code file that existed before the PR (up to 60, leaving out tests, vendored and generated files), Walkdiff reads its commits in the 365 days before the merge base, so the PR's own commits never count.
hotspot.recently-revertedhotspot.fix-pronehotspot.churnWhat counts as a fix: "fix", "bug", "hotfix", "regression", "crash" or "broken" in the subject (conventional
fix:andfix(scope):included). Subjects about typos, lint, formatting, docs, tests, CI, builds or dependencies don't count, and neither do reverts.The limits are judgement calls, commented as such, chosen so a file has to stand out.
Where history comes from
Engine checks get a
FileHistoryReader(defined in review-model, so providers can implement it without depending on the engine):gitHistoryReaderruns onegit log --name-onlyper 200 paths. A shallow repository raisesHistoryUnavailableError.history(path:, since:, first: 100)on the merge-base commit, with paths passed as variables. It needs a token.repository/commits?ref_name=&path=&since=per file, 6 at a time.HistoryUnavailableError.Whenever history can't be read, the Risks tab lists Hotspots under "Not checked" with why. The review itself never fails over it.
Settings: a new
CheckId.Hotspotslets people turn it off. Its catalog entry says it sends "paths of the files a PR changes" to the PR's host, so the privacy list in Settings shows it.Tried on real PRs
plugins/html.ts: often fixed, 14 of 27optimizer/index.ts: 13 of 27, by 18 peopleoptimizer/index.ts(14 of 28) andoptimizer/scan.ts(8 of 16)Tests
analyzeChangedFilesbreakingChanges.test.ts, which also times out onmainon this machine. CI is the full check.README and the site manual describe the check and its sources.