From b482fa02df6ff0338b4437c25e128aeece0c4f1e Mon Sep 17 00:00:00 2001 From: Tyler Veness Date: Thu, 27 Nov 2025 17:30:06 -0800 Subject: [PATCH] Shorten wpiformat config (#8427) --- .clang-format | 2 +- .github/workflows/lint-format.yml | 4 +- .wpiformat | 78 +++---------------- .../src/main/native/include/DataLogManager.h | 18 ++--- wpimath/src/test/native/cpp/UnitsTest.cpp | 5 +- wpinet/src/main/native/linux/AvahiClient.cpp | 5 +- wpiutil/src/main/native/cpp/fs.cpp | 5 +- .../src/main/native/include/wpi/util/fs.hpp | 1 - 8 files changed, 30 insertions(+), 88 deletions(-) diff --git a/.clang-format b/.clang-format index 140923ec0d..e449561dce 100644 --- a/.clang-format +++ b/.clang-format @@ -134,7 +134,7 @@ IncludeCategories: Priority: 1 SortPriority: 4 # Windows system headers - - Regex: '^<(dbghelp\.h|dbt\.h|delayimp\.h|dshow\.h|io\.h|iphlpapi\.h|ks\.h|ksmedia\.h|memoryapi\.h|mfapi\.h|mferror\.h|mfidl\.h|mfreadwrite\.h|netioapi\.h|shellapi\.h|shlwapi\.h|sysinfoapi\.h|windns\.h|windowsx\.h|ws2tcpip\.h)>' + - Regex: '^<(dbghelp\.h|dbt\.h|delayimp\.h|dshow\.h|io\.h|iphlpapi\.h|ks\.h|ksmedia\.h|memoryapi\.h|mfapi\.h|mferror\.h|mfidl\.h|mfreadwrite\.h|netioapi\.h|ntstatus\.h|shellapi\.h|shlobj\.h|shlwapi\.h|sysinfoapi\.h|windns\.h|windowsx\.h|winternl\.h|ws2tcpip\.h)>' Priority: 1 SortPriority: 5 # C++ standard library headers (lowercase and underscores with no .h suffix) diff --git a/.github/workflows/lint-format.yml b/.github/workflows/lint-format.yml index 0df4bf356c..810693c67b 100644 --- a/.github/workflows/lint-format.yml +++ b/.github/workflows/lint-format.yml @@ -36,7 +36,7 @@ jobs: - name: Install wpiformat run: | python -m venv ${{ runner.temp }}/wpiformat - ${{ runner.temp }}/wpiformat/bin/pip3 install wpiformat==2025.77 + ${{ runner.temp }}/wpiformat/bin/pip3 install wpiformat==2025.78 - name: Run run: ${{ runner.temp }}/wpiformat/bin/wpiformat -default-branch 2027 - name: Check output @@ -78,7 +78,7 @@ jobs: - name: Install wpiformat run: | python -m venv ${{ runner.temp }}/wpiformat - ${{ runner.temp }}/wpiformat/bin/pip3 install wpiformat==2025.77 + ${{ runner.temp }}/wpiformat/bin/pip3 install wpiformat==2025.78 - name: Create compile_commands.json run: | ./gradlew generateCompileCommands -Ptoolchain-optional-roboRio diff --git a/.wpiformat b/.wpiformat index b62ab07ab4..246c0d3181 100644 --- a/.wpiformat +++ b/.wpiformat @@ -9,95 +9,37 @@ cppHeaderFileInclude { } generatedFileExclude { - \.jinja$ - apriltag/src/test/resources/ + assets/ docs/theme\.css$ - fields/src/main/native/resources/ generated/ - glass/src/app/native/mac/glass\.icns$ - glass/src/app/native/resources/ - glass/src/app/native/win/glass\.ico$ - hal/src/main/native/athena/ctre/ - hal/src/main/native/athena/frccansae/ - hal/src/main/native/athena/rev/ - hal/src/main/native/athena/visa/ - hal/src/main/native/include/ctre/ - hal/src/main/native/include/wpi/hal/UsageReporting\.h$ - hal/src/main/native/systemcore/ctre/ hal/src/main/native/systemcore/rev/ - ntcore/doc/ - tools/datalogtool/src/main/native/mac/datalogtool\.icns$ - tools/datalogtool/src/main/native/resources/ - tools/datalogtool/src/main/native/win/datalogtool\.ico$ - tools/outlineviewer/src/main/native/mac/ov\.icns$ - tools/outlineviewer/src/main/native/resources/ - tools/outlineviewer/src/main/native/win/outlineviewer\.ico$ - tools/sysid/src/main/native/mac/sysid\.icns$ - tools/sysid/src/main/native/resources/ - tools/sysid/src/main/native/win/sysid\.ico$ - tools/wpical/src/main/native/assets/ - tools/wpical/src/main/native/mac/wpical\.icns$ - tools/wpical/src/main/native/resources/ - tools/wpical/src/main/native/thirdparty/ - tools/wpical/src/main/native/win/wpical\.ico$ + python/ + resources/ + thirdparty/ wpigui/src/main/native/cpp/portable-file-dialogs\.cpp$ wpigui/src/main/native/include/wpi/gui/portable-file-dialogs\.h$ wpimath/src/main/native/include/wpi/units/base\.hpp$ - wpimath/src/main/native/include/wpi/units/units\.hpp$ - wpimath/src/main/native/thirdparty/ - wpimath/src/test/native/cpp/UnitsTest\.cpp$ wpinet/src/main/native/cpp/http_parser\.cpp$ wpinet/src/main/native/include/wpi/net/http_parser\.hpp$ - wpinet/src/main/native/linux/AvahiClient\.cpp$ - wpinet/src/main/native/linux/AvahiClient\.hpp$ - wpinet/src/main/native/resources/ - wpinet/src/main/native/thirdparty/ - wpiutil/src/main/native/cpp/fs\.cpp$ wpiutil/src/main/native/include/wpi/util/FastQueue\.hpp$ - wpiutil/src/main/native/include/wpi/util/fs\.hpp$ - wpiutil/src/main/native/resources/ - wpiutil/src/main/native/thirdparty/ wpiutil/src/test/native/cpp/json/ wpiutil/src/test/native/cpp/llvm/ wpiutil/src/test/native/cpp/span/ - - apriltag/src/main/python/ - apriltag/src/test/python/ - commandsv2/src/main/python/ - commandsv2/src/test/python/ - datalog/src/main/python/ - datalog/src/test/python/ - hal/src/main/python/ - hal/src/test/python/ - ntcore/src/main/python/ - ntcore/src/test/python/ - romiVendordep/src/main/python/ - romiVendordep/src/test/python/ - wpilibc/src/main/python/ - wpilibc/src/test/python/ - wpimath/src/main/python/ - wpimath/src/test/python/ - wpinet/src/main/python/ - wpinet/src/test/python/ - wpiutil/src/main/python/ - wpiutil/src/test/python/ - xrpVendordep/src/main/python/ - xrpVendordep/src/test/python/ } modifiableFileExclude { - BUILD.bazel - \.patch$ - datalog/examples/printlog/datalog\.py$ + \.icns$ + \.ico$ + \.jinja$ gradlew - ntcoreffi/src/main/native/include/DataLogManager\.h$ objcpp/ - thirdparty/ + wpimath/src/test/native/cpp/UnitsTest\.cpp$ + wpiutil/src/main/native/cpp/fs\.cpp$ + wpiutil/src/main/native/include/wpi/util/fs\.hpp$ } licenseUpdateExclude { cscore/src/main/native/cpp/default_init_allocator\.hpp$ - datalog/examples/printlog wpiutil/src/main/native/cpp/Base64\.cpp$ wpiutil/src/main/native/cpp/sha1\.cpp$ wpiutil/src/main/native/include/wpi/util/sha1\.hpp$ diff --git a/ntcoreffi/src/main/native/include/DataLogManager.h b/ntcoreffi/src/main/native/include/DataLogManager.h index de6b8c70fd..41b415fe98 100644 --- a/ntcoreffi/src/main/native/include/DataLogManager.h +++ b/ntcoreffi/src/main/native/include/DataLogManager.h @@ -29,9 +29,9 @@ namespace wpi { * connected and provides a match number, the log file is renamed to * "WPILIB_yyyyMMdd_HHmmss_{event}_{match}.wpilog". * - * On startup, all existing WPILIB_TBD log files are deleted. If there is less than - * 50 MB of free space on the target storage, WPILIB_ log files are deleted (oldest - * to newest) until there is 50 MB free OR there are 10 files remaining. + * On startup, all existing WPILIB_TBD log files are deleted. If there is less + * than 50 MB of free space on the target storage, WPILIB_ log files are deleted + * (oldest to newest) until there is 50 MB free OR there are 10 files remaining. * * By default, all NetworkTables value changes are stored to the data log. */ @@ -118,7 +118,8 @@ struct WPI_DataLog; * @param period time between automatic flushes to disk, in seconds; * this is a time/storage tradeoff */ -void DLM_Start(const struct WPI_String* dir, const struct WPI_String* filename, double period); +void DLM_Start(const struct WPI_String* dir, const struct WPI_String* filename, + double period); /** * Stop data log manager. @@ -157,11 +158,10 @@ void DLM_GetLogDir(struct WPI_String* value); */ void DLM_LogNetworkTables(int enabled); - - /** - * Enable or disable logging of the console output. Defaults to enabled. - * @param enabled true to enable, false to disable - */ +/** + * Enable or disable logging of the console output. Defaults to enabled. + * @param enabled true to enable, false to disable + */ void DLM_LogConsoleOutput(int enabled); /** diff --git a/wpimath/src/test/native/cpp/UnitsTest.cpp b/wpimath/src/test/native/cpp/UnitsTest.cpp index bf27ea49c0..c9ce001d62 100644 --- a/wpimath/src/test/native/cpp/UnitsTest.cpp +++ b/wpimath/src/test/native/cpp/UnitsTest.cpp @@ -4,11 +4,13 @@ #include #include +#ifdef UNIT_LIB_ENABLE_IOSTREAM +#include +#endif #include #include #include -#include "wpi/util/print.hpp" #include "wpi/units/acceleration.hpp" #include "wpi/units/angle.hpp" @@ -50,6 +52,7 @@ #include "wpi/units/velocity.hpp" #include "wpi/units/voltage.hpp" #include "wpi/units/volume.hpp" +#include "wpi/util/print.hpp" using namespace wpi::units::acceleration; using namespace wpi::units::angle; diff --git a/wpinet/src/main/native/linux/AvahiClient.cpp b/wpinet/src/main/native/linux/AvahiClient.cpp index 10c91200c9..7eee1c0020 100644 --- a/wpinet/src/main/native/linux/AvahiClient.cpp +++ b/wpinet/src/main/native/linux/AvahiClient.cpp @@ -4,11 +4,10 @@ #include "AvahiClient.hpp" -#include "wpi/util/mutex.hpp" - -#include +#include #include "dlfcn.h" +#include "wpi/util/mutex.hpp" using namespace wpi::net; diff --git a/wpiutil/src/main/native/cpp/fs.cpp b/wpiutil/src/main/native/cpp/fs.cpp index 03fbfdb641..4f6347299e 100644 --- a/wpiutil/src/main/native/cpp/fs.cpp +++ b/wpiutil/src/main/native/cpp/fs.cpp @@ -15,8 +15,8 @@ #ifdef _WIN32 #include -#include #include +#include // Require at least Windows 7 API. #define _WIN32_WINNT 0x0601 #define _WIN32_IE 0x0800 // MinGW at it again. FIXME: verify if still needed. @@ -28,11 +28,10 @@ #define WIN32_NO_STATUS #include #undef WIN32_NO_STATUS -#include #include - #include #include +#include #include "wpi/util/WindowsError.hpp" diff --git a/wpiutil/src/main/native/include/wpi/util/fs.hpp b/wpiutil/src/main/native/include/wpi/util/fs.hpp index 8211628836..b92d707890 100644 --- a/wpiutil/src/main/native/include/wpi/util/fs.hpp +++ b/wpiutil/src/main/native/include/wpi/util/fs.hpp @@ -15,7 +15,6 @@ #include #include -#include #include namespace fs {