Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
chaserli committed Mar 15, 2024
1 parent 50562f3 commit 900161f
Show file tree
Hide file tree
Showing 4 changed files with 148 additions and 3 deletions.
39 changes: 39 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
# See all possible options and defaults with:
# clang-format --style=Microsoft --dump-config
BasedOnStyle: Microsoft
Language: Cpp
Standard: c++20
AccessModifierOffset: -4
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: false
BinPackParameters: false
BreakBeforeBinaryOperators: All
BreakConstructorInitializers: BeforeColon
ColumnLimit: 0
CommentPragmas: 'NOLINT:.*|^ IWYU pragma:'
IncludeBlocks: Regroup
IndentCaseLabels: true
IndentPPDirectives: AfterHash
# IndentWidth: 4
SpaceAfterCStyleCast: true
UseTab: Always
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: true
AllowShortLambdasOnASingleLine: Inline
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
BreakBeforeBraces: Allman
DerivePointerAlignment: false
KeepEmptyLinesAtTheStartOfBlocks: false
NamespaceIndentation: None
PointerAlignment: Left
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
73 changes: 73 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
FormatStyle: file

Checks: |
*bugprone*,
*performance*,
clang-analyzer-optin.cplusplus.VirtualCall,
clang-analyzer-optin.performance.Padding,
cppcoreguidelines-slicing,
google-explicit-constructor,
misc-definitions-in-headers,
misc-misplaced-const,
misc-non-copyable-objects,
misc-static-assert,
misc-throw-by-value-catch-by-reference,
misc-uniqueptr-reset-release,
modernize-avoid-bind,
modernize-loop-convert,
modernize-make-unique,
modernize-redundant-void-arg,
modernize-replace-auto-ptr,
modernize-replace-disallow-copy-and-assign-macro,
modernize-replace-random-shuffle,
modernize-shrink-to-fit,
modernize-use-auto,
modernize-use-bool-literals,
modernize-use-default-member-init,
modernize-use-emplace,
modernize-use-equals-default,
modernize-use-equals-delete,
modernize-use-noexcept,
modernize-use-nullptr,
modernize-use-using,
readability-avoid-const-params-in-decls,
readability-const-return-type,
readability-container-size-empty,
readability-delete-null-pointer,
readability-else-after-return,
readability-inconsistent-declaration-parameter-name,
readability-make-member-function-const,
readability-misplaced-array-index,
readability-non-const-parameter,
readability-qualified-auto,
readability-redundant-function-ptr-dereference,
readability-redundant-smartptr-get,
readability-redundant-string-cstr,
readability-simplify-subscript-expr,
readability-static-accessed-through-instance,
readability-static-definition-in-anonymous-namespace,
readability-string-compare,
readability-suspicious-call-argument,
readability-uniqueptr-delete-release,
-bugprone-easily-swappable-parameters,
-bugprone-exception-escape,
-bugprone-reserved-identifier,
-bugprone-unused-raii,
CheckOptions:
- key: modernize-use-equals-default.IgnoreMacros
value: false
- key: performance-for-range-copy.WarnOnAllAutoCopies
value: true
- key: performance-inefficient-string-concatenation.StrictMode
value: true
- key: performance-unnecessary-value-param.AllowedTypes
value: 'exception_ptr$;'
- key: readability-implicit-bool-conversion.AllowPointerConditions
value: true
- key: readability-implicit-bool-conversion.AllowIntegerConditions
value: true
- key: readability-braces-around-statements.ShortStatementLines
value: 2

