Skip to content

Commit 5ba3801

Browse files
committed
Clean up project
1 parent 2714412 commit 5ba3801

20 files changed

Lines changed: 4816 additions & 4577 deletions

.clang-format

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
BasedOnStyle: webkit
2+
AlignTrailingComments: true
3+
AllowShortBlocksOnASingleLine: true
4+
AllowShortCaseLabelsOnASingleLine: true
5+
AllowShortFunctionsOnASingleLine: All
6+
AllowShortIfStatementsOnASingleLine: WithoutElse
7+
PointerAlignment: Right
8+
TabWidth: 4
9+
UseTab: ForIndentation
10+
SortIncludes: true
11+
NamespaceIndentation: None
12+
FixNamespaceComments: true
13+
QualifierAlignment: Left

.clang-tidy

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
---
2+
# clang-tidy configuration
3+
#
4+
# clang-tidy can be run manually like this:
5+
#
6+
# run-clang-tidy -p build 'Source.*'
7+
#
8+
# To apply fixes suggested by clang-tidy, run:
9+
#
10+
# run-clang-tidy -p build -fix -format 'Source.*'
11+
#
12+
# To limit the run to certain checks:
13+
#
14+
# run-clang-tidy -checks='-*,modernize-use-nullptr' -p build 'Source.*'
15+
#
16+
# clang-tidy also has several IDE integrations listed here:
17+
# https://clang.llvm.org/extra/clang-tidy/Integrations.html
18+
19+
# Enable most checks.
20+
#
21+
# Built-in checks:
22+
# https://clang.llvm.org/extra/clang-tidy/checks/list.html
23+
#
24+
# Exclusions:
25+
#
26+
# -modernize-avoid-c-arrays
27+
# We use C-arrays throughout, e.g. for `constexpr char []`.
28+
# `std::array` is not a replacement because its length is
29+
# not deduced.
30+
#
31+
# -modernize-use-trailing-return-type
32+
# A purely stylistic change that we do not want.
33+
#
34+
# -modernize-concat-nested-namespaces
35+
# -modernize-avoid-bind
36+
# Compatibility with older compilers.
37+
Checks: >
38+
-*,
39+
bugprone-*,
40+
cppcoreguidelines-pro-type-cstyle-cast,
41+
google-runtime-int,
42+
llvm-include-order,
43+
llvm-namespace-comment,
44+
misc-*,
45+
modernize-*,
46+
performance-*,
47+
portability-*,
48+
readability-*,
49+
-readability-identifier-length,
50+
-bugprone-easily-swappable-parameters,
51+
-readability-magic-numbers,
52+
-misc-non-private-member-variables-in-classes,
53+
-modernize-avoid-c-arrays,
54+
-modernize-use-trailing-return-type,
55+
-modernize-concat-nested-namespaces,
56+
-modernize-avoid-bind,
57+
-modernize-use-constraints
58+
59+
HeaderFilterRegex: "^(Source|test)\\.h$"
60+
61+
CheckOptions:
62+
- { key: readability-identifier-naming.NamespaceCase, value: lower_case }
63+
- { key: readability-identifier-naming.ClassCase, value: CamelCase }
64+
- { key: readability-identifier-naming.StructCase, value: CamelCase }
65+
- { key: readability-identifier-naming.TemplateParameterCase, value: CamelCase }
66+
- { key: readability-identifier-naming.MethodCase, value: camelBack }
67+
- { key: readability-identifier-naming.FunctionCase, value: CamelCase }
68+
- { key: readability-identifier-naming.ParameterCase, value: camelBack }
69+
- { key: readability-identifier-naming.MemberCase, value: camelBack }
70+
- { key: readability-identifier-naming.VariableCase, value: camelBack }
71+
- { key: readability-identifier-naming.ClassMemberCase, value: lower_case }
72+
- { key: readability-identifier-naming.GlobalVariableCase, value: aNy_CasE }
73+
- { key: readability-identifier-naming.GlobalFunctionCase, value: aNy_CasE }
74+
- { key: readability-identifier-naming.ClassMemberSuffix, value: _ }
75+
- { key: readability-identifier-naming.PrivateMemberSuffix, value: _ }
76+
- { key: readability-identifier-naming.ProtectedMemberSuffix, value: _ }
77+
- { key: readability-identifier-naming.EnumConstantCase, value: CamelCase }
78+
- { key: readability-identifier-naming.ConstexprVariableCase, value: CamelCase }
79+
- { key: readability-identifier-naming.GlobalConstantCase, value: CamelCase }
80+
- { key: readability-identifier-naming.MemberConstantCase, value: CamelCase }
81+
- { key: readability-identifier-naming.StaticConstantCase, value: CamelCase }
82+
83+
# Allow short if-statements without braces
84+
- { key: readability-braces-around-statements.ShortStatementLines, value: 3 }
85+
86+
# Use <cstdint> fixed-width integer types instead of short, long and long long
87+
- { key: google-runtime-int.UnsignedTypePrefix, value: "std::uint" }
88+
- { key: google-runtime-int.SignedTypePrefix, value: "std::int" }
89+
- { key: google-runtime-int.TypeSuffix, value: "_t" }
90+
91+
# `int8_t` aren't used as chars, disable misleading warning.
92+
- { key: bugprone-signed-char-misuse.CharTypdefsToIgnore, value: "std::int8_t" }
93+
94+
- { key: readability-identifier-length.MinimumLoopCounterNameLength, value: 1 }
95+
96+
# Ignore warnings for individual SDL headers, e.g. SDL_video.h, SDL_render.h
97+
- { key: misc-include-cleaner.IgnoreHeaders, value: 'SDL_.*\.h' }
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: clang-format check
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- main
8+
paths-ignore:
9+
- '*.md'
10+
- 'docs/**'
11+
pull_request:
12+
types: [ opened, synchronize ]
13+
paths-ignore:
14+
- '*.md'
15+
- 'docs/**'
16+
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.ref }}
19+
cancel-in-progress: true
20+
21+
jobs:
22+
formatting-check:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
28+
- name: Formatting Check (src)
29+
uses: jidicula/clang-format-action@v4.18.0
30+
with:
31+
clang-format-version: '18'
32+
check-path: 'src'
33+
34+
- name: Formatting Check (include)
35+
uses: jidicula/clang-format-action@v4.18.0
36+
with:
37+
clang-format-version: '18'
38+
check-path: 'include'
39+
40+
- name: Formatting Check (tests)
41+
uses: jidicula/clang-format-action@v4.18.0
42+
with:
43+
clang-format-version: '18'
44+
check-path: 'tests'
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: clang-tidy check
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- main
8+
paths: ['**.c', '**.cpp', '**.h', '**.hpp', '**CMakeLists.txt', '**.cmake', '.clang-tidy', '.github/workflows/clang-tidy-check.yml']
9+
pull_request:
10+
types: [ opened, synchronize ]
11+
paths: ['**.c', '**.cpp', '**.h', '**.hpp', '**CMakeLists.txt', '**.cmake', '.clang-tidy', '.github/workflows/clang-tidy-check.yml']
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
tidy-check:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
26+
- name: Install dependencies
27+
run: |
28+
sudo apt-get update -y
29+
sudo apt-get install -y cmake zlib1g-dev libbz2-dev
30+
31+
- name: CMake Configure
32+
run: cmake -S . -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
33+
34+
- name: clang-tidy Check
35+
uses: cpp-linter/cpp-linter-action@v2
36+
id: linter
37+
with:
38+
database: build
39+
style: ''
40+
tidy-checks: ''
41+
42+
- name: Fail on clang-tidy warnings
43+
if: steps.linter.outputs.checks-failed > 0
44+
run: exit 1

.gitignore

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
build/
33
cmake-build-*/
44
out/
5+
.cache/
56

67
# IDE / editor files
78
.idea/
@@ -20,6 +21,8 @@ out/
2021
*.dll
2122
*.lib
2223
*.exe
24+
*.mpq
25+
*.sv
2326

2427
# CMake generated
2528
CMakeCache.txt
@@ -32,7 +35,13 @@ CTestTestfile.cmake
3235

3336
# Test artifacts
3437
/tmp/mpqfs_test_*.mpq
38+
/test_mpqfs
39+
40+
# Manual-run output
41+
*.pcx
42+
*_log.txt
43+
*_listfile.txt
3544

3645
# Package files
3746
*.tar.gz
38-
*.zip
47+
*.zip

0 commit comments

Comments
 (0)