Skip to content

Commit 1ebbac6

Browse files
authored
Apply clang-format and cmake-format and add style check workflow (#171)
* apply clang-format and cmake-format and add style check workflow * add declare package definition * add additional public methods and rename internals * change development verison tag to 1.0.0 * rename internal method * rename public method * rename test var * update copyright and fix comment * typo * run fix-format * fix test function names
1 parent cf3f62b commit 1ebbac6

Some content is hidden

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

51 files changed

+731
-596
lines changed

.clang-format

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
BasedOnStyle: Google
3+
AccessModifierOffset: '-2'
4+
AlignTrailingComments: 'true'
5+
AllowAllParametersOfDeclarationOnNextLine: 'false'
6+
AlwaysBreakTemplateDeclarations: 'No'
7+
BreakBeforeBraces: Attach
8+
ColumnLimit: '100'
9+
ConstructorInitializerAllOnOneLineOrOnePerLine: 'true'
10+
IncludeBlocks: Regroup
11+
IndentPPDirectives: AfterHash
12+
IndentWidth: '2'
13+
NamespaceIndentation: All
14+
BreakBeforeBinaryOperators: All
15+
BreakBeforeTernaryOperators: 'true'
16+
...

.cmake-format

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
format:
2+
tab_size: 2
3+
line_width: 100
4+
dangle_parens: true
5+
6+
parse:
7+
additional_commands:
8+
cpmaddpackage:
9+
pargs:
10+
nargs: '*'
11+
flags: []
12+
spelling: CPMAddPackage
13+
kwargs: &cpmaddpackagekwargs
14+
NAME: 1
15+
FORCE: 1
16+
VERSION: 1
17+
GIT_TAG: 1
18+
DOWNLOAD_ONLY: 1
19+
GITHUB_REPOSITORY: 1
20+
GITLAB_REPOSITORY: 1
21+
GIT_REPOSITORY: 1
22+
SVN_REPOSITORY: 1
23+
SVN_REVISION: 1
24+
SOURCE_DIR: 1
25+
DOWNLOAD_COMMAND: 1
26+
FIND_PACKAGE_ARGUMENTS: 1
27+
NO_CACHE: 1
28+
GIT_SHALLOW: 1
29+
URL: 1
30+
URL_HASH: 1
31+
URL_MD5: 1
32+
DOWNLOAD_NAME: 1
33+
DOWNLOAD_NO_EXTRACT: 1
34+
HTTP_USERNAME: 1
35+
HTTP_PASSWORD: 1
36+
OPTIONS: +
37+
cpmfindpackage:
38+
pargs:
39+
nargs: '*'
40+
flags: []
41+
spelling: CPMFindPackage
42+
kwargs: *cpmaddpackagekwargs
43+
cpmdeclarepackage:
44+
pargs:
45+
nargs: '*'
46+
flags: []
47+
spelling: CPMDeclarePackage
48+
kwargs: *cpmaddpackagekwargs
49+
packageproject:
50+
pargs:
51+
nargs: '*'
52+
flags: []
53+
spelling: packageProject
54+
kwargs:
55+
NAME: 1
56+
VERSION: 1
57+
INCLUDE_DIR: 1
58+
INCLUDE_DESTINATION: 1
59+
BINARY_DIR: 1
60+
COMPATIBILITY: 1
61+
VERSION_HEADER: 1
62+
DEPENDENCIES: +
63+
cpmusepackagelock:
64+
pargs: 1
65+
spelling: CPMUsePackageLock
66+
cpmregisterpackage:
67+
pargs: 1
68+
spelling: CPMRegisterPackage
69+
cpmgetpackageversion:
70+
pargs: 2
71+
spelling: CPMGetPackageVersion

.github/workflows/publish.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ jobs:
1515
- name: Set CPM version by tag
1616
run: |
1717
mkdir dist
18-
sed "s/0.27.2-development-version/${GITHUB_REF/refs\/tags\/v}/g" cmake/CPM.cmake > dist/CPM.cmake
19-
sed "s/0.27.2-development-version/${GITHUB_REF/refs\/tags\/v}/g" cmake/get_cpm.cmake > dist/get_cpm.cmake
18+
sed "s/1.0.0-development-version/${GITHUB_REF/refs\/tags\/v}/g" cmake/CPM.cmake > dist/CPM.cmake
19+
sed "s/1.0.0-development-version/${GITHUB_REF/refs\/tags\/v}/g" cmake/get_cpm.cmake > dist/get_cpm.cmake
2020
2121
- name: Upload CPM.cmake to release
2222
uses: svenstaro/upload-release-action@v1-release

.github/workflows/style.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Style
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
11+
jobs:
12+
style:
13+
14+
runs-on: macos-latest
15+
16+
steps:
17+
- uses: actions/checkout@v1
18+
19+
- name: Install format dependencies
20+
run: |
21+
brew install clang-format
22+
pip3 install cmake_format==0.6.11 pyyaml
23+
24+
- name: configure
25+
run: cmake -Htest/style -Bbuild/style
26+
27+
- name: check style
28+
run: cmake --build build/style --target check-format

0 commit comments

Comments
 (0)