platformio/platformio-core

pio check using clangtidy fails on large project

Open

#4,446 建立於 2022年10月31日

在 GitHub 查看
 (8 留言) (2 反應) (0 負責人)Python (791 fork)batch import
help wantedstatic analysis

倉庫指標

Star
 (7,329 star)
PR 合併指標
 (平均合併 109天 16小時) (30 天內合併 5 個 PR)

描述

What kind of issue is this?

  • PlatformIO Core. If you’ve found a bug, please provide an information below.

You can erase any parts of this template not applicable to your Issue.


Configuration

Operating system: Windows 11 21H2

PlatformIO Version (platformio --version): PlatformIO Core, version 6.1.5rc1 Tested on latest available version

Description of problem

When running pio check I get an exception:

Checking gpt_pcb > cppcheck (board: pico32; framework: arduino; platform: espressif32)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
No defects found
=========================================================================== [PASSED] Took 76.57 seconds ===========================================================================
Checking gpt_pcb > clangtidy (board: pico32; framework: arduino; platform: espressif32)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Tool Manager: Installing platformio/tool-clangtidy @ ~1.120001.0
Downloading  [####################################]  100%
Unpacking  [####################################]  100%
Tool Manager: tool-clangtidy@1.120001.0 has been installed!
Error: Traceback (most recent call last):
  File "C:\Users\GregRavikovich\.platformio\penv\lib\site-packages\platformio\__main__.py", line 102, in main
    cli()  # pylint: disable=no-value-for-parameter
  File "C:\Users\GregRavikovich\.platformio\penv\lib\site-packages\click\core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "C:\Users\GregRavikovich\.platformio\penv\lib\site-packages\click\core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "C:\Users\GregRavikovich\.platformio\penv\lib\site-packages\platformio\cli.py", line 71, in invoke
    return super().invoke(ctx)
  File "C:\Users\GregRavikovich\.platformio\penv\lib\site-packages\click\core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "C:\Users\GregRavikovich\.platformio\penv\lib\site-packages\click\core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Users\GregRavikovich\.platformio\penv\lib\site-packages\click\core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "C:\Users\GregRavikovich\.platformio\penv\lib\site-packages\platformio\check\cli.py", line 136, in cli
    rc = ct.check(
  File "C:\Users\GregRavikovich\.platformio\penv\lib\site-packages\platformio\check\tools\base.py", line 236, in check
    self.execute_check_cmd(cmd)
  File "C:\Users\GregRavikovich\.platformio\penv\lib\site-packages\platformio\check\tools\base.py", line 185, in execute_check_cmd
    result = proc.exec_command(
  File "C:\Users\GregRavikovich\.platformio\penv\lib\site-packages\platformio\proc.py", line 114, in exec_command
    with subprocess.Popen(*args, **kwargs) as p:
  File "C:\Users\GregRavikovich\.platformio\python3\lib\subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\GregRavikovich\.platformio\python3\lib\subprocess.py", line 1420, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 206] The filename or extension is too long

============================================================

An unexpected error occurred. Further steps:

* Verify that you have the latest version of PlatformIO using
  `pip install -U platformio` command

* Try to find answer in FAQ Troubleshooting section
  https://docs.platformio.org/page/faq/index.html

* Report this problem to the developers
  https://github.com/platformio/platformio-core/issues

============================================================

This started to happen after the project has grown enough.

I do have long path enabled, see the discussion under https://community.platformio.org/t/filename-too-long-when-running-check/28986

Steps to Reproduce

  1. Create a large project (unfortunately can't submit it, proprietary)
  2. Setup check using clangtidy
  3. run pio check

Actual Results

The error above

Expected Results

Check results available.

If problems with PlatformIO Build System:

The content of platformio.ini:

; PlatformIO Project Configuration File
;
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[env]
build_flags = 
	!python ./git_rev_macro/git_rev_macro.py
	-std=gnu++17
build_unflags =
    -std=gnu++11
board = pico32
framework = arduino
platform = espressif32@5.1.1
monitor_speed = 115200
build_type = release
check_tool = cppcheck, clangtidy
check_skip_packages = yes
check_patterns = lib/sgtcm_lib/*
check_flags = 
	cppcheck: --suppress=*:*.pio\* --suppress=noExplicitConstructor --suppress=unusedFunction --suppress=*:*lib\sgtcm_lib\src\SolarPosition.cpp
	clangtidy: --checks=clang-analyzer-*,readability-*,performance-*,hicpp-*,bugprone-*,modernize-*,-modernize-use-trailing-return-type --suppress=readability-qualified-auto
monitor_filters = esp32_exception_decoder
lib_ldf_mode = deep
custom_nanopb_protos = 
	+<../../shared_models/tracker_models.proto>
custom_nanopb_options =
    --error-on-unmatched --cpp-descriptors
lib_deps =
	rlogiacco/CircularBuffer@^1.3.3
	lasselukkari/aWOT@^3.4.0
	paulstoffregen/Time@^1.6.1
	hideakitai/ArduinoEigen@^0.2.3
	nanopb/Nanopb@0.4.6+3


[env:gpt_pcb]
build_flags = ${env.build_flags} -D GRID_POWER_TRACKER
debug_tool = esp-prog
debug_init_break = tbreak setup

lib_deps =
	${env.lib_deps}
	sparkfun/SparkFun L6470 AutoDriver@^1.3.3


[env:spt_pcb]
build_flags = ${env.build_flags} -D SELF_POWER_TRACKER

debug_init_break = tbreak setup
debug_tool = esp-prog

lib_deps =
	${env.lib_deps}
    teemuatlut/TMC2130Stepper@^2.5.1
    gin66/FastAccelStepper@^0.27.5
    felias-fogg/SlowSoftI2CMaster@^1.0.0

Note that removing all flags from clangtidy doesn't change the error

Source file to reproduce issue:

Sorry, can't provide full source

Additional info

貢獻者指南