fix(CI): cppcheck failure step (#17240)

* feat: add cppcheck for scripts

* fix: cppcheck step failure

* trigger cppcheck build, it should fail

* fix: cppcheck should succeed

* fix: cppcheck
This commit is contained in:
Stefano Borzì 2023-09-21 12:43:57 +02:00 committed by GitHub
parent b1c92f498a
commit 168192b731
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 9 deletions

View File

@ -26,12 +26,9 @@ jobs:
run: | run: |
sudo apt update -y sudo apt update -y
sudo apt install -y cppcheck sudo apt install -y cppcheck
cppcheck --force --inline-suppr \ cppcheck --force --inline-suppr --suppressions-list=./.suppress.cppcheck src/ --output-file=report.txt
-i src/server/game/Achievements/AchievementMgr.cpp \
-i src/server/game/AuctionHouse/AuctionHouseMgr.cpp \ if [ -s report.txt ]; then # if file is not empty
-i src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp \ cat report.txt
-i src/server/game/DungeonFinding/LFGMgr.cpp \ exit 1 # let github action fails
-i src/server/game/Entities/GameObject/GameObject.cpp \ fi
-i src/server/game/Entities/Pet/Pet.cpp \
-i src/server/game/Entities/Player/Player.cpp \
src/

1
.suppress.cppcheck Normal file
View File

@ -0,0 +1 @@
cppcheckError

View File

@ -45,6 +45,7 @@ enum AuthStatus
STATUS_CLOSED STATUS_CLOSED
}; };
// cppcheck-suppress ctuOneDefinitionRuleViolation
struct AccountInfo struct AccountInfo
{ {
void LoadResult(Field* fields); void LoadResult(Field* fields);

View File

@ -57,6 +57,7 @@ namespace WorldPackets
class AC_GAME_API PlayMusic final : public ServerPacket class AC_GAME_API PlayMusic final : public ServerPacket
{ {
public: public:
// cppcheck-suppress missingReturn
PlayMusic() : ServerPacket(SMSG_PLAY_MUSIC, 4) { } PlayMusic() : ServerPacket(SMSG_PLAY_MUSIC, 4) { }
PlayMusic(uint32 soundKitID) : ServerPacket(SMSG_PLAY_MUSIC, 4), SoundKitID(soundKitID) { } PlayMusic(uint32 soundKitID) : ServerPacket(SMSG_PLAY_MUSIC, 4), SoundKitID(soundKitID) { }
@ -68,6 +69,7 @@ namespace WorldPackets
class AC_GAME_API PlayObjectSound final : public ServerPacket class AC_GAME_API PlayObjectSound final : public ServerPacket
{ {
public: public:
// cppcheck-suppress missingReturn
PlayObjectSound() : ServerPacket(SMSG_PLAY_OBJECT_SOUND, 4 + 8) { } PlayObjectSound() : ServerPacket(SMSG_PLAY_OBJECT_SOUND, 4 + 8) { }
PlayObjectSound(ObjectGuid const& sourceObjectGUID, uint32 soundKitID) PlayObjectSound(ObjectGuid const& sourceObjectGUID, uint32 soundKitID)
: ServerPacket(SMSG_PLAY_OBJECT_SOUND, 4 + 8), SourceObjectGUID(sourceObjectGUID), SoundKitID(soundKitID) { } : ServerPacket(SMSG_PLAY_OBJECT_SOUND, 4 + 8), SourceObjectGUID(sourceObjectGUID), SoundKitID(soundKitID) { }
@ -82,6 +84,7 @@ namespace WorldPackets
class AC_GAME_API Playsound final : public ServerPacket class AC_GAME_API Playsound final : public ServerPacket
{ {
public: public:
// cppcheck-suppress missingReturn
Playsound() : ServerPacket(SMSG_PLAY_SOUND, 4) { } Playsound() : ServerPacket(SMSG_PLAY_SOUND, 4) { }
Playsound(uint32 soundKitID) : ServerPacket(SMSG_PLAY_SOUND, 4), SoundKitID(soundKitID) { } Playsound(uint32 soundKitID) : ServerPacket(SMSG_PLAY_SOUND, 4), SoundKitID(soundKitID) { }