Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
0bf14a1
draft
licanhua Nov 30, 2021
ec915c1
update readme
licanhua Nov 30, 2021
5d71677
format project
licanhua Nov 30, 2021
43798c6
update pipeline
licanhua Nov 30, 2021
9d2c700
revert change on ios
licanhua Nov 30, 2021
d3ca076
revert change on PerfApp because it's C++/CX project and ^ is not wel…
licanhua Nov 30, 2021
95c0185
update local vs version and make BasedOnStyle:Microsoft
licanhua Dec 1, 2021
8d03136
disable pipeline check and revert change on formatted files
licanhua Dec 1, 2021
8a21c5b
remove .h, .cpp from .editorconfig
licanhua Dec 1, 2021
ae9d843
Apply suggestions from code review
licanhua Dec 3, 2021
8599a38
Update .clang-format
licanhua Dec 3, 2021
211ea7e
enable hooks and recover clang-format
licanhua Dec 3, 2021
ece507a
rollback to cpp11
licanhua Dec 3, 2021
700de21
format files
licanhua Dec 3, 2021
ee45fe9
Revert "format files"
licanhua Dec 3, 2021
946ab61
Revert "format files"
licanhua Dec 3, 2021
be36875
add clang-format-launcher
licanhua Dec 6, 2021
01d30f5
Merge branch 'clang-format' of https://github.com/microsoft/adaptivec…
licanhua Dec 6, 2021
848a995
clang-format exception
licanhua Dec 6, 2021
84575c1
update documents
licanhua Dec 6, 2021
63276aa
add npm run format to error
licanhua Dec 6, 2021
bad13cb
update package-lock
licanhua Dec 6, 2021
72d3def
add pipeline to check the format and create patch file if failed
licanhua Dec 7, 2021
1a133c2
update echo message
licanhua Dec 7, 2021
21248a9
Merge branch 'main' into clang-format
licanhua Dec 7, 2021
d25f9f7
move clang.format.json to package.json
licanhua Dec 8, 2021
c69536b
Merge branch 'main' into clang-format
beervoley Dec 9, 2021
756e486
address comments
licanhua Dec 9, 2021
4554100
Merge branch 'clang-format' of https://github.com/microsoft/adaptivec…
licanhua Dec 9, 2021
7c09754
Merge branch 'main' into clang-format
licanhua Dec 9, 2021
c9ca001
Deleting outdated VsCode extension (#6831)
Dec 8, 2021
eba8150
provide crossplatform hooks
licanhua Dec 10, 2021
15a3efb
Merge branch 'clang-format' of https://github.com/microsoft/adaptivec…
licanhua Dec 10, 2021
b3f3162
Merge branch 'main' into clang-format
licanhua Dec 10, 2021
3c13d07
Update scripts/hooks/clangFormatFunc
licanhua Dec 11, 2021
493f1b8
address comment
licanhua Dec 11, 2021
576b2b5
limit error number
licanhua Dec 11, 2021
1cc02c8
Merge branch 'main' into clang-format
licanhua Dec 11, 2021
1b0e1d5
update clang-format-launcher version
licanhua Dec 13, 2021
c4c62f3
Update .clang-format
licanhua Dec 14, 2021
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
148 changes: 148 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
---
# this file work is a derivative of .clang-format which follows
# https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md
#
Language: Cpp
BasedOnStyle: Microsoft
AccessModifierOffset: -4
AlignAfterOpenBracket: AlwaysBreak
AlignConsecutiveAssignments: false
AlignEscapedNewlines: DontAlign
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: true
BinPackArguments: false
BinPackParameters: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: true
AfterClass: true
AfterControlStatement: true
AfterEnum: true
AfterFunction: true
AfterNamespace: false
AfterStruct: true
AfterUnion: true
AfterExternBlock: false
BeforeCatch: true
BeforeElse: true
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: AfterColon
ColumnLimit: 130
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: true
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^"(stdafx.h|pch.h|precomp.h)"$'
Priority: -1
IndentCaseLabels: false
IndentWidth: 4
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: '^BEGIN_COM_MAP$|^BEGIN_CONNECTION_POINT_MAP$|^BEGIN_HELPER_NODEMAP$|^BEGIN_MODULE$|^BEGIN_MSG_MAP$|^BEGIN_OBJECT_MAP$|^BEGIN_TEST_CLASS$|^BEGIN_TEST_METHOD$|^BEGIN_TEST_METHOD_PROPERTIES$'
MacroBlockEnd: '^END_COM_MAP$|^END_CONNECTION_POINT_MAP$|^END_HELPER_NODEMAP$|^END_MODULE$|^END_MSG_MAP$|^END_OBJECT_MAP$|^END_TEST_CLASS$|^END_TEST_METHOD$|^END_TEST_METHOD_PROPERTIES$'
MaxEmptyLinesToKeep: 1
NamespaceIndentation: Inner
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1
PenaltyReturnTypeOnItsOwnLine: 1000
PointerAlignment: Left
SortIncludes: false
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
StatementMacros: [
_Acquires_exclusive_lock_,
_Acquires_lock_,
_Acquires_nonreentrant_lock_,
_Acquires_shared_lock_,
_Analysis_assume_smart_lock_acquired_,
_Analysis_assume_smart_lock_released_,
_Create_lock_level_,
_Detaches_lock_,
_Function_class_,
_Global_cancel_spin_lock_,
_Global_critical_region_,
_Global_interlock_,
_Global_priority_region_,
_Has_lock_kind_,
_Has_lock_level_,
_IRQL_always_function_max_,
_IRQL_always_function_min_,
_IRQL_raises_,
_IRQL_requires_,
_IRQL_requires_max_,
_IRQL_requires_min_,
_IRQL_requires_same_,
_IRQL_restores_,
_IRQL_restores_global_,
_IRQL_saves_,
_IRQL_saves_global_,
_Lock_level_order_,
_Moves_lock_,
_Must_inspect_result_,
_No_competing_thread_,
_Post_same_lock_,
_Post_writable_byte_size_,
_Pre_satisfies_,
_Releases_exclusive_lock_,
_Releases_lock_,
_Releases_nonreentrant_lock_,
_Releases_shared_lock_,
_Replaces_lock_,
_Requires_exclusive_lock_held_,
_Requires_lock_held_,
_Requires_lock_not_held_,
_Requires_no_locks_held_,
_Requires_shared_lock_held_,
_Ret_maybenull_,
_Ret_range_,
_Success_,
_Swaps_locks_,
_Use_decl_annotations_,
_When_,
RpcEndExcept,
]
TabWidth: 4
TypenameMacros: [
IFACEMETHOD,
STDMETHOD,
]
UseTab: Never
...
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
root = true

[**.{cpp,h,java,mm,cs,ts,js,tsx}]
[**.{java,mm,cs,ts,js,tsx}]
indent_style = spaces
indent_size = 4
charset = utf-8
Expand Down
8 changes: 8 additions & 0 deletions .pipelines/uwp-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ pool:
vmImage: windows-2019

steps:
- task: PowerShell@2
inputs:
targetType: 'filePath'
filePath: scripts\FormatSource.ps1
arguments: '-ModifiedOnly $false -Verify $True -Path source'
displayName: 'Clang-format check'
condition: failed() # this job is disabled

- task: NuGetToolInstaller@0
name: NuGetToolInstaller1
displayName: Use NuGet 5.x
Expand Down
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,35 @@ PS: Latest Build Status is against `main` branch.
| iOS | [![CocoaPods](https://img.shields.io/cocoapods/v/AdaptiveCards.svg)](https://cocoapods.org/pods/AdaptiveCards) | [Source](https://github.com/Microsoft/AdaptiveCards/tree/main/source/ios) | [Docs](https://docs.microsoft.com/en-us/adaptive-cards/display/libraries/ios) | ![Build status](https://img.shields.io/azure-devops/build/Microsoft/56cf629e-8f3a-4412-acbc-bf69366c552c/37917/main.svg) |
| Card Designer | [![npm install](https://img.shields.io/npm/v/adaptivecards-designer.svg)](https://www.npmjs.com/package/adaptivecards-designer) | [Source](https://github.com/Microsoft/AdaptiveCards/tree/main/source/nodejs/adaptivecards-designer)| [Docs](https://www.npmjs.com/package/adaptivecards-designer) | ![Build Status](https://img.shields.io/azure-devops/build/Microsoft/56cf629e-8f3a-4412-acbc-bf69366c552c/20564/main.svg) |

## Code format

We require the C++ code inside this project to follow the clang-format. If you change them, please make sure your changed files are formatted correctly.

### Setup Git hooks
This is a one time setup. When you `git commit`, it will automatically do the format check and ask you to correct it if format error detected.
```
scripts\SetupClangFormat.bat
```

### Two ways to format the files

### 1) Use script to format files before you submit the change

`PowerShell.exe -ExecutionPolicy Bypass scripts\FormatSource.ps1 -ModifiedOnly $False`

or

`PowerShell.exe -ExecutionPolicy Bypass scripts\FormatSource.ps1 -ModifiedOnly $False -Path yourfolder`

#### 2) clang-format and IDE integration, and use the IDE to format it
- Use Visual Studio:
1. Configure your [clang-format tools](https://devblogs.microsoft.com/cppblog/clangformat-support-in-visual-studio-2017-15-7-preview-1/).
2. Open the modified file.
3. Use shortcut keys Ctrl+K, Ctrl+D to format the current file.

- Use Visual Studio Code and other IDE
Check the IDE integration in https://clang.llvm.org/docs/ClangFormat.html

#### End User License Agreement for our binary packages
Consumption of the AdaptiveCards binary packages are subject to the Microsoft EULA (End User License Agreement). Please see the relevant terms as listed below:
- [UWP/.NET](https://github.com/microsoft/AdaptiveCards/blob/main/source/EULA-Windows.txt)
Expand Down
Loading