Skip to content

Commit 9cb95b5

Browse files
committed
Clang: Format
1 parent 215af4b commit 9cb95b5

26 files changed

+7304
-7244
lines changed

Diff for: .clang-format

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
BasedOnStyle: Google
2+
ColumnLimit: 120
3+
IndentWidth: 4
4+
TabWidth: 4
5+
UseTab: Always
6+
ReflowComments: false
7+
AccessModifierOffset: -4
8+
IncludeBlocks: Preserve
9+
BreakBeforeBraces: Allman
10+
BreakBeforeTernaryOperators: true
11+
BreakBeforeBinaryOperators: NonAssignment
12+
SpaceInEmptyBlock: true
13+
SpacesBeforeTrailingComments: 1
14+
SpaceAfterTemplateKeyword: true
15+
IndentAccessModifiers: false
16+
IndentRequiresClause: false
17+
IndentCaseLabels: false
18+
IndentPPDirectives: BeforeHash
19+
InsertNewlineAtEOF: true
20+
BinPackArguments: true
21+
BinPackParameters: true
22+
PackConstructorInitializers: BinPack
23+
NamespaceIndentation: All
24+
Cpp11BracedListStyle: false
25+
FixNamespaceComments: false
26+
AlignAfterOpenBracket: DontAlign
27+
AlignOperands: false
28+
AllowShortLoopsOnASingleLine: false
29+
AllowShortBlocksOnASingleLine: Empty
30+
AllowShortFunctionsOnASingleLine: Empty
31+
AllowShortIfStatementsOnASingleLine: Never
32+
AllowAllArgumentsOnNextLine: false

Diff for: .clang-tidy

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Checks: >
2+
-*
3+
clang-analyzer-*
4+
5+
WarningsAsErrors: "*"
6+
FormatStyle: file

Diff for: .editorconfig

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
indent_style = tab
6+
indent_size = 4
7+
insert_final_newline = true
8+
trim_trailing_whitespace = true

Diff for: .github/workflows/linux.yaml

+44-44
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,51 @@
11
name: Linux
22

33
on:
4-
push:
5-
branches: [master]
6-
pull_request:
7-
branches: [master]
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
88

99
env:
10-
BUILD_TYPE: Release
10+
BUILD_TYPE: Release
1111

1212
jobs:
13-
build:
14-
runs-on: ubuntu-latest
15-
steps:
16-
- name: Checkout
17-
uses: actions/checkout@v2
18-
19-
- name: Vcpkg
20-
uses: lukka/run-vcpkg@v11
21-
with:
22-
vcpkgGitCommitId: 4a600e9fea71bd7872080cbb716797e04d30e6d3
23-
24-
- name: Build
25-
run: |
26-
mkdir build && cd build
27-
cmake .. -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_TOOLCHAIN_FILE=".vcpkg/linux.cmake" -DBUILD_TESTING=True
28-
cmake --build . --config ${{env.BUILD_TYPE}}
29-
30-
- name: Artifact
31-
uses: actions/upload-artifact@v2
32-
with:
33-
name: build-artifact
34-
path: build
35-
36-
tests:
37-
runs-on: ubuntu-latest
38-
needs: [build]
39-
steps:
40-
- name: Checkout
41-
uses: actions/checkout@v2
42-
43-
- name: Artifact
44-
uses: actions/download-artifact@v2
45-
with:
46-
name: build-artifact
47-
path: build
48-
49-
- name: Tests
50-
run: |
51-
ctest -C ${{env.BUILD_TYPE}}
13+
build:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v2
18+
19+
- name: Vcpkg
20+
uses: lukka/run-vcpkg@v11
21+
with:
22+
vcpkgGitCommitId: 4a600e9fea71bd7872080cbb716797e04d30e6d3
23+
24+
- name: Build
25+
run: |
26+
mkdir build && cd build
27+
cmake .. --preset linux -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_TESTING=True
28+
cmake --build . --config ${{env.BUILD_TYPE}}
29+
30+
- name: Artifact
31+
uses: actions/upload-artifact@v2
32+
with:
33+
name: build-artifact
34+
path: build
35+
36+
tests:
37+
runs-on: ubuntu-latest
38+
needs: [build]
39+
steps:
40+
- name: Checkout
41+
uses: actions/checkout@v2
42+
43+
- name: Artifact
44+
uses: actions/download-artifact@v2
45+
with:
46+
name: build-artifact
47+
path: build
48+
49+
- name: Tests
50+
run: |
51+
ctest -C ${{env.BUILD_TYPE}}

