← index #10751PR #6079
Off-topic · high · value 2.064
QUERY · ISSUE

codeformat.py bug

openby mbedNoobNinjaopened 2023-02-14updated 2024-09-01
bug

Description:

When codeformat.py formats *.h or *.c files (#10595) , it reduces file content by deleting not only formating symbols and whitespaces but also the code being formated!

before_codeformat.txt
after_codeformat.txt

and while working on before_codeformat.h codformat.py gives the folowing error:

Parsing: ..\ports\renesas-ra\boards\VK_RA4W1\ra_cfg\fsp_cfg\bsp\bsp_cfg.h as language C
Traceback (most recent call last):
   File "D:\micropython\tools\codeformat.py", line 218, in <module>
     main()
   File "D:\micropython\tools\codeformat.py", line 205, in main
     fixup_c(file)
   File "D:\micropython\tools\codeformat.py", line 136, in fixup_c
     if dedent_stack[-1] >= 0:
        ~~~~~~~~~~~~^^^^
IndexError: list index out of range

Environment:

OS Win 10 (22H2)
Uncrustify 0.72.0_f
Python 3.11.1
Package Version
black 22.12.0
click 8.1.3
colorama 0.4.6
mypy-extensions 0.4.3
pathspec 0.11.0
pip 23.0
platformdirs 2.6.2
pyserial 3.5
setuptools 65.5.0
CANDIDATE · PULL REQUEST

tools/codeformat: use -q option on uncrustify

closedby dlechopened 2020-05-26updated 2020-05-28
tools

This suppresses the Parsing: <file> as language C lines when running uncrustify. This makes codeformat.py run a bit faster and on CI it makes for less scrolling through logs. (And black already uses the -q option too.)

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied