FPP Formatting - #5630
FPP Formatting#5630Kronos3 wants to merge 9 commits into
Conversation
Coverage report — base
|
| Module | Line | Δ | Function | Δ | Branch | Δ |
|---|---|---|---|---|---|---|
Drv/Udp |
72.92 | -2.08 | 90.91 | +0.00 | 57.14 | -9.53 |
Modules changed
| Module | Line | Δ | Function | Δ | Branch | Δ |
|---|---|---|---|---|---|---|
Drv/Udp |
72.92 | -2.08 | 90.91 | +0.00 | 57.14 | -9.53 |
Os/Generic/Types |
92.14 | -0.36 | 92.86 | +0.00 | 73.83 | -1.87 |
Fw/DataStructures |
97.87 | -0.17 | 97.14 | +0.00 | 82.48 | -0.37 |
Os/Generic |
90.34 | +0.20 | 89.13 | +0.00 | 75.86 | +1.53 |
New modules
| Module | Line | Function | Branch |
|---|---|---|---|
Fw/Prm |
0.00 | 0.00 | 0.00 |
Modules without UTs
CFDP/Checksum/GTest, Drv/LinuxGpioDriver, Drv/LinuxI2cDriver, Drv/LinuxSpiDriver, Drv/LinuxUartDriver, Drv/Ports/DataTypes, FppTestProject/FppTest/topology/async, FppTestProject/FppTest/topology/components/Comp, FppTestProject/FppTest/topology/components/Framework, FppTestProject/FppTest/topology/components/Receiver, FppTestProject/FppTest/topology/components/Sender, FppTestProject/FppTest/topology/guarded, FppTestProject/FppTest/topology/sync, FppTestProject/FppTest/topology/top_ports, FppTestProject/FppTest/topology/types, Fw/Com, Fw/Comp, Fw/FilePacket/GTest, Fw/Fpy, Fw/Obj, Fw/Port, Fw/Sm, Fw/Test, Fw/Types/GTest, Os/Models, Svc/Ccsds/Types, Svc/FatalHandler, Svc/Subtopologies/CdhCore, Svc/Subtopologies/ComCcsds, Svc/Subtopologies/ComCcsdsSdls, Svc/Subtopologies/ComFprime, Svc/Subtopologies/ComLoggerTee, Svc/Subtopologies/DataProducts, Svc/Subtopologies/DpCompression, Svc/Subtopologies/FileHandling, Svc/Subtopologies/FileHandlingCfdp, Svc/Subtopologies/FileHandlingCfdp/FileHandlingCfdpConfig, TestDeploymentsProject/Ref/DpDemo, TestDeploymentsProject/Ref/PingReceiver, TestDeploymentsProject/Ref/RecvBuffApp, TestDeploymentsProject/Ref/SendBuffApp, TestDeploymentsProject/Ref/Top, TestDeploymentsProject/Ref/TypeDemo, cmake/test/data/TestConfigDeployment, cmake/test/data/TestDeployment/TestBuildAutocoder, cmake/test/data/TestDeployment/TestHeaderAutocoder, cmake/test/data/TestDeployment/TestLinkDepends, cmake/test/data/TestDeployment/TestRelative, cmake/test/data/test-fprime-library/TestLibrary/TestComponent, cmake/test/data/test-fprime-library2/TestLibrary2/TestComponent
# Conflicts: # FppTestProject/FppTest/topology/async/async.fpp # FppTestProject/FppTest/topology/guarded/guarded.fpp # FppTestProject/FppTest/topology/special_ports/topology.fpp # FppTestProject/FppTest/topology/sync/sync.fpp # Os/Models/Task.fpp # Svc/Ccsds/CfdpManager/Events.fppi # Svc/Ccsds/SpacePacketFramer/SpacePacketFramer.fpp # Svc/DpCompressProc/DpCompressProc.fpp # Svc/FileDispatcher/FileDispatcher.fpp # Svc/FileManager/Commands.fppi # Svc/FileManager/Events.fppi # Svc/FileManager/FileManager.fpp # Svc/FprimeFramer/FprimeFramer.fpp # Svc/Subtopologies/CdhCore/CdhCore.fpp # Svc/Subtopologies/CdhCore/CdhCoreConfig/CdhCoreConfig.fpp # Svc/Subtopologies/CdhCore/CdhCoreConfig/CdhCoreTlmConfig.fpp # Svc/Subtopologies/ComCcsds/ComCcsds.fpp # Svc/Subtopologies/ComCcsds/ComCcsdsConfig/ComCcsdsConfig.fpp # Svc/Subtopologies/ComFprime/ComFprime.fpp # Svc/Subtopologies/ComFprime/ComFprimeConfig/ComFprimeConfig.fpp # Svc/Subtopologies/ComLoggerTee/ComLoggerTeeConfig/ComLoggerTeeConfig.fpp # Svc/Subtopologies/ComLoggerTee/subtopology-template.fppi # Svc/Subtopologies/DataProducts/DataProducts.fpp # Svc/Subtopologies/DataProducts/DataProductsConfig/DataProductsConfig.fpp # Svc/Subtopologies/FileHandling/FileHandling.fpp # Svc/Subtopologies/FileHandling/FileHandlingConfig/FileHandlingConfig.fpp # Svc/Subtopologies/FileHandlingCfdp/FileHandlingCfdp.fpp # Svc/Subtopologies/FileHandlingCfdp/FileHandlingCfdpConfig/FileHandlingCfdpConfig.fpp # Svc/TlmChan/TlmChan.fpp # Svc/TlmPacketizer/TlmPacketizer.fpp # TestDeploymentsProject/Ref/Top/topology.fpp # default/config/ComCfg.fpp # requirements.txt
Change Description
This PR integrates a new
fpp-formattool /fprime-util formatFPP formatting. The formatting tool is a concrete-syntax-tree (CST) based formater meaning it does not remove information like comments or "intentional" newlines. While the formatter is a novel strategy, it is heavily reliant on the Red/Green tree parsing strategy employed by rust-analyzer. Read more about this here.The formatter tries to stay true to the stylistic choices of
.fppfiles across our F Prime projects:\continuation and multi-line lists@<post annotations on consecutive lines (two spaces before)=on consecutive lines (in enums/constant defs)->on consecutive lines (in connection graphs){and before}if providedRationale
We have been relying on manual formatting of FPP files.
Testing/Review Recommendations
These rules are defined upfront but I may have missed/misrepresented some. It would be good to get input from our maintainers/community on desired canonical FPP formatting style.
Future Work
N/A
AI Usage (see policy)
Claude Opus 4.8 was used for hooking with the CI/updating some of our tools. The CST parser was written manually. Formatting rules were given to claude and it iterated on heuristics to match this style.