Skip to content

Commit f3a62a7

Browse files
authored
Merge pull request InsightSoftwareConsortium#5239 from thewtex/pre-commit-gh-action
ENH: Add pre-commit GitHub Action
2 parents 26943a9 + 2659871 commit f3a62a7

File tree

85 files changed

+1628
-4199
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+1628
-4199
lines changed

.clang-format

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## This config file is only relevant for clang-format version 19.1.4
1+
## This config file is only relevant for clang-format version 19.1.7
22
##
33
## Examples of each format style can be found on the in the clang-format documentation
44
## See: https://clang.llvm.org/docs/ClangFormatStyleOptions.html for details of each option
@@ -10,11 +10,11 @@
1010
## maintaining a consistent code style.
1111
##
1212
## EXAMPLE apply code style enforcement before commit:
13-
# Utilities/Maintenance/clang-format.bash --clang ${PATH_TO_CLANG_FORMAT_19.1.4} --modified
13+
# Utilities/Maintenance/clang-format.bash --clang ${PATH_TO_CLANG_FORMAT_19.1.7} --modified
1414
## EXAMPLE apply code style enforcement after commit:
15-
# Utilities/Maintenance/clang-format.bash --clang ${PATH_TO_CLANG_FORMAT_19.1.4} --last
15+
# Utilities/Maintenance/clang-format.bash --clang ${PATH_TO_CLANG_FORMAT_19.1.7} --last
1616
---
17-
# This configuration requires clang-format version 19.1.4 exactly.
17+
# This configuration requires clang-format version 19.1.7 exactly.
1818
Language: Cpp
1919
AccessModifierOffset: -2
2020
AlignAfterOpenBracket: Align

.github/workflows/pre-commit.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: pre-commit
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [master]
7+
8+
jobs:
9+
pre-commit:
10+
runs-on: ubuntu-24.04
11+
steps:
12+
- uses: actions/checkout@v4
13+
- name: Check install of Python, pre-commit
14+
run: |
15+
./Utilities/GitSetup/setup-precommit
16+
git config hooks.SetupForDevelopment 99
17+
git config user.email "you@example.com"
18+
git config user.name "Your Name"
19+
- uses: actions/setup-python@v5
20+
with:
21+
python-version: '3.12'
22+
- uses: pre-commit/action@v3.0.1

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ repos:
5757
- id: trailing-whitespace
5858
exclude: "\\.(sha|sha512|svg|vtk|vtp)$|\\/ThirdParty\\/|\\/Data\\/"
5959
- repo: https://github.com/pre-commit/mirrors-clang-format
60-
rev: v19.1.4
60+
rev: v19.1.7
6161
hooks:
6262
- id: clang-format
6363
args: ['--style=file']

Documentation/docs/releases/5.4.0.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ Unpack optional testing data in the same directory where the Library Source is u
136136
- Add `itk::Copy(const T & original)`, which simply returns a copy
137137
- Make `itk::ImageRegion` trivially copyable, remove inheritance (FUTURE)
138138
- `itk::VTKPolyDataMeshIO` support for reading VTK 5.1 format
139-
- Add `ITK_DEFAULT_COPY_AND_MOVE(TypeName)` macro definition
139+
- Add `ITK_DEFAULT_COPY_AND_MOVE(TypeName)` macro definition
140140
- Replace `(const std::string)` casts with C++17 `std::string_view`
141141
- Replace SetSize/Index calls in tests with `region{ index, size }`
142142
- Optionally limit an `ImageMask` to a specific pixel value
@@ -229,7 +229,7 @@ We extend our gratitude to all the ITK community members who have contributed to
229229
🗣️ What's Next
230230
---------------
231231

232-
ITK 5.4.0 represents a transformative milestone in our documentation journey. The finalization of 5.4.0 was delayed due to dependency issues in the example documentation's infrastructure. While these are addressed, we'll continue to refine the 5.4 series through patch releases. We're excited to eventually migrate the examples to a similar robust foundation in future innovations.
232+
ITK 5.4.0 represents a transformative milestone in our documentation journey. The finalization of 5.4.0 was delayed due to dependency issues in the example documentation's infrastructure. While these are addressed, we'll continue to refine the 5.4 series through patch releases. We're excited to eventually migrate the examples to a similar robust foundation in future innovations.
233233

234234
Looking ahead, we're thrilled to announce that ITK 6, our next major release, will showcase a substantial array of modernizations. The community has been hard at work implementing significant improvements that will elevate development with and on the toolkit. Watch for upcoming alpha and beta releases of ITK 6, which will run parallel to our 5.4 maintenance efforts.
235235

Examples/.clang-format

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## This config file is only relevant for clang-format version 19.1.4
1+
## This config file is only relevant for clang-format version 19.1.7
22
##
33
## Examples of each format style can be found on the in the clang-format documentation
44
## See: https://clang.llvm.org/docs/ClangFormatStyleOptions.html for details of each option
@@ -10,11 +10,11 @@
1010
## maintaining a consistent code style.
1111
##
1212
## EXAMPLE apply code style enforcement before commit:
13-
# Utilities/Maintenance/clang-format.bash --clang ${PATH_TO_CLANG_FORMAT_19.1.4} --modified
13+
# Utilities/Maintenance/clang-format.bash --clang ${PATH_TO_CLANG_FORMAT_19.1.7} --modified
1414
## EXAMPLE apply code style enforcement after commit:
15-
# Utilities/Maintenance/clang-format.bash --clang ${PATH_TO_CLANG_FORMAT_19.1.4} --last
15+
# Utilities/Maintenance/clang-format.bash --clang ${PATH_TO_CLANG_FORMAT_19.1.7} --last
1616
---
17-
# This configuration requires clang-format version 19.1.4 exactly.
17+
# This configuration requires clang-format version 19.1.7 exactly.
1818
Language: Cpp
1919
AccessModifierOffset: -2
2020
AlignAfterOpenBracket: Align

Modules/Core/Common/include/itkBufferedImageNeighborhoodPixelAccessPolicy.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ class BufferedImageNeighborhoodPixelAccessPolicy final
126126
{
127127
m_NeighborhoodAccessor.Set(imageBufferPointer + m_PixelIndexValue, pixelValue);
128128
}
129-
130129
};
131130

132131
} // namespace itk

Modules/Core/Common/include/itkCommonEnums.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,8 @@ class OctreeEnums
212212
*/
213213
enum class Octree : uint8_t
214214
{
215-
UNKNOWN_PLANE, ///< The plane is Unknown
216-
SAGITTAL_PLANE, ///< The plane is Sagittal
215+
UNKNOWN_PLANE, ///< The plane is Unknown
216+
SAGITTAL_PLANE, ///< The plane is Sagittal
217217
#if !defined(ITK_LEGACY_REMOVE)
218218
SAGITAL_PLANE [[deprecated("Use SAGITTAL_PLANE instead")]] = SAGITTAL_PLANE, ///< Support misspelling
219219
#endif

Modules/Core/Common/include/itkConnectedImageNeighborhoodShape.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,6 @@ class ConnectedImageNeighborhoodShape
248248
{
249249
return (includeCenterPixel ? 1 : 0) + CalculateNumberOfConnectedNeighbors(maximumCityblockDistance);
250250
}
251-
252251
};
253252

254253
/** Generates the offsets for a connected image neighborhood shape. */

Modules/Core/Common/include/itkConstantBoundaryImageNeighborhoodPixelAccessPolicy.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ class ConstantBoundaryImageNeighborhoodPixelAccessPolicy final
144144
m_NeighborhoodAccessor.Set(imageBufferPointer + m_PixelIndexValue, pixelValue);
145145
}
146146
}
147-
148147
};
149148

150149
} // namespace itk

Modules/Core/Common/include/itkContinuousIndex.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ class ITK_TEMPLATE_EXPORT ContinuousIndex : public Point<TCoordinate, VIndexDime
9090
(*this)[i] = static_cast<TCoordinate>(index[i]);
9191
}
9292
}
93-
9493
};
9594
} // namespace itk
9695

0 commit comments

Comments
 (0)