nasa / fprime

F´ - A flight software and embedded systems framework
https://fprime.jpl.nasa.gov
Apache License 2.0
10.09k stars 1.31k forks source link

Add CMake formatter #1826

Open ThibFrgsGmz opened 1 year ago

ThibFrgsGmz commented 1 year ago
F´ Version latest
Affected Component None

Feature Description

Add cmake-format to the project. See https://github.com/nasa/fprime/pull/1820 for more information.

Rationale

To homogenize all CMake files according to the policy dictated in a .cmake-format.yml file.

LeStarch commented 1 year ago

@thomas-bc what would your thoughts be at adding this to your fprime-util format command? In-fact we could extrapolate:

if file_extension in <C++ extensions>:
    clang-format
if file_extension == .cmake or file_name = "CMakeLists.txt":
    cmake-format
if file_extension in <Py extensions>
    black

Thoughts? We'd then have all our formatting in on place....

thomas-bc commented 1 year ago

Yes that would work nicely if we want to be using cmake-format! Although I will say, black ./ is really simple enough to use already - and we would need some refactor to include that in fprime-util format since it currently requires to be ran in F’ (or a deployment). Unless using the -d flag is good enough? But that’s just my 2 cents - I’m all for standardization.