Diff for: .github/workflows/windows.yaml

+52-52
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,67 @@
11
name: Windows
22

33
on:
4-
push:
5-
branches: [master]
6-
pull_request:
7-
branches: [master]
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
88

99
env:
10-
BUILD_TYPE: Release
10+
BUILD_TYPE: Release
1111

1212
jobs:
13-
build:
14-
runs-on: windows-latest
15-
steps:
16-
- name: Checkout
17-
uses: actions/checkout@v2
13+
build:
14+
runs-on: windows-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v2
1818

19-
- name: Vcpkg
20-
uses: lukka/run-vcpkg@v11
21-
with:
22-
vcpkgGitCommitId: 4a600e9fea71bd7872080cbb716797e04d30e6d3
19+
- name: Vcpkg
20+
uses: lukka/run-vcpkg@v11
21+
with:
22+
vcpkgGitCommitId: 4a600e9fea71bd7872080cbb716797e04d30e6d3
2323

24-
- name: Build
25-
run: |
26-
mkdir build && cd build
27-
cmake .. -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_TOOLCHAIN_FILE=".vcpkg/windows.cmake" -DBUILD_TESTING=True
28-
cmake --build . --config ${{env.BUILD_TYPE}}
24+
- name: Build
25+
run: |
26+
mkdir build && cd build
27+
cmake .. --preset windows -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_TESTING=True
28+
cmake --build . --config ${{env.BUILD_TYPE}}
2929
30-
- name: Artifact
31-
uses: actions/upload-artifact@v2
32-
with:
33-
name: build-artifact
34-
path: build
30+
- name: Artifact
31+
uses: actions/upload-artifact@v2
32+
with:
33+
name: build-artifact
34+
path: build
3535

36-
tests:
37-
runs-on: windows-latest
38-
needs: [build]
39-
steps:
40-
- name: Checkout
41-
uses: actions/checkout@v2
36+
tests:
37+
runs-on: windows-latest
38+
needs: [build]
39+
steps:
40+
- name: Checkout
41+
uses: actions/checkout@v2
4242

43-
- name: OpenCppCoverage
44-
shell: bash
45-
run: |
46-
choco install -y opencppcoverage
47-
echo "C:\Program Files\OpenCppCoverage" >> $GITHUB_PATH
43+
- name: OpenCppCoverage
44+
shell: bash
45+
run: |
46+
choco install -y opencppcoverage
47+
echo "C:\Program Files\OpenCppCoverage" >> $GITHUB_PATH
4848
49-
- name: Artifact
50-
uses: actions/download-artifact@v2
51-
with:
52-
name: build-artifact
53-
path: build
49+
- name: Artifact
50+
uses: actions/download-artifact@v2
51+
with:
52+
name: build-artifact
53+
path: build
5454

55-
- name: Tests
56-
run: |
57-
opencppcoverage --quiet --export_type=cobertura:opencppcoverageCoverage.xml --working_dir build --sources src -- build/Release/CoD4DM1.Tests.exe
55+
- name: Tests
56+
run: |
57+
opencppcoverage --quiet --export_type=cobertura:opencppcoverageCoverage.xml --working_dir build --sources src -- build/Release/CoD4DM1.Tests.exe
5858
59-
- name: CodeCov
60-
uses: codecov/codecov-action@v2
61-
with:
62-
token: ${{ secrets.CODECOV_TOKEN }}
63-
files: ./opencppcoverageCoverage.xml
64-
flags: unittests
65-
name: codecov-umbrella
66-
fail_ci_if_error: true
67-
verbose: true
59+
- name: CodeCov
60+
uses: codecov/codecov-action@v2
61+
with:
62+
token: ${{ secrets.CODECOV_TOKEN }}
63+
files: ./opencppcoverageCoverage.xml
64+
flags: unittests
65+
name: codecov-umbrella
66+
fail_ci_if_error: true
67+
verbose: true

Diff for: CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ set(CMAKE_CXX_STANDARD 20)
55
set(CMAKE_CXX_STANDARD_REQUIRED ON)
66
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
77

