Skip to content
Merged
Show file tree
Hide file tree
Changes from 34 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
31 changes: 31 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
# 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
AlignEscapedNewlines: DontAlign
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
AfterCaseLabel: true
AfterUnion: true
AfterExternBlock: false
BreakConstructorInitializers: AfterColon
CompactNamespaces: true
ConstructorInitializerAllOnOneLineOrOnePerLine: true
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^"(stdafx.h|pch.h|precomp.h)"$'
Priority: -1
NamespaceIndentation: Inner
PenaltyExcessCharacter: 1
PointerAlignment: Left
SortIncludes: false
Standard: Cpp11
UseTab: Never
...
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
## files generated by popular Visual Studio add-ons.
.gitconfig

scripts/hooks/pre-commit

# User-specific files
*.suo
*.user
Expand Down
56 changes: 56 additions & 0 deletions .pipelines/clang-format-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: $(Year:yy).$(Month).$(DayOfMonth).$(rev:r)

pr:
branches:
include:
- main

pool:
vmImage: ubuntu-latest

steps:
- task: NodeTool@0
inputs:
versionSpec: '14.x'
displayName: 'Install Node.js'

- script: |
npm install
displayName: 'npm install'
workingDirectory: source/nodejs

- script: |
npm run verify --verbose
displayName: 'npm run verify --verbose'
workingDirectory: source/nodejs

- bash: |
echo "##[command]Three ways to fix the format problem"
echo '##[command]1. powershell -ExecutionPolicy Bypass scripts\FormatSource.ps1 -ModifiedOnly $False'
echo "##[command]2. or cd source\nodejs, then npm run format --verbse"
echo "##[command]3. or download format.patch from pippeline, then git apply format.patch"
displayName: 'How to fix the format problem'
condition: failed()

- script: |
npm run format --verbose
displayName: 'npm run format --verbose'
workingDirectory: source/nodejs
condition: failed()

- script: |
git diff > format.patch
displayName: 'create format.patch'
condition: failed()

- task: CopyFiles@2
inputs:
contents: 'format.patch'
targetFolder: $(Build.ArtifactStagingDirectory)
condition: failed()

- task: PublishBuildArtifacts@1
inputs:
pathToPublish: $(Build.ArtifactStagingDirectory)
artifactName: drop
condition: failed()
50 changes: 49 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,55 @@ 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) |

#### End User License Agreement for our binary packages
## 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.

Make sure clang-format version 12.0.0 and above version is used.

### IDE integration
ClangFormat describes a set of tools that are built on top of LibFormat. It can support your workflow in a variety of ways including a standalone tool and editor integrations. For details, refer to https://clang.llvm.org/docs/ClangFormat.html

### Format with script
Two scripts are provided to help you format files.
- Windows user only: use FormatSource.ps1. This script use clang-format.exe which is built into Visual Studio by default.

Execute below command in the root folder of the project

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

If it's the first time to run the script, make sure clang-format version 12.0.0 or above in the output. Otherwise you may need to upgrade Visual Studio or use your own clang-format binaries.
```
[clang-format] Version is:
clang-format version 12.0.0
```

- Both Windows and MAC users: Use clang-format npmjs package

Execute below command in source/nodejs

```
npm run format
```

Make sure `npm install` is run before.

### Use Git pre-commit hook
`git pre-commit hook` is an optional process. When you run `git commit`, it will automatically do the format check and auto fix the format if error detected.

First make sure clang-format binary is installed in your dev enviroment.
Then modify scripts/hooks/pre-commit to make sure clangFormat is point to the correct path.
And finally setup the git hook.

Two ways to setup the hook:
1. Copy `scripts/hooks/pre-commit` to `.git/hooks`
2. `git config --local core.hooksPath scripts/hooks`

then choose `scripts/hooks/pre-commit.txt` or `scripts/hooks/pre-commit.txt` and remove the `.txt` to enable that hook.

## 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)
- [Android/iOS](https://github.com/microsoft/AdaptiveCards/blob/main/source/EULA-Non-Windows.txt)
Expand Down
Loading