Skip to content

Commit

Permalink
Update ClangFormat and code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
acodcha committed Nov 18, 2024
1 parent c7fbf75 commit d8b9e5d
Show file tree
Hide file tree
Showing 26 changed files with 505 additions and 410 deletions.
90 changes: 69 additions & 21 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,43 +1,66 @@
---
# Copyright © 2023 Alexandre Coderre-Chabot
# Copyright © 2023-2024 Alexandre Coderre-Chabot
#
# https://github.com/acodcha/clang-format-tidy
# This file is part of Secret Santa, a simple C++ utility that organizes a "Secret Santa" gift
# exchange event!
#
# This file is licensed under the MIT license (https://mit-license.org). Permission is hereby
# granted, free of charge, to any person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
# Secret Santa is hosted at:
# https://github.com/acodcha/phq
#
# Secret Santa is licensed under the MIT License:
# https://mit-license.org
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
# associated documentation files (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, merge, publish, distribute,
# sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# - The above copyright notice and this permission notice shall be included in all copies or
# substantial portions of the Software.
# - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
# BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# This is a configuration file for use with LLVM's ClangFormat automatic source code formatter
# (https://clang.llvm.org/docs/ClangFormat.html). This file is compatible with ClangFormat version
# 14.0.0 or any later version. To format your source code files, copy this file to the root
# directory of your source code repository, name it ".clang-format", and run:
# clang-format --style=file path/to/source/code/files
# This is a configuration file for use with LLVM's ClangFormat automatic source code formatter:
# https://clang.llvm.org/docs/ClangFormat.html
#
# This file is compatible with ClangFormat version 18.0.0 or any later version. To format source
# code files in the Secret Santa repository, run:
# clang-format --style=file -i path/to/source/code/files
#
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignArrayOfStructures: Left
AlignConsecutiveAssignments: false
AlignConsecutiveBitFields: false
AlignConsecutiveDeclarations: false
AlignConsecutiveMacros: false
AlignConsecutiveAssignments:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
PadOperators: false
AlignConsecutiveBitFields:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignConsecutiveDeclarations:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignConsecutiveMacros:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignEscapedNewlines: Left
AlignOperands: Align
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowBreakBeforeNoexceptSpecifier: OnlyWithParen
AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: false
AllowShortCompoundRequirementOnASingleLine: true
AllowShortEnumsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: Never
Expand All @@ -51,6 +74,7 @@ AttributeMacros: ["__capability"]
BinPackArguments: true
BinPackParameters: true
BitFieldColonSpacing: Both
BracedInitializerIndentWidth: 2
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
Expand All @@ -70,10 +94,14 @@ BraceWrapping:
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
BreakAdjacentStringLiterals: false
BreakAfterAttributes: Never
BreakAfterJavaFieldAnnotations: false
BreakArrays: false
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeBraces: Custom
BreakBeforeConceptDeclarations: true
BreakBeforeConceptDeclarations: Always
BreakBeforeInlineASMColon: OnlyMultiline
BreakBeforeTernaryOperators: false
BreakConstructorInitializers: BeforeColon
BreakInheritanceList: BeforeColon
Expand Down Expand Up @@ -112,17 +140,28 @@ IndentCaseLabels: true
IndentExternBlock: NoIndent
IndentGotoLabels: true
IndentPPDirectives: BeforeHash
IndentRequires: false
IndentRequiresClause: false
IndentWidth: 2
IndentWrappedFunctionNames: false
InsertBraces: true
InsertNewlineAtEOF: true
InsertTrailingCommas: None
IntegerLiteralSeparator:
Binary: 0
BinaryMinDigits: 0
Decimal: 0
DecimalMinDigits: 0
Hex: 0
HexMinDigits: 0
JavaImportGroups: []
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
LambdaBodyIndentation: Signature
LineEnding: DeriveLF
MacroBlockBegin: ""
MacroBlockEnd: ""
Macros: []
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
NamespaceMacros: []
Expand All @@ -138,6 +177,7 @@ PenaltyBreakBeforeFirstCallParameter: 4
PenaltyBreakComment: 8
PenaltyBreakFirstLessLess: 4
PenaltyBreakOpenParenthesis: 4
PenaltyBreakScopeResolution: 50
PenaltyBreakString: 100
PenaltyBreakTemplateDeclaration: 0
PenaltyExcessCharacter: 10000
Expand Down Expand Up @@ -167,11 +207,15 @@ RawStringFormats:
ReferenceAlignment: Left
ReflowComments: true
RemoveBracesLLVM: false
RemoveSemicolon: false
RequiresClausePosition: SingleLine
RequiresExpressionIndentation: OuterScope
SeparateDefinitionBlocks: Leave
ShortNamespaceLines: 0
SkipMacroDefinitionBody: true
SortIncludes: CaseInsensitive
SortJavaStaticImport: Before
SortUsingDeclarations: true
SortUsingDeclarations: Lexicographic
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
Expand All @@ -181,6 +225,7 @@ SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeJsonColon: false
SpaceBeforeParens: Custom
SpaceBeforeParensOptions:
AfterControlStatements: true
Expand All @@ -189,6 +234,8 @@ SpaceBeforeParensOptions:
AfterFunctionDefinitionName: false
AfterIfMacros: true
AfterOverloadedOperator: false
AfterRequiresInClause: true
AfterRequiresInExpression: true
BeforeNonEmptyParentheses: false
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: false
Expand All @@ -211,6 +258,7 @@ TabWidth: 8
TypenameMacros: ["STACK_OF", "LIST"]
UseCRLF: false
UseTab: Never
VerilogBreakBetweenInstancePorts: false
WhitespaceSensitiveMacros:
- "STRINGIZE"
- "PP_STRINGIZE"
Expand Down
33 changes: 20 additions & 13 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,26 +1,33 @@
---
# Copyright © 2023 Alexandre Coderre-Chabot
# Copyright © 2023-2024 Alexandre Coderre-Chabot
#
# https://github.com/acodcha/clang-format-tidy
# This file is part of Secret Santa, a simple C++ utility that organizes a "Secret Santa" gift
# exchange event!
#
# This file is licensed under the MIT license (https://mit-license.org). Permission is hereby
# granted, free of charge, to any person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
# Secret Santa is hosted at:
# https://github.com/acodcha/phq
#
# Secret Santa is licensed under the MIT License:
# https://mit-license.org
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
# associated documentation files (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, merge, publish, distribute,
# sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# - The above copyright notice and this permission notice shall be included in all copies or
# substantial portions of the Software.
# - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
# BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# This is a configuration file for use with LLVM's Clang-Tidy automatic source code linter
# (https://clang.llvm.org/extra/clang-tidy). To run the linter on your source code files, copy this
# file to the root directory of your source code repository, name it ".clang-tidy", and run:
# clang-tidy --extra-arg=-std=c++20 /path/to/source/code/files
# This is a configuration file for use with LLVM's Clang-Tidy automatic source code linter:
# https://clang.llvm.org/extra/clang-tidy
#
# To run the linter on source code files in the Secret Santa repository, run:
# clang-tidy --extra-arg=-std=c++17 /path/to/source/code/files
#
Checks: '
*,
Expand Down
54 changes: 27 additions & 27 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
# Copyright © 2023 Alexandre Coderre-Chabot
# Copyright © 2023-2024 Alexandre Coderre-Chabot
#
# This file is licensed under the MIT license. For more information, visit:
# This file is part of Secret Santa, a simple C++ utility that organizes a "Secret Santa" gift
# exchange event!
#
# Secret Santa is hosted at:
# https://github.com/acodcha/phq
#
# Secret Santa is licensed under the MIT License:
# https://mit-license.org
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
# associated documentation files (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, merge, publish, distribute,
# sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# - The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
# - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
#
# This file was originally obtained from:
# https://github.com/acodcha/secret-santa
# - The above copyright notice and this permission notice shall be included in all copies or
# substantial portions of the Software.
# - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
# BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

