Skip to content

Commit c34e6ca

Browse files
committed
feat: convert to copier template (#3)
close #2
1 parent 2f32f61 commit c34e6ca

File tree

86 files changed

+7240
-322
lines changed

Some content is hidden

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

86 files changed

+7240
-322
lines changed

.clang-format

Lines changed: 78 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -2,116 +2,116 @@
22
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html
33
---
44
Language: Cpp
5-
# 访问说明符(publicprotectedprivate)不偏移
5+
# Do not offset access specifiers (public, protected, private)
66
AccessModifierOffset: -4
7-
# 开括号(开圆括号、开尖括号、开方括号)后的参数换行需要对齐
7+
# Align parameters after opening brackets (round, angle, square)
88
AlignAfterOpenBracket: Align
9-
# 连续赋值时,不对齐所有等号
9+
# Do not align consecutive assignments
1010
AlignConsecutiveAssignments: false
11-
# 连续声明时,不对齐所有声明的变量名
11+
# Do not align consecutive declarations
1212
AlignConsecutiveDeclarations: false
13-
# 对齐连续宏定义的样式
13+
# Align consecutive macros
1414
AlignConsecutiveMacros: true
15-
# 将转义的换行符(\)尽可能向左对齐
15+
# Align escaped newlines to the left
1616
AlignEscapedNewlines: Left
17-
# 水平对齐二元和三元表达式的操作数
17+
# Align operands of binary and ternary expressions horizontally
1818
AlignOperands: true
19-
# 对齐连续的尾部注释
19+
# Align trailing comments
2020
AlignTrailingComments: true
21-
# 允许函数的所有参数放到下一行
21+
# Allow all function arguments on the next line
2222
AllowAllArgumentsOnNextLine: false
2323
AllowAllConstructorInitializersOnNextLine: false
2424
AllowAllParametersOfDeclarationOnNextLine: false
25-
# 不允许短的代码块放在同一行,如 while 代码块
25+
# Do not allow short blocks (e.g., while blocks) on a single line
2626
AllowShortBlocksOnASingleLine: false
27-
# 不允许短的 case 标签代码块放在同一行
27+
# Do not allow short case labels on a single line
2828
AllowShortCaseLabelsOnASingleLine: false
29-
# 不允许在类外定义的非空函数放在同一行
29+
# Do not allow non-empty functions defined outside of a class on a single line
3030
AllowShortFunctionsOnASingleLine: Inline
31-
# 不允许短的 if 语句放在同一行
31+
# Do not allow short if statements on a single line
3232
AllowShortIfStatementsOnASingleLine: false
33-
# 不允许短的循环代码块放在同一行
33+
# Do not allow short loop blocks on a single line
3434
AllowShortLoopsOnASingleLine: false
35-
# 不要主动在函数定义返回类型处换行,除非超过行字符数限制必须换行
35+
# Do not break after the return type in function definitions, unless it exceeds the column limit
3636
AlwaysBreakAfterDefinitionReturnType: None
3737
AlwaysBreakAfterReturnType: None
38-
# 不允许在多行 string 前换行
38+
# Do not break before multiline strings
3939
AlwaysBreakBeforeMultilineStrings: false
40-
# 总是在 template 声明后换行
40+
# Always break after template declarations
4141
AlwaysBreakTemplateDeclarations: Yes
42-
# 不要求函数实参换行时必须每个参数各自一行
42+
# Do not require each function argument to be on a separate line
4343
BinPackArguments: false
44-
# 不要求函数形参换行时必须每个参数各自一行
44+
# Do not require each function parameter to be on a separate line
4545
BinPackParameters: false
46-
# 配置大括号是否换行
46+
# Configure brace wrapping style
4747
BraceWrapping:
48-
# case 标签后面大括号不换行
48+
# Do not break after case labels
4949
AfterCaseLabel: false
50-
# class 定义后面大括号不换行
50+
# Do not break after class definitions
5151
AfterClass: false
52-
# 控制语句后面大括号不换行
52+
# Do not break after control statements
5353
AfterControlStatement: false
54-
# enum 定义后面大括号不换行
54+
# Do not break after enum definitions
5555
AfterEnum: false
56-
# 函数定义后面大括号不换行
56+
# Do not break after function definitions
5757
AfterFunction: false
58-
# 命名空间定义后面大括号不换行
58+
# Do not break after namespace definitions
5959
AfterNamespace: false
60-
# struct 定义后面大括号不换行
60+
# Do not break after struct definitions
6161
AfterStruct: false
62-
# union 定义后面大括号不换行
62+
# Do not break after union definitions
6363
AfterUnion: false
64-
# extern 块后面大括号不换行
64+
# Do not break after extern blocks
6565
AfterExternBlock: false
66-
# catch 之前需要换行
66+
# Break before catch statements
6767
BeforeCatch: true
68-
# else 之前需要换行
68+
# Break before else statements
6969
BeforeElse: true
70-
# lambda 大括号不换行
70+
# Do not break before lambda bodies
7171
BeforeLambdaBody: false
72-
# while 之前需要换行
72+
# Break before while statements
7373
BeforeWhile: true
74-
# 不要缩进大括号
74+
# Do not indent braces
7575
IndentBraces: false
76-
# 空函数体可以在同一行
76+
# Allow empty function bodies on a single line
7777
SplitEmptyFunction: false
78-
# 空语句可以在同一行
78+
# Allow empty statements on a single line
7979
SplitEmptyRecord: false
80-
# 空命名空间可以在同一行
80+
# Allow empty namespaces on a single line
8181
SplitEmptyNamespace: false
82-
# 需要换行时在二元操作符前换行,除了赋值操作符
82+
# Break before binary operators, except for assignment operators
8383
BreakBeforeBinaryOperators: NonAssignment
84-
# 在 BraceWrapping 中自定义
84+
# Customize break before braces in BraceWrapping
8585
BreakBeforeBraces: Custom
86-
# 继承列表换行时逗号不换行
86+
# Do not break after commas in inheritance lists
8787
BreakBeforeInheritanceComma: false
88-
# 继承列表换行时冒号换行,逗号不换行
88+
# Break before colons in inheritance lists, but not before commas
8989
BreakInheritanceList: BeforeColon
90-
# 在三元运算操作符之前换行
90+
# Break before ternary operators
9191
BreakBeforeTernaryOperators: true
92-
# 构造函数初始化列表换行时逗号不换行
92+
# Do not break after commas in constructor initializer lists
9393
BreakConstructorInitializersBeforeComma: false
94-
# 构造函数初始化列表换行时冒号换行,逗号不换行
94+
# Break before colons in constructor initializer lists, but not before commas
9595
BreakConstructorInitializers: BeforeColon
96-
# 允许断开字符串文字
96+
# Allow breaking string literals
9797
BreakStringLiterals: true
98-
# 每行字符数限制
98+
# Column limit for each line
9999
ColumnLimit: 120
100100
CommentPragmas: '^ IWYU pragma:'
101-
# 不允许不同的命名空间定义在同一行
101+
# Do not allow different namespaces to be defined on the same line
102102
CompactNamespaces: false
103-
# 构造函数初始化列表要么都在一行,要么每个变量一行
103+
# Constructor initializer lists should either be all on one line or one per line
104104
ConstructorInitializerAllOnOneLineOrOnePerLine: true
105-
# 构造函数初始化列表需要 4 个缩进
105+
# Indent constructor initializer lists by 4 spaces
106106
ConstructorInitializerIndentWidth: 4
107-
# 换行后下一行需要 4 个 缩进
107+
# Indent continuation lines by 4 spaces
108108
ContinuationIndentWidth: 4
109-
# 变量初始化列表前后不需要空格
109+
# No spaces around variable initialization lists
110110
Cpp11BracedListStyle: true
111111
DerivePointerAlignment: true
112112
DisableFormat: false
113113
ExperimentalAutoDetectBinPacking: false
114-
# 自动为命名空间结尾处添加注释
114+
# Automatically add comments at the end of namespaces
115115
FixNamespaceComments: true
116116
ForEachMacros:
117117
- foreach
@@ -130,23 +130,23 @@ IncludeCategories:
130130
- Regex: .*
131131
Priority: 3
132132
IncludeIsMainRegex: ([-_](test|unittest))?$
133-
# switch 里的 case 需要缩进
133+
# Indent case labels inside switch statements
134134
IndentCaseLabels: true
135-
# extern 里的代码块需要缩进
135+
# Indent code blocks inside extern blocks
136136
IndentExternBlock: Indent
137-
# 预处理指令不能有缩进
137+
# Do not indent preprocessor directives
138138
IndentPPDirectives: None
139-
# 使用 4 个缩进
139+
# Use 4 spaces for indentation
140140
IndentWidth: 4
141-
# 函数声明、定义时在返回类型处换行时,下一行不要缩进
141+
# Do not indent wrapped function names after the return type
142142
IndentWrappedFunctionNames: false
143-
# 代码块开始处不要有空行
143+
# Do not keep empty lines at the start of code blocks
144144
KeepEmptyLinesAtTheStartOfBlocks: false
145145
MacroBlockBegin: ''
146146
MacroBlockEnd: ''
147-
# 不能有连续2个及以上的空行
147+
# Do not allow consecutive empty lines
148148
MaxEmptyLinesToKeep: 1
149-
# 命名空间内的内容不要缩进
149+
# Do not indent contents inside namespaces
150150
NamespaceIndentation: None
151151
PenaltyBreakAssignment: 2
152152
PenaltyBreakBeforeFirstCallParameter: 1
@@ -156,7 +156,7 @@ PenaltyBreakString: 1000
156156
PenaltyBreakTemplateDeclaration: 10
157157
PenaltyExcessCharacter: 1000000
158158
PenaltyReturnTypeOnItsOwnLine: 200
159-
# * & 紧挨类型名
159+
# * and & should be placed next to the type name
160160
PointerAlignment: Left
161161
RawStringFormats:
162162
- Language: Cpp
@@ -186,39 +186,39 @@ RawStringFormats:
186186
- ParseTextProtoOrDie
187187
CanonicalDelimiter: ''
188188
BasedOnStyle: google
189-
# 允许对注释重新排版
189+
# Allow reflowing of comments
190190
ReflowComments: true
191-
# 允许对 #include 排序
191+
# Allow sorting of #include statements
192192
SortIncludes: true
193-
# 允许对 using 声明排序
193+
# Allow sorting of using declarations
194194
SortUsingDeclarations: true
195-
# c 风格类型转换括号后不要有空格
195+
# Do not include spaces after C-style casts
196196
SpaceAfterCStyleCast: false
197-
# template 关键字后面需要一个空格
197+
# Require a space after the template keyword
198198
SpaceAfterTemplateKeyword: true
199-
# 赋值运算符两边需要空格
199+
# Require spaces around assignment operators
200200
SpaceBeforeAssignmentOperators: true
201-
# 变量初始化列表大括号前不要有空格
201+
# Do not include spaces before C++11 braced initializer lists
202202
SpaceBeforeCpp11BracedList: false
203-
# 构造函数初始化冒号前需要空格
203+
# Require a space before the colon in constructor initializers
204204
SpaceBeforeCtorInitializerColon: true
205-
# 继承语句冒号前需要一个空格
205+
# Require a space before the colon in inheritance statements
206206
SpaceBeforeInheritanceColon: true
207-
# 控制语句后面需要一个空格(if/for/while...)
207+
# Require a space after control statement keywords (if, for, while, etc.)
208208
SpaceBeforeParens: ControlStatements
209-
# 基于范围循环的冒号前需要一个空格
209+
# Require a space before the colon in range-based for loops
210210
SpaceBeforeRangeBasedForLoopColon: true
211-
# 不要在空的圆括号内添加空格
211+
# Do not include spaces inside empty parentheses
212212
SpaceInEmptyParentheses: false
213-
# 同行尾随注释 // 前面需要一个空格
213+
# Require a space before // in trailing comments
214214
SpacesBeforeTrailingComments: 1
215-
# 尖括号前后没有空格
215+
# Do not include spaces around angle brackets
216216
SpacesInAngles: false
217-
# c 风格类型转换的括号中前后没有空格
217+
# Do not include spaces around C-style cast parentheses
218218
SpacesInCStyleCastParentheses: false
219-
# 圆括号前后没有空格
219+
# Do not include spaces around parentheses
220220
SpacesInParentheses: false
221-
# 方括号前后没有空格
221+
# Do not include spaces around square brackets
222222
SpacesInSquareBrackets: false
223223
Standard: Auto
224224
StatementMacros:

.copier-answers.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
_commit: 12b9114
2+
_src_path: .
3+
author_email: '[email protected]
4+
5+
'
6+
author_name: msclock
7+
copyright_holder: msclock
8+
copyright_license: MIT License
9+
copyright_year: 2022-2023
10+
create_devcontainer: true
11+
docs_type: sphinx
12+
organization_name: msclock
13+
project_description: A development-focused Cpp project template.
14+
project_name: Cpp Scaffold
15+
repo_host_type: github.com
16+
repo_name: cpp-scaffold
17+
repo_namespace: msclock

.devcontainer/devcontainer.json

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
11
// For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at:
22
// https://github.com/microsoft/vscode-dev-containers/tree/v0.195.0/containers/cpp
33
{
4-
"name": "C++",
5-
"image": "mcr.microsoft.com/devcontainers/base:jammy",
6-
"capAdd": [
7-
// Enable ptrace-based debugging for C++
8-
"SYS_PTRACE"
9-
],
10-
"securityOpt": [
11-
"seccomp=unconfined"
12-
],
13-
"containerEnv": {
14-
"TZ": "Asia/Shanghai"
4+
"name": "cpp-scaffold",
5+
"image": "mcr.microsoft.com/devcontainers/base:jammy",
6+
"capAdd": [
7+
// Enable ptrace-based debugging for C++
8+
"SYS_PTRACE"
9+
],
10+
"securityOpt": [
11+
"seccomp=unconfined"
12+
],
13+
"containerEnv": {
14+
"TZ": "Asia/Shanghai"
15+
},
16+
// https://github.com/devcontainers/features
17+
// Using features in vscode requires access github with uncomment the below
18+
"features": {
19+
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
20+
"ghcr.io/devcontainers/features/python:1": {
21+
"installTools": false
1522
},
16-
// https://github.com/devcontainers/features
17-
// Using features in vscode requires access github with uncomment the below
18-
"features": {
19-
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
20-
"ghcr.io/devcontainers/features/python:1": {
21-
"installTools": false
22-
},
23-
"ghcr.io/dhoeric/features/act:1": {},
24-
"ghcr.io/msclock/features/vcpkg:1": {},
25-
"ghcr.io/devcontainers/features/common-utils:2": {
26-
"username": "vscode"
27-
}
28-
},
29-
// Use 'postCreateCommand' to run commands after the container is created.
30-
"postCreateCommand": {
31-
"git-completions": "echo 'source /usr/share/bash-completion/completions/git' >> ~/.bashrc"
32-
},
33-
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
34-
"remoteUser": "vscode"
23+
"ghcr.io/dhoeric/features/act:1": {},
24+
"ghcr.io/msclock/features/vcpkg:1": {},
25+
"ghcr.io/devcontainers/features/common-utils:2": {
26+
"username": "vscode"
27+
}
28+
},
29+
// Use 'postCreateCommand' to run commands after the container is created.
30+
"postCreateCommand": {
31+
"git-completions": "echo 'source /usr/share/bash-completion/completions/git' >> ~/.bashrc"
32+
},
33+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
34+
"remoteUser": "vscode"
3535
}

.editorconfig

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
13
root = true
24

35
[*]
46
end_of_line = lf
7+
charset = utf-8
8+
indent_size = 4
59
indent_style = space
6-
indent_size = 2
710
insert_final_newline = true
811
trim_trailing_whitespace = true
12+
13+
[*.{yml,yaml,json,toml,jinja,css}]
14+
indent_size = 2
15+
16+
[Makefile]
17+
indent_style = tab

.github/workflows/lint.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
name: lint
2+
23
on:
34
workflow_dispatch:
45
push:
5-
branches:
6-
- master
76
pull_request:
8-
branches:
9-
- master
107

118
jobs:
129
pre-commit:

.pre-commit-config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ repos:
4040
args:
4141
- --autofix
4242
- --offset=2
43+
exclude: |
44+
(?x)(
45+
.copier-answers.yml
46+
)
4347
4448
# Changes tabs to spaces
4549
- repo: https://github.com/Lucas-C/pre-commit-hooks

0 commit comments

Comments
 (0)