Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

consistent formatting #427

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 98 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# 1
IndentWidth: 4
TabWidth: 4
UseTab: Never
IndentPPDirectives: AfterHash # Unknown to clang-format-5.0
PPIndentWidth: 1
AccessModifierOffset: -4

# 2
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
ColumnLimit: 80
BreakStringLiterals: false
AlignAfterOpenBracket: Align
BinPackArguments: false
BinPackParameters: true
InsertTrailingCommas: Wrapped
ExperimentalAutoDetectBinPacking: false
AllowAllParametersOfDeclarationOnNextLine: true
ContinuationIndentWidth: 4

# 3
BreakBeforeBraces: Linux
MaxEmptyLinesToKeep: 1
KeepEmptyLinesAtTheStartOfBlocks: false
IndentCaseBlocks: false
IndentCaseLabels: false
Cpp11BracedListStyle: false

# 3.1
SpaceBeforeParens: Custom
SpaceBeforeParensOptions:
AfterControlStatements: true
AfterFunctionDefinitionName: false
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
AlignArrayOfStructures: None
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignConsecutiveMacros: Consecutive
AlignEscapedNewlines: Left # Unknown to clang-format-4.0
AlignOperands: Align
BreakBeforeBinaryOperators: NonAssignment
AlignTrailingComments: true

# 7
PointerAlignment: Right
DerivePointerAlignment: false

# 14
Standard: Cpp03

# unsorted

AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: false
BreakBeforeTernaryOperators: true
DisableFormat: false
#FixNamespaceComments: false # Unknown to clang-format-4.0

IncludeBlocks: Regroup # Unknown to clang-format-5.0
IndentWrappedFunctionNames: false
MacroBlockBegin: ''
MacroBlockEnd: ''
NamespaceIndentation: None
#ObjCBinPackProtocolList: Auto # Unknown to clang-format-5.0
ObjCBlockIndentWidth: 4
ObjCSpaceAfterProperty: true
ObjCSpaceBeforeProtocolList: true

#PenaltyBreakAssignment: 10 # Unknown to clang-format-4.0
PenaltyBreakBeforeFirstCallParameter: 30
PenaltyBreakComment: 10
PenaltyBreakFirstLessLess: 0
PenaltyBreakString: 10
PenaltyExcessCharacter: 100
PenaltyReturnTypeOnItsOwnLine: 60

ReflowComments: false
SeparateDefinitionBlocks: Always
SortIncludes: CaseInsensitive
#SortUsingDeclarations: false # Unknown to clang-format-4.0

Cpp11BracedListStyle: true # bad but reduces initial diff
IndentExternBlock: NoIndent
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
cf83bf3cb9108370bef19284278152e14acb115a
390d81c8b7247afe28c4316174d6fba2d617f25b
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Это надо будет поменять, когда окончательная редакция первого патча будет

9 changes: 9 additions & 0 deletions .github/format.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash -efux

PREFIX=$HOME/opt
PATH=$PREFIX/bin:$PATH

list=$(git ls-tree --name-only -r HEAD | grep -v ecp_id_.* | grep -v gost_grasshopper_precompiled.c | grep -v ^e_gost_err | grep '[.][ch]$')
clang-format -i $list
diffLen=$(git diff | wc -l)
test 0 -eq $diffLen || exit 1
8 changes: 8 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,11 @@ jobs:
- run: .github/before_script.sh
- run: .github/script.sh

clang-format:
runs-on: ubuntu-22.04
env:
APT_INSTALL: clang-format
steps:
- uses: actions/checkout@v2
- run: .github/format.sh

Loading