cmake_minimum_required(VERSION 3.12 FATAL_ERROR)

Expand Down Expand Up @@ -57,11 +57,11 @@ FetchContent_MakeAvailable(yaml-cpp)
message(STATUS "The yaml-cpp library was fetched from: https://github.com/jbeder/yaml-cpp.git")

# Define the Secret Santa Randomizer executable.
add_executable(secret-santa-randomizer ${PROJECT_SOURCE_DIR}/source/Randomizer/Main.cpp)
add_executable(secret-santa-randomizer ${PROJECT_SOURCE_DIR}/source/RandomizerMain.cpp)
target_link_libraries(secret-santa-randomizer PUBLIC stdc++fs yaml-cpp)

# Define the Secret Santa Messenger executable.
add_executable(secret-santa-messenger ${PROJECT_SOURCE_DIR}/source/Messenger/Main.cpp)
add_executable(secret-santa-messenger ${PROJECT_SOURCE_DIR}/source/MessengerMain.cpp)
target_link_libraries(secret-santa-messenger PUBLIC stdc++fs yaml-cpp)

# Configure the Secret Santa tests.
Expand Down Expand Up @@ -93,23 +93,23 @@ if(TEST_SECRET_SANTA)
target_link_libraries(test_configuration yaml-cpp GTest::gtest_main)
gtest_discover_tests(test_configuration)

