InsightSoftwareConsortium / InsightSoftwareConsortium/ITK
STYLE: Complete the declare-then-assign sweep beyond #6014's 42 files
- Dominant language
- C++
- Stars
- 1.7k
- Forks
- 748
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 64
Description
#6014 converted declare-then-assign to initialization-at-declaration across 42 files. A follow-up scan indicates the sweep is incomplete, but the residual count needs restating with an explicit predicate before the work is scoped.
Count — and why the previously circulated number is wrong
A local note carried an estimate of **"~65 more candidates"**. That figure is
unsupported and should not be used. Re-scanning during a 2026-07-29 audit
produced substantially fewer:
| Predicate | Sites |
|---|---|
| Strict adjacency (declaration immediately followed by assignment) | **21** |
| Relaxed (skipping intervening comments; wider type set) | **31** |
These were derived by an automated pass and have **not** been independently
reproduced. The first work item is therefore to fix the predicate and publish
it, so the number is re-derivable the way #6388's scanner is.
Proposed work
1. State the exact predicate (which types, what counts as "adjacent",
whether comments/blank lines break the pair) and publish the scanner
alongside the count.
2. Convert the sites the predicate selects, respecting the hazard in the
companion documentation issue: `T x = expr;` is *construction*, not
assignment, so tests that deliberately exercise `operator=` must keep the
two-line form.
3. Skip any site where the variable is later mutated, or use the explicit-type
form rather than `auto`.
Contributor guide
Research direction
Start by reading the prior sweep in #6014 and the scanner referenced in #6388; the issue names no source files. First make the predicate and scanner reproducible, including adjacency and type rules, then verify the count before reviewing selected sites. Done means the published scan is re-derivable and safe conversions preserve cases that test operator=.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- tooling
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100