8+
# CMake
9+
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
10+
include(ClangTools)
11+
812
# CPack
913
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
1014
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})

Diff for: CMakePresets.json

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"version": 7,
3+
"cmakeMinimumRequired": {
4+
"major": 3,
5+
"minor": 27,
6+
"patch": 0
7+
},
8+
"configurePresets": [
9+
{
10+
"name": "windows",
11+
"generator": "Visual Studio 17 2022",
12+
"cacheVariables": {
13+
"CMAKE_TOOLCHAIN_FILE": ".vcpkg/windows.cmake"
14+
}
15+
},
16+
{
17+
"name": "windows-mingw",
18+
"generator": "MinGW Makefiles",
19+
"cacheVariables": {
20+
"CMAKE_TOOLCHAIN_FILE": ".vcpkg/windows.cmake"
21+
}
22+
},
23+
{
24+
"name": "linux",
25+
"cacheVariables": {
26+
"CMAKE_TOOLCHAIN_FILE": ".vcpkg/linux.cmake"
27+
}
28+
}
29+
]
30+
}

Diff for: README.md

+10-7
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@
55
[![CodeCov](https://img.shields.io/codecov/c/github/Iswenzz/CoD4-DM1?label=codecov&logo=codecov)](https://codecov.io/gh/Iswenzz/CoD4-DM1)
66
[![License](https://img.shields.io/github/license/Iswenzz/CoD4-DM1?color=blue&logo=gitbook&logoColor=white)](https://github.com/Iswenzz/CoD4-DM1/blob/master/LICENSE)
77

8-
Reverse of CoD4 & CoD4X ``.DM_1`` demo files with features such as parsing snapshot informations, frames, entities, clients and server messages. This project comes with a CLI and a library.
8+
Reverse of CoD4 & CoD4X `.DM_1` demo files with features such as parsing snapshot informations, frames, entities, clients and server messages. This project comes with a CLI and a library.
99

1010
## Features
11-
* Protocol CoD4 & CoD4X 16+
12-
* Parsing of gamestate, snapshot, frames, entities, clients, configs and server messages
13-
* CoD4 & Q3 huffman code
14-
* Demo reader API
11+
12+
- Protocol CoD4 & CoD4X 16+
13+
- Parsing of gamestate, snapshot, frames, entities, clients, configs and server messages
14+
- CoD4 & Q3 huffman code
15+
- Demo reader API
1516

1617
## Building
1718

@@ -21,16 +22,18 @@ Reverse of CoD4 & CoD4X ``.DM_1`` demo files with features such as parsing snaps
2122
_Build Command:_
2223

2324
mkdir build && cd build
24-
cmake .. -DCMAKE_TOOLCHAIN_FILE=.vcpkg/windows.cmake
25+
cmake .. --preset windows
2526
cmake --build .
2627

2728
### [Download](https://github.com/Iswenzz/CoD4-DM1/releases)
2829

2930
## Package
31+
3032
This package is available for use via [vcpkg-registry](https://github.com/Iswenzz/vcpkg-registry).
3133

3234
## Contributors
33-
***Note:*** If you would like to contribute to this repository, feel free to send a pull request, and I will review your code.
35+
36+
**_Note:_** If you would like to contribute to this repository, feel free to send a pull request, and I will review your code.
3437
Also feel free to post about any problems that may arise in the issues section of the repository.
3538

3639
<a href="https://github.com/Caball009"><img src="https://avatars.githubusercontent.com/u/82909616?v=4" height=64 style="border-radius: 50%"></a>

Diff for: cmake/ClangTools.cmake

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
2+
3+
add_custom_target(clang-tidy
4+
COMMAND find . -type f \( -name '*.cpp' -o -name '*.hpp' \) -not -path './build/*' -exec clang-tidy --config-file=.clang-tidy {} +
5+
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
6+
7+
add_custom_target(clang-format
8+
COMMAND find . -type f \( -name '*.cpp' -o -name '*.hpp' \) -not -path './build/*' -exec clang-format -style=file -i --verbose {} +
9+
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
10+
11+
set_target_properties(clang-tidy PROPERTIES FOLDER Clang)
12+
set_target_properties(clang-format PROPERTIES FOLDER Clang)

0 commit comments

Comments
 (0)