Skip to content

Commit 12cb9d0

Browse files
committed
STYLE: Enforce ITK style defined by .clang-format
./Utilities/Maintenance/clang-format.bash \ --clang-format ~/local/llvm/clang+llvm-8.0.0-x86_64-linux-gnu-ubuntu-18.04/bin/clang-format \ --tracked This patch updates the ITK preferred style to one that can be automatically enforced, integrated with many IDE's, and based on externally defined documentation and examples. See: https://discourse.itk.org/t/update-coding-style-for-itk/2055 Most of the changes make inconsistent coding practices consistent throughout the toolkit. Community discussions regarding changes to the current defined coding style are explicitly not included in this request so that they can be independantly reviewed and considered. One large change is changing the {} indentation style from `Whitesmiths` style https://en.wikipedia.org/wiki/Indentation_style#Whitesmiths_style to an indentation style consistent with many of the other common indentation styles. The primary reason for this change is to overcome the common deficiency of IDE's and formatters to support this uncommon style choice. Many ITK developers provided insightful comments and suggestions that resulted in this set of style comprimises.
1 parent 1be1fea commit 12cb9d0

File tree

904 files changed

+48444
-47391
lines changed

Some content is hidden

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

904 files changed

+48444
-47391
lines changed

.clang-format

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
11
## 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
24
## See: https://clang.llvm.org/docs/ClangFormatStyleOptions.html for details of each option
35
##
4-
## The clang-foramt binaries can be downloaded as part of the clang binar distributions
6+
## The clang-format binaries can be downloaded as part of the clang binary distributions
57
## 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
616
---
717
# This configuration requires clang-format version 8.0.0 exactly.
8-
# BasedOnStyle: Mozilla
18+
BasedOnStyle: Mozilla
919
Language: Cpp
1020
AccessModifierOffset: -2
1121
AlignAfterOpenBracket: Align
@@ -29,7 +39,7 @@ AlwaysBreakAfterReturnType: All
2939
AlwaysBreakBeforeMultilineStrings: false
3040
AlwaysBreakTemplateDeclarations: Yes
3141
BinPackArguments: false
32-
BinPackParameters: true
42+
BinPackParameters: false
3343
BreakBeforeBraces: Custom
3444
BraceWrapping:
3545
# clang 9.0 feature AfterCaseLabel: false
@@ -61,6 +71,7 @@ BreakBeforeTernaryOperators: true
6171
BreakConstructorInitializers: BeforeComma
6272
BreakAfterJavaFieldAnnotations: false
6373
BreakStringLiterals: true
74+
## The following line allows larger lines in non-documentation code
6475
ColumnLimit: 120
6576
CommentPragmas: '^ IWYU pragma:'
6677
CompactNamespaces: false
@@ -103,6 +114,7 @@ ObjCSpaceBeforeProtocolList: false
103114
PenaltyBreakAssignment: 2
104115
PenaltyBreakBeforeFirstCallParameter: 19
105116
PenaltyBreakComment: 300
117+
## The following line allows larger lines in non-documentation code
106118
PenaltyBreakFirstLessLess: 120
107119
PenaltyBreakString: 1000
108120
PenaltyBreakTemplateDeclaration: 10
@@ -125,10 +137,10 @@ SpaceBeforeParens: ControlStatements
125137
SpaceBeforeRangeBasedForLoopColon: true
126138
SpaceInEmptyParentheses: false
127139
SpacesBeforeTrailingComments: 1
128-
SpacesInAngles: true
129-
SpacesInContainerLiterals: true
140+
SpacesInAngles: false
141+
SpacesInContainerLiterals: false
130142
SpacesInCStyleCastParentheses: false
131-
SpacesInParentheses: true
143+
SpacesInParentheses: false
132144
SpacesInSquareBrackets: false
133145
Standard: Cpp11
134146
StatementMacros:

ARCHIVE/BRAINSContinuousClass/BRAINSContinuousClass.cxx

Lines changed: 117 additions & 115 deletions
Large diffs are not rendered by default.

ARCHIVE/BRAINSContinuousClass/LogisticRegression.h

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -23,38 +23,38 @@
2323
#include <vector>
2424
#include <map>
2525

26-
template < typename TSampleType >
26+
template <typename TSampleType>
2727
class LogisticRegressionSample
2828
{
2929
private:
30-
std::vector< TSampleType > * m_sample;
31-
unsigned int m_label;
32-
std::map< unsigned int, double > m_predictedProbability;
33-
bool m_labelSet;
30+
std::vector<TSampleType> * m_sample;
31+
unsigned int m_label;
32+
std::map<unsigned int, double> m_predictedProbability;
33+
bool m_labelSet;
3434

3535
public:
36-
LogisticRegressionSample( const unsigned int featureCount );
37-
LogisticRegressionSample( const LogisticRegressionSample & LRS );
36+
LogisticRegressionSample(const unsigned int featureCount);
37+
LogisticRegressionSample(const LogisticRegressionSample & LRS);
3838
~LogisticRegressionSample();
3939
double
40-
GetLabelProbability( unsigned int const & );
40+
GetLabelProbability(unsigned int const &);
4141

4242
void
43-
SetSample( std::vector< TSampleType > & );
43+
SetSample(std::vector<TSampleType> &);
4444

45-
std::vector< TSampleType > const *
45+
std::vector<TSampleType> const *
4646
GetSample() const;
4747

4848
void
49-
SetLabelProbability( unsigned int const &, double const & );
49+
SetLabelProbability(unsigned int const &, double const &);
5050

5151
unsigned int
5252
GetLabel() const
5353
{
5454
return this->m_label;
5555
};
5656
void
57-
SetLabel( unsigned int const & );
57+
SetLabel(unsigned int const &);
5858

5959
bool
6060
LabelIsSet() const
@@ -63,7 +63,7 @@ class LogisticRegressionSample
6363
};
6464
};
6565

66-
template < typename TSampleType >
66+
template <typename TSampleType>
6767
class LogisticRegression
6868
{
6969
private:
@@ -80,23 +80,23 @@ class LogisticRegression
8080
bool m_classTwoLabelSet;
8181

8282
public:
83-
LogisticRegression( const unsigned int featureCount, const unsigned int sampleCount );
84-
LogisticRegression( const LogisticRegression & LR );
83+
LogisticRegression(const unsigned int featureCount, const unsigned int sampleCount);
84+
LogisticRegression(const LogisticRegression & LR);
8585
~LogisticRegression();
8686
void
87-
AddLabeledSample( LogisticRegressionSample< TSampleType > const & );
87+
AddLabeledSample(LogisticRegressionSample<TSampleType> const &);
8888

8989
void
9090
TrainModel();
9191

9292
void
93-
SetClassOneLabel( const unsigned int );
93+
SetClassOneLabel(const unsigned int);
9494

9595
void
96-
SetClassTwoLabel( const unsigned int );
96+
SetClassTwoLabel(const unsigned int);
9797

9898
void
99-
ClassifySample( LogisticRegressionSample< TSampleType > & );
99+
ClassifySample(LogisticRegressionSample<TSampleType> &);
100100
};
101101
#include "LogisticRegression.hxx"
102102
#endif

0 commit comments

Comments
 (0)