add_executable(test_emailer ${PROJECT_SOURCE_DIR}/test/Emailer.cpp)
target_link_libraries(test_emailer yaml-cpp GTest::gtest_main)
gtest_discover_tests(test_emailer)

add_executable(test_matchings ${PROJECT_SOURCE_DIR}/test/Matchings.cpp)
target_link_libraries(test_matchings yaml-cpp GTest::gtest_main)
gtest_discover_tests(test_matchings)

add_executable(test_messenger_emailer ${PROJECT_SOURCE_DIR}/test/Messenger/Emailer.cpp)
target_link_libraries(test_messenger_emailer yaml-cpp GTest::gtest_main)
gtest_discover_tests(test_messenger_emailer)

add_executable(test_messenger_settings ${PROJECT_SOURCE_DIR}/test/Messenger/Settings.cpp)
add_executable(test_messenger_settings ${PROJECT_SOURCE_DIR}/test/MessengerSettings.cpp)
target_link_libraries(test_messenger_settings yaml-cpp GTest::gtest_main)
gtest_discover_tests(test_messenger_settings)

add_executable(test_participant ${PROJECT_SOURCE_DIR}/test/Participant.cpp)
target_link_libraries(test_participant yaml-cpp GTest::gtest_main)
gtest_discover_tests(test_participant)

add_executable(test_randomizer_settings ${PROJECT_SOURCE_DIR}/test/Randomizer/Settings.cpp)
add_executable(test_randomizer_settings ${PROJECT_SOURCE_DIR}/test/RandomizerSettings.cpp)
target_link_libraries(test_randomizer_settings yaml-cpp GTest::gtest_main)
gtest_discover_tests(test_randomizer_settings)

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![build and test](https://github.com/acodcha/secret-santa/actions/workflows/build_and_test.yaml/badge.svg?branch=main)](https://github.com/acodcha/secret-santa/actions/workflows/build_and_test.yaml)

Organizes a "Secret Santa" gift exchange event! Given a list of participant names, addresses, and emails, this project randomizes the gift exchange and sends instructions via email to each participant.
Simple C++ utility that organizes a "Secret Santa" gift exchange event! Given a list of participant names, addresses, and emails, this project randomizes the gift exchange and sends instructions via email to each participant.

- [Requirements](#requirements)
- [Configuration](#configuration)
Expand Down
21 changes: 12 additions & 9 deletions source/Configuration.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
// Copyright © 2023-2024 Alexandre Coderre-Chabot
//
// This file is licensed under the MIT license. For more information, visit:
// This file is part of Secret Santa, a simple C++ utility that organizes a "Secret Santa" gift
// exchange event!
//
// Secret Santa is hosted at:
// https://github.com/acodcha/phq
//
// Secret Santa is licensed under the MIT License:
// https://mit-license.org
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
Expand All @@ -9,15 +15,12 @@
// sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// - The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
// substantial portions of the Software.
// - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
// BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// This file was originally obtained from:
// https://github.com/acodcha/secret-santa
// BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

#ifndef SECRET_SANTA_CONFIGURATION_HPP
#define SECRET_SANTA_CONFIGURATION_HPP
Expand Down
Loading

0 comments on commit d8b9e5d

Please sign in to comment.