# HeaderFilterRegex:
27 changes: 27 additions & 0 deletions .github/workflows/clang-format-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: clang-format Check
on:
pull_request:
push:
branches:
- clang-format
# - develop
jobs:
formatting-check:
name: Formatting Check
runs-on: ubuntu-latest
strategy:
matrix:
path:
- check: 'src'
exclude: '(Dummy|Sample|Coroutine)'
# - check: 'docs'
# exclude: ''
steps:
- uses: actions/checkout@v3
- name: Run clang-format style check for C/C++/Protobuf programs.
uses: jidicula/[email protected]
with:
clang-format-version: '13'
check-path: ${{ matrix.path['check'] }}
exclude-regex: ${{ matrix.path['exclude'] }}
fallback-style: 'Mozilla'
12 changes: 9 additions & 3 deletions Phobos.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -317,20 +317,26 @@
<LinkIncremental>false</LinkIncremental>
<OutDir>$(Configuration)\</OutDir>
<IntDir>$(Configuration)\IntDir\</IntDir>
<EnableClangTidyCodeAnalysis>true</EnableClangTidyCodeAnalysis>
<ClangTidyChecks>-clang-diagnostic-pragma-once-outside-header</ClangTidyChecks>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DevBuild|Win32'">
<GenerateManifest>false</GenerateManifest>
<IncludePath>$(SolutionDir)src\;$(SolutionDir)src\ExtraHeaders;$(SolutionDir)yrpp;$(SolutionDir)lib;$(VC_IncludePath)</IncludePath>
<LinkIncremental>false</LinkIncremental>
<OutDir>$(Configuration)\</OutDir>
<IntDir>$(Configuration)\IntDir\</IntDir>
<EnableClangTidyCodeAnalysis>true</EnableClangTidyCodeAnalysis>
<ClangTidyChecks>-clang-diagnostic-pragma-once-outside-header</ClangTidyChecks>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<GenerateManifest>false</GenerateManifest>
<IncludePath>$(SolutionDir)src\;$(SolutionDir)src\ExtraHeaders;$(SolutionDir)yrpp;$(SolutionDir)lib;$(VC_IncludePath)</IncludePath>
<LinkIncremental>false</LinkIncremental>
<OutDir>$(Configuration)\</OutDir>
<IntDir>$(Configuration)\IntDir\</IntDir>
<EnableClangTidyCodeAnalysis>true</EnableClangTidyCodeAnalysis>
<ClangTidyChecks>-clang-diagnostic-pragma-once-outside-header</ClangTidyChecks>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
Expand All @@ -356,7 +362,7 @@
<ObjectFileName>$(IntDir)\%(RelativeDir)</ObjectFileName>
<CallingConvention>StdCall</CallingConvention>
<AdditionalOptions>%(AdditionalOptions)</AdditionalOptions>
<DisableSpecificWarnings>4100;4201;4530;4731;4740;4458;4819;5103;5105</DisableSpecificWarnings>
<DisableSpecificWarnings>4100;4201;4530;4731;4740;4458;4819;5103;5105;26495;</DisableSpecificWarnings>
<EnableModules>true</EnableModules>
<OpenMPSupport>true</OpenMPSupport>
</ClCompile>
Expand Down Expand Up @@ -400,7 +406,7 @@
<ObjectFileName>$(IntDir)\%(RelativeDir)</ObjectFileName>
<CallingConvention>StdCall</CallingConvention>
<AdditionalOptions>%(AdditionalOptions)</AdditionalOptions>
<DisableSpecificWarnings>4100;4201;4530;4731;4740;4458;4819;5103;5105</DisableSpecificWarnings>
<DisableSpecificWarnings>4100;4201;4530;4731;4740;4458;4819;5103;5105;26495;</DisableSpecificWarnings>
<EnableModules>true</EnableModules>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<OpenMPSupport>true</OpenMPSupport>
Expand Down Expand Up @@ -443,7 +449,7 @@
<ObjectFileName>$(IntDir)\%(RelativeDir)</ObjectFileName>
<CallingConvention>StdCall</CallingConvention>
<AdditionalOptions>%(AdditionalOptions)</AdditionalOptions>
<DisableSpecificWarnings>4100;4201;4530;4731;4740;4458;4819;5103;5105;26495</DisableSpecificWarnings>
<DisableSpecificWarnings>4100;4201;4530;4731;4740;4458;4819;5103;5105;26495;26495</DisableSpecificWarnings>
<EnableModules>true</EnableModules>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<OpenMPSupport>true</OpenMPSupport>
Expand Down

0 comments on commit 900161f

Please sign in to comment.