Skip to content

STYLE: Replace T v = T(a, b) variable declarations with T v(a, b)#5830

Merged
thewtex merged 1 commit intoInsightSoftwareConsortium:mainfrom
N-Dekker:Avoid-same-type-name-twice-in-variable-declaration
Feb 25, 2026
Merged

STYLE: Replace T v = T(a, b) variable declarations with T v(a, b)#5830
thewtex merged 1 commit intoInsightSoftwareConsortium:mainfrom
N-Dekker:Avoid-same-type-name-twice-in-variable-declaration

Conversation

@N-Dekker
Copy link
Copy Markdown
Contributor

Replaced (\w+)([ ]+\w+) = \1(\(.+\);) with $1$2$3 in itk*.hxx files, using regular expressions.

Aims to avoid having the very same type name twice in a single variable declaration, following the "DRY principle".

@github-actions github-actions Bot added area:Filtering Issues affecting the Filtering module area:Segmentation Issues affecting the Segmentation module type:Style Style changes: no logic impact (indentation, comments, naming) labels Feb 24, 2026
@N-Dekker N-Dekker marked this pull request as ready for review February 24, 2026 16:23
@N-Dekker N-Dekker force-pushed the Avoid-same-type-name-twice-in-variable-declaration branch from dd676b5 to 30a1965 Compare February 24, 2026 23:09
@N-Dekker
Copy link
Copy Markdown
Contributor Author

Last minute force-push, including types that are instantiated template classes 😺

@N-Dekker N-Dekker marked this pull request as draft February 25, 2026 08:20
@N-Dekker N-Dekker force-pushed the Avoid-same-type-name-twice-in-variable-declaration branch from 30a1965 to d3a5c5f Compare February 25, 2026 08:33
Using Notepad++, Replace in Files, doing

  Find what: ` (\w+)([ ]+\w+) = \1(\(.+\);)`
  Replace with: ` $1$2$3`
  Find what: `  (\w+<.*>)([ ]+\w+) = \1(\(.+\);)`
  Replace with: `  $1$2$3`
  Find what: ` (\w+<\w+>)([ ]+\w+) =\r\n[ ]+\1(\()`
  Replace with: ` $1$2$3`
  [v] Match case
  (*) Regular expression

Aims to avoid having the very same type name twice in a single variable
declaration, following the "DRY principle" ("Don't Repeat Yourself") .
@N-Dekker
Copy link
Copy Markdown
Contributor Author

Included variable declarations that have a line break, with this force-push!

@N-Dekker N-Dekker force-pushed the Avoid-same-type-name-twice-in-variable-declaration branch from d3a5c5f to 45d4afd Compare February 25, 2026 08:41
@N-Dekker N-Dekker marked this pull request as ready for review February 25, 2026 08:41
@github-actions github-actions Bot added the area:Numerics Issues affecting the Numerics module label Feb 25, 2026
@thewtex thewtex merged commit 6f3ce70 into InsightSoftwareConsortium:main Feb 25, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:Filtering Issues affecting the Filtering module area:Numerics Issues affecting the Numerics module area:Segmentation Issues affecting the Segmentation module type:Style Style changes: no logic impact (indentation, comments, naming)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants