Skip to content

Commit c156c7c

Browse files
authored
Merge pull request #115 from dzenanz/master
2 parents 9545ae4 + 8dc3bff commit c156c7c

File tree

5 files changed

+184
-8
lines changed

5 files changed

+184
-8
lines changed
Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
## This config file is only relevant for clang-format version 8.0.0
2+
##
3+
## Examples of each format style can be found on the in the clang-format documentation
4+
## See: https://clang.llvm.org/docs/ClangFormatStyleOptions.html for details of each option
5+
##
6+
## The clang-format binaries can be downloaded as part of the clang binary distributions
7+
## from http://releases.llvm.org/download.html
8+
##
9+
## Use the script Utilities/Maintenance/clang-format.bash to faciliate
10+
## maintaining a consistent code style.
11+
##
12+
## EXAMPLE apply code style enforcement before commit:
13+
# Utilities/Maintenance/clang-format.bash --clang ${PATH_TO_CLANG_FORMAT_8.0.0} --modified
14+
## EXAMPLE apply code style enforcement after commit:
15+
# Utilities/Maintenance/clang-format.bash --clang ${PATH_TO_CLANG_FORMAT_8.0.0} --last
16+
---
17+
# This configuration requires clang-format version 8.0.0 exactly.
18+
BasedOnStyle: Mozilla
19+
Language: Cpp
20+
AccessModifierOffset: -2
21+
AlignAfterOpenBracket: Align
22+
AlignConsecutiveAssignments: false
23+
AlignConsecutiveDeclarations: true
24+
AlignEscapedNewlines: Right
25+
AlignOperands: true
26+
AlignTrailingComments: true
27+
# clang 9.0 AllowAllArgumentsOnNextLine: true
28+
# clang 9.0 AllowAllConstructorInitializersOnNextLine: true
29+
AllowAllParametersOfDeclarationOnNextLine: false
30+
AllowShortBlocksOnASingleLine: false
31+
AllowShortCaseLabelsOnASingleLine: false
32+
AllowShortFunctionsOnASingleLine: Inline
33+
# clang 9.0 AllowShortLambdasOnASingleLine: All
34+
# clang 9.0 features AllowShortIfStatementsOnASingleLine: Never
35+
AllowShortIfStatementsOnASingleLine: false
36+
AllowShortLoopsOnASingleLine: false
37+
AlwaysBreakAfterDefinitionReturnType: None
38+
AlwaysBreakAfterReturnType: All
39+
AlwaysBreakBeforeMultilineStrings: false
40+
AlwaysBreakTemplateDeclarations: Yes
41+
BinPackArguments: false
42+
BinPackParameters: false
43+
BreakBeforeBraces: Custom
44+
BraceWrapping:
45+
# clang 9.0 feature AfterCaseLabel: false
46+
AfterClass: true
47+
AfterControlStatement: true
48+
AfterEnum: true
49+
AfterFunction: true
50+
AfterNamespace: true
51+
AfterObjCDeclaration: true
52+
AfterStruct: true
53+
AfterUnion: true
54+
AfterExternBlock: true
55+
BeforeCatch: true
56+
BeforeElse: true
57+
## This is the big change from historical ITK formatting!
58+
# Historically ITK used a style similar to https://en.wikipedia.org/wiki/Indentation_style#Whitesmiths_style
59+
# with indented braces, and not indented code. This style is very difficult to automatically
60+
# maintain with code beautification tools. Not indenting braces is more common among
61+
# formatting tools.
62+
IndentBraces: false
63+
SplitEmptyFunction: false
64+
SplitEmptyRecord: false
65+
SplitEmptyNamespace: false
66+
BreakBeforeBinaryOperators: None
67+
#clang 6.0 BreakBeforeInheritanceComma: true
68+
BreakInheritanceList: BeforeComma
69+
BreakBeforeTernaryOperators: true
70+
#clang 6.0 BreakConstructorInitializersBeforeComma: true
71+
BreakConstructorInitializers: BeforeComma
72+
BreakAfterJavaFieldAnnotations: false
73+
BreakStringLiterals: true
74+
## The following line allows larger lines in non-documentation code
75+
ColumnLimit: 120
76+
CommentPragmas: '^ IWYU pragma:'
77+
CompactNamespaces: false
78+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
79+
ConstructorInitializerIndentWidth: 2
80+
ContinuationIndentWidth: 2
81+
Cpp11BracedListStyle: false
82+
DerivePointerAlignment: false
83+
DisableFormat: false
84+
ExperimentalAutoDetectBinPacking: false
85+
FixNamespaceComments: true
86+
ForEachMacros:
87+
- foreach
88+
- Q_FOREACH
89+
- BOOST_FOREACH
90+
IncludeBlocks: Preserve
91+
IncludeCategories:
92+
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
93+
Priority: 2
94+
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
95+
Priority: 3
96+
- Regex: '.*'
97+
Priority: 1
98+
IncludeIsMainRegex: '(Test)?$'
99+
IndentCaseLabels: true
100+
IndentPPDirectives: AfterHash
101+
IndentWidth: 2
102+
IndentWrappedFunctionNames: false
103+
JavaScriptQuotes: Leave
104+
JavaScriptWrapImports: true
105+
KeepEmptyLinesAtTheStartOfBlocks: true
106+
MacroBlockBegin: ''
107+
MacroBlockEnd: ''
108+
MaxEmptyLinesToKeep: 2
109+
NamespaceIndentation: None
110+
ObjCBinPackProtocolList: Auto
111+
ObjCBlockIndentWidth: 2
112+
ObjCSpaceAfterProperty: true
113+
ObjCSpaceBeforeProtocolList: false
114+
PenaltyBreakAssignment: 2
115+
PenaltyBreakBeforeFirstCallParameter: 19
116+
PenaltyBreakComment: 300
117+
## The following line allows larger lines in non-documentation code
118+
PenaltyBreakFirstLessLess: 120
119+
PenaltyBreakString: 1000
120+
PenaltyBreakTemplateDeclaration: 10
121+
PenaltyExcessCharacter: 1000000
122+
PenaltyReturnTypeOnItsOwnLine: 200
123+
PointerAlignment: Middle
124+
ReflowComments: true
125+
# We may want to sort the includes as a separate pass
126+
SortIncludes: false
127+
# We may want to revisit this later
128+
SortUsingDeclarations: false
129+
SpaceAfterCStyleCast: false
130+
# SpaceAfterLogicalNot: false
131+
SpaceAfterTemplateKeyword: true
132+
SpaceBeforeAssignmentOperators: true
133+
SpaceBeforeCpp11BracedList: false
134+
SpaceBeforeCtorInitializerColon: true
135+
SpaceBeforeInheritanceColon: true
136+
SpaceBeforeParens: ControlStatements
137+
SpaceBeforeRangeBasedForLoopColon: true
138+
SpaceInEmptyParentheses: false
139+
SpacesBeforeTrailingComments: 1
140+
SpacesInAngles: false
141+
SpacesInContainerLiterals: false
142+
SpacesInCStyleCastParentheses: false
143+
SpacesInParentheses: false
144+
SpacesInSquareBrackets: false
145+
Standard: Cpp11
146+
StatementMacros:
147+
- Q_UNUSED
148+
- QT_REQUIRE_VERSION
149+
TabWidth: 2
150+
UseTab: Never
151+
...
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# http://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
# Apply to all code files
7+
[*]
8+
# A newline ending every file
9+
insert_final_newline = true
10+
11+
# Set default charset
12+
charset = utf-8
13+
14+
# 4 space indentation
15+
indent_style = space
16+
indent_size = 2
17+
18+
# Various options
19+
trim_trailing_whitespace = true

{{cookiecutter.project_name}}/include/itkMinimalStandardRandomVariateGenerator.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class {{ cookiecutter.module_name }}_EXPORT MinimalStandardRandomVariateGenerato
5555
public:
5656
ITK_DISALLOW_COPY_AND_MOVE(MinimalStandardRandomVariateGenerator);
5757

58-
/** Standard class typedefs. */
58+
/** Standard class aliases. */
5959
using Self = MinimalStandardRandomVariateGenerator;
6060
using Superclass = RandomVariateGeneratorBase;
6161
using Pointer = SmartPointer<Self>;
@@ -72,16 +72,19 @@ class {{ cookiecutter.module_name }}_EXPORT MinimalStandardRandomVariateGenerato
7272
itkNewMacro(Self);
7373

7474
/** initialize with a simple IntegerType */
75-
void Initialize(int randomSeed);
75+
void
76+
Initialize(int randomSeed);
7677

7778
/** Get a variate in the range [0, 1] */
78-
double GetVariate() override;
79+
double
80+
GetVariate() override;
7981

8082
protected:
8183
MinimalStandardRandomVariateGenerator();
8284
~MinimalStandardRandomVariateGenerator() override = default;
8385

84-
void PrintSelf(std::ostream & os, Indent indent) const override;
86+
void
87+
PrintSelf(std::ostream & os, Indent indent) const override;
8588

8689
private:
8790
NormalGeneratorType::Pointer m_NormalGenerator;

{{cookiecutter.project_name}}/include/itk{{cookiecutter.filter_name}}.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class {{ cookiecutter.filter_name }} : public ImageToImageFilter<TInputImage, TO
4747
using InputPixelType = typename InputImageType::PixelType;
4848
using OutputPixelType = typename OutputImageType::PixelType;
4949

50-
/** Standard class typedefs. */
50+
/** Standard class aliases. */
5151
using Self = {{ cookiecutter.filter_name }}<InputImageType, OutputImageType>;
5252
using Superclass = ImageToImageFilter<InputImageType, OutputImageType>;
5353
using Pointer = SmartPointer<Self>;
@@ -63,11 +63,13 @@ class {{ cookiecutter.filter_name }} : public ImageToImageFilter<TInputImage, TO
6363
{{ cookiecutter.filter_name }}();
6464
~{{ cookiecutter.filter_name }}() override = default;
6565

66-
void PrintSelf(std::ostream & os, Indent indent) const override;
66+
void
67+
PrintSelf(std::ostream & os, Indent indent) const override;
6768

6869
using OutputRegionType = typename OutputImageType::RegionType;
6970

70-
void DynamicThreadedGenerateData(const OutputRegionType & outputRegion) override;
71+
void
72+
DynamicThreadedGenerateData(const OutputRegionType & outputRegion) override;
7173

7274
private:
7375
#ifdef ITK_USE_CONCEPT_CHECKING

{{cookiecutter.project_name}}/test/itk{{cookiecutter.filter_name}}Test.cxx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ class ShowProgress : public itk::Command
5252
};
5353
} // namespace
5454

55-
int itk{{ cookiecutter.filter_name }}Test(int argc, char * argv[])
55+
int
56+
itk{{ cookiecutter.filter_name }}Test(int argc, char * argv[])
5657
{
5758
if (argc < 2)
5859
{

0 commit comments

Comments
 (0)