Setting checker-config fails to parse output from clang-tidy

Chiusa
#4,613 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 8 giorni

@r3wretrhy ci sta già lavorando.

Dal 20/10/2026.

  • #5160 di @r3wretrhy — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
python
Ambito
cli, devtools

Direzione di ricerca

The traceback points to parse_checker_config_new in codechecker_analyzer/analyzers/clangtidy/analyzer.py, where yaml.safe_load receives the output of clang-tidy -dump-config. That output begins with a Resource filename: line before the --- document marker, which the YAML parser rejects. Start by reproducing the failure with the --checker-config example, or by running clang-tidy -dump-config -checks=* and loading the result with yaml.safe_load. Done means the config is parsed without error and the readability-function-cognitive-complexity:Threshold option validates. Check the open thread first, since the issue has had no activity for over a year.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

good to go :rocket:

Describe the bug
Can't set checker-config due to parse error of clang-tidy output.

Traceback (most recent call last):
  File "/lib/python3.10/site-packages/codechecker_common/cli.py", line 230, in main
    sys.exit(args.func(args))
  File "/lib/python3.10/site-packages/codechecker_analyzer/cli/analyze.py", line 1187, in main
    config_validator_res = [validate_func(getattr(args, conf))
  File "/lib/python3.10/site-packages/codechecker_analyzer/cli/analyze.py", line 1187, in <listcomp>
    config_validator_res = [validate_func(getattr(args, conf))
  File "/lib/python3.10/site-packages/codechecker_analyzer/cli/analyze.py", line 927, in is_checker_config_valid
    checker_configs = {
  File "/lib/python3.10/site-packages/codechecker_analyzer/cli/analyze.py", line 928, in <dictcomp>
    analyzer_name: analyzer_class.get_checker_config()
  File "/lib/python3.10/site-packages/codechecker_analyzer/analyzers/clangtidy/analyzer.py", line 361, in get_checker_config
    for cfg, doc in parse_checker_config(help_page):
  File "/lib/python3.10/site-packages/codechecker_analyzer/analyzers/clangtidy/analyzer.py", line 106, in parse_checker_config
    result = parse_checker_config_new(config_dump)
  File "/lib/python3.10/site-packages/codechecker_analyzer/analyzers/clangtidy/analyzer.py", line 88, in parse_checker_config_new
    data = yaml.safe_load(config_dump)
  File "/lib/python3.10/site-packages/yaml/__init__.py", line 125, in safe_load
    return load(stream, SafeLoader)
  File "/lib/python3.10/site-packages/yaml/__init__.py", line 81, in load
    return loader.get_single_data()
  File "/lib/python3.10/site-packages/yaml/constructor.py", line 49, in get_single_data
    node = self.get_single_node()
  File "/lib/python3.10/site-packages/yaml/composer.py", line 39, in get_single_node
    if not self.check_event(StreamEndEvent):
  File "/lib/python3.10/site-packages/yaml/parser.py", line 98, in check_event
    self.current_event = self.state()
  File "/lib/python3.10/site-packages/yaml/parser.py", line 171, in parse_document_start
    raise ParserError(None, None,
yaml.parser.ParserError: expected '<document start>', but found '<block mapping start>'
  in "<unicode string>", line 359, column 1:
    Resource filename: /home/rtljopl ... 
    ^

CodeChecker version

[INFO 2025-07-01 13:07] - CodeChecker analyzer version:
---------------------------------------------------------------
Kind                 | Version                                 
---------------------------------------------------------------
Base package version | 6.26.0                                  
Package build date   | 2025-06-09T23:41                        
Git commit ID (hash) | 0bbf351e870c7056cd9cc0dc44a795c0fe805dfa
Git tag information  | 6.26                                    
---------------------------------------------------------------

[INFO 2025-07-01 13:07] - CodeChecker web version:
------------------------------------------------------------------------------
Kind                                | Version                                 
------------------------------------------------------------------------------
Base package version                | 6.26.0                                  
Package build date                  | 2025-06-09T23:41                        
Git commit ID (hash)                | 0bbf351e870c7056cd9cc0dc44a795c0fe805dfa
Git tag information                 | 6.26                                    
Server supported Thrift API version | 6.65                                    
Client Thrift API version           | 6.65                                    
------------------------------------------------------------------------------

To Reproduce

CodeChecker analyze --analyzers clang-tidy --checker-config clang-tidy:readability-function-cognitive-complexity:Threshold=1 --output complexity -- compile_commands.json

Expected behaviour
What you expected to happen.

Desktop (please complete the following information)

  • OS: Linux
  • Browser: -

Additional context

clang-tidy -dump-config -checks=* 
Resource filename: /lib/python3.10/site-packages/clang_tidy/data/bin/clang-tidy 
---
Checks:          "clang-diagnostic-*,clang-analyzer-*,bugprone-*, misc-*, readability-*, -readability-identifier-length, -readability-uppercase-literal-suffix, clang-analyzer-*, -clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,\n,*"
WarningsAsErrors: 'false'
HeaderFilterRegex: ''
AnalyzeTemporaryDtors: false
FormatStyle:     none
User:            rtljopl
CheckOptions:
  performance-unnecessary-value-param.IncludeStyle: llvm
  readability-suspicious-call-argument.PrefixSimilarAbove: '30'
  cppcoreguidelines-no-malloc.Reallocations: '::realloc'
  llvmlibc-restrict-system-libc-headers.Includes: '-*'
Lingua principale
Python
Stelle
2.6k
Fork
494
Merge medio
6g 13h
PR unite (30g)
18

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Ericsson/codechecker

Tutte le issue di Ericsson/codechecker

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.