Exclude .pio directory from Check when MISRA addon enabled

Hi,
I want exclude .pio library from Cppcheck but neither check_patterns nor pio check --pattern works.
My Ploatformio.ini

[env:desktop]
platform = native
build_flags = -std=gnu++11 -Iinclude -Ilib -DDEBUG -DUNIT_TEST
test_build_project_src = yes
test_transport = custom
test_ignore = test_embedded
lib_deps =
fabiobatsilva/ArduinoFake@^0.2.2
noah1510/Native SPI@^0.1.0
check_tool = cppcheck
check_flags = --enable=all
cppcheck: --addon=misra.json
check_severity = medium, high
check_patterns = src/*.*

Can you give a minimal code examoke too that shows in which way exactly it’s not working?

Yes, instead of excluding .pio directory, it check the content of .pio directory.

.pio/libdeps/desktop/ArduinoFake/src/arduino/Stream.h:64: [medium:warning] Member variable ‘Stream::startMillis’ is not initialized in the constructor. [uninitMemberVar]
.pio/libdeps/desktop/ArduinoFake/src/arduino/USBAPI.h:89: [medium:warning] Member variable 'Serial
::rx_buffer_head’ is not initialized in the constructor. [uninitMemberVar]
.pio/libdeps/desktop/ArduinoFake/src/arduino/USBAPI.h:89: [medium:warning] Member variable 'Serial
::rx_buffer_tail’ is not initialized in the constructor. [uninitMemberVar]
.pio/libdeps/desktop/ArduinoFake/src/arduino/USBAPI.h:89: [medium:warning] Member variable 'Serial
::_rx_buffer’ is not initialized in the constructor. [uninitMemberVar]
.pio/libdeps/desktop/ArduinoFake/src/fakeit/fakeit.hpp:7533: [medium:warning] Class ‘Implementation’ does not have a copy constructor which is recommended since it has dynamic memory/resource allocation(s). [noCopyConstructor]
.pio/libdeps/desktop/ArduinoFake/src/fakeit/fakeit.hpp:7533: [medium:warning] Class ‘Implementation’ does not have a operator= which is recommended since it has dynamic memory/resource allocation(s). [noOperatorEq]
.pio/libdeps/desktop/ArduinoFake/src/fakeit/fakeit.hpp:8313: [medium:warning] Value of pointer ‘reference’, which points to allocated memory, is copied in copy constructor instead of allocating new memory. [copyCtorPointerCopying]

Error: Failed to execute check command! Exited with code -6.
Error: cppcheck failed to perform check! Please examine tool output in verbose mode.
========================================================================== [FAILED] Took 22.30 seconds ==========================================================================

Component HIGH MEDIUM LOW


.pio/libdeps/desktop/ArduinoFake/src/arduino 0 4 0
.pio/libdeps/desktop/ArduinoFake/src/fakeit 1 13 0

Total 1 17 0

Environment Tool Status Duration


embedded cppcheck IGNORED
desktop cppcheck FAILED 00:00:22.303
===================================================================== 1 failed, 0 succeeded in 00:00:22.303 =====================================================================
The terminal process “pio ‘check’, ‘–environment’, ‘desktop’” terminated with exit code: 1.

In platformio.ini I use

[env]
check_tool = cppcheck
check_flags = --enable=all
check_src_filters = 
    +<src/*>
    +<lib/*>
    -<lib/TFT_eSPI/*>
    -<.pio/*>
    +<test/test_*/*>

But still it’s doing cppcheck on all external libraries in .pio/libdeps
I don’t want it to run cppcheck on others people code but rather focus on my own code.

Example of output because I use ArduionoJson…

.pio\libdeps\MCU4M-LOCAL\ArduinoJson\src\ArduinoJson\Document\JsonDocument.hpp:312: [low:performance] Function parameter 'pool' should be passed by const reference. [passedByValue]
.pio\libdeps\MCU4M-LOCAL\ArduinoJson\src\ArduinoJson\Document\JsonDocument.hpp:322: [low:performance] Function parameter 'pool' should be passed by const reference. [passedByValue]
.pio\libdeps\MCU4M-LOCAL\ArduinoJson\src\ArduinoJson\Strings\Adapters\RamString.hpp:116: [low:style] Parameter 's' can be declared as const array [constParameter]
.pio\libdeps\MCU4M-LOCAL\ArduinoJson\src\ArduinoJson\Variant\VariantSlot.hpp:62: [low:style] Parameter 'slot' can be declared as pointer to const [constParameterPointer]
.pio\libdeps\MCU4M-LOCAL\ArduinoJson\src\ArduinoJson\Variant\VariantSlot.hpp:70: [low:style] Parameter 'slot' can be declared as pointer to const [constParameterPointer]
.pio\libdeps\MCU4M-LOCAL\ArduinoJson\src\ArduinoJson\Memory\MemoryPool.hpp:116: [low:style] Parameter 'p' can be declared as pointer to const [constParameterPointer]