Update Cppcheck to v2.11

This commit is contained in:
valeros
2023-07-17 14:12:52 +03:00
parent 0fe6bf262e
commit 5c9b373b65
3 changed files with 21 additions and 23 deletions

View File

@ -21,6 +21,7 @@ PlatformIO Core 6
* Resolved an issue that caused generated projects for `PlatformIO IDE for VSCode <https://docs.platformio.org/en/latest/integration/ide/vscode.html>`__ to break when the ``-iprefix`` compiler flag was used
* Resolved an issue encountered while utilizing the `pio pkg exec <https://docs.platformio.org/en/latest/core/userguide/pkg/cmd_exec.html>`__ command on the Windows platform to execute Python scripts from a package
* Implemented a crucial improvement to the `pio run <https://docs.platformio.org/en/latest/core/userguide/cmd_run.html>`__ command, guaranteeing that the ``monitor`` target is not executed if any of the preceding targets, such as ``upload``, encounter failures
* `Cppcheck <https://docs.platformio.org/en/latest/plus/check-tools/cppcheck.html>`__ v2.11 with new checks, CLI commands and various analysis improvements
6.1.9 (2023-07-06)
~~~~~~~~~~~~~~~~~~

View File

@ -46,7 +46,7 @@ __core_packages__ = {
"contrib-piohome": "~3.4.2",
"contrib-pioremote": "~1.0.0",
"tool-scons": "~4.40502.0",
"tool-cppcheck": "~1.270.0",
"tool-cppcheck": "~1.21100.0",
"tool-clangtidy": "~1.150005.0",
"tool-pvs-studio": "~7.18.0",
}

View File

@ -69,7 +69,7 @@ PVS_STUDIO_FREE_LICENSE_HEADER = """
EXPECTED_ERRORS = 5
EXPECTED_WARNINGS = 1
EXPECTED_STYLE = 2
EXPECTED_STYLE = 4
EXPECTED_DEFECTS = EXPECTED_ERRORS + EXPECTED_WARNINGS + EXPECTED_STYLE
@ -345,7 +345,10 @@ def test_check_individual_flags_passed(clirunner, validate_cliresult, tmpdir):
assert pvs_flags_found
def test_check_cppcheck_misra_addon(clirunner, validate_cliresult, check_dir):
def test_check_cppcheck_misra_addon(clirunner, validate_cliresult, tmpdir_factory):
check_dir = tmpdir_factory.mktemp("project")
check_dir.join("platformio.ini").write(DEFAULT_CONFIG)
check_dir.mkdir("src").join("main.c").write(TEST_CODE)
check_dir.join("misra.json").write(
"""
{
@ -508,16 +511,18 @@ TEST-TEST-TEST-TEST
assert verbose_result.exit_code != 0
assert "license information is incorrect" in verbose_result.output.lower()
def test_check_embedded_platform_all_tools(clirunner, validate_cliresult, tmpdir):
config = """
@pytest.mark.parametrize("framework", ["arduino", "stm32cube", "zephyr"])
@pytest.mark.parametrize("check_tool", ["cppcheck", "clangtidy", "pvs-studio"])
def test_check_embedded_platform_all_tools(
clirunner, validate_cliresult, tmpdir, framework, check_tool
):
config = f"""
[env:test]
platform = ststm32
board = nucleo_f401re
framework = %s
check_tool = %s
framework = {framework}
check_tool = {check_tool}
"""
# tmpdir.join("platformio.ini").write(config)
tmpdir.mkdir("src").join("main.c").write(
PVS_STUDIO_FREE_LICENSE_HEADER
+ """
@ -534,20 +539,12 @@ int main() {
"""
)
for framework in (
"arduino",
"stm32cube",
"zephyr",
):
for tool in ("cppcheck", "clangtidy", "pvs-studio"):
tmpdir.join("platformio.ini").write(config % (framework, tool))
result = clirunner.invoke(cmd_check, ["--project-dir", str(tmpdir)])
validate_cliresult(result)
defects = sum(count_defects(result.output))
assert defects > 0, "Failed %s with %s" % (
framework,
tool,
)
tmpdir.join("platformio.ini").write(config)
result = clirunner.invoke(cmd_check, ["--project-dir", str(tmpdir)])
validate_cliresult(result)
defects = sum(count_defects(result.output))
assert defects > 0, "Not defects were found!"
def test_check_skip_includes_from_packages(clirunner, validate_cliresult, tmpdir):