Skip to content

Commit b54f50d

Browse files
authored
Merge pull request #11 from urboob21/dev_branch
update: Enable cppcheck inline suspressions
2 parents 9f9ae85 + 6e83800 commit b54f50d

3 files changed

Lines changed: 10 additions & 2 deletions

File tree

.github/workflows/cpp-build-test-coverage.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,15 @@ jobs:
4646
# Step 2: Run Cppcheck (Static Analysis)
4747
# - Scans for common C++ issues (style, memory, logic)
4848
# - You can adjust `--enable=` options as needed
49+
# - https://cppcheck.sourceforge.io/manual.pdf
4950
# -------------------------------------------------------
5051
- name: Run static analysis with Cppcheck
5152
run: |
5253
echo "Running Cppcheck..."
5354
cppcheck --enable=warning,style,performance,portability \
5455
--inconclusive \
5556
--quiet \
57+
--inline-suppr \
5658
--error-exitcode=1 \
5759
./src ./include
5860

src/core/datatypes/class/RoleOfThreeFiveZero.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// cppcheck-suppress-file [noCopyConstructor, noOperatorEq, accessMoved]
2+
13
#include <cstring>
24
#include <iostream>
35
#include <utility>

src/core/datatypes/class/SallowDeepCopying.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// cppcheck-suppress-file [noCopyConstructor, noOperatorEq, unsafeClassCanLeak]
2+
13
#include <iostream>
24

35
namespace
@@ -35,12 +37,13 @@ namespace
3537
}
3638
}
3739

38-
int getPtr()
40+
int getPtr() const
3941
{
4042
if (ptr != nullptr)
4143
{
4244
return *ptr;
4345
}
46+
return 0;
4447
}
4548

4649
// Implicit copy constructor: Model a{b};
@@ -149,12 +152,13 @@ namespace
149152
}
150153
}
151154

152-
int getPtr()
155+
int getPtr() const
153156
{
154157
if (ptr != nullptr)
155158
{
156159
return *ptr;
157160
}
161+
return 0;
158162
}
159163
};
160164

0 commit comments

Comments
 (0)