Upgrade wpiformat and use clang-format's include sorting (#8350)

This PR also uses the newly added -default-branch flag to generate the list of changed files with respect to the correct branch (2027).
This commit is contained in:
Tyler Veness
2025-11-11 18:05:12 -08:00
committed by GitHub
parent a0f4727179
commit 1705b2d61c
321 changed files with 677 additions and 628 deletions

View File

@@ -2,6 +2,8 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/util/Alert.hpp"
#include <algorithm>
#include <chrono>
#include <map>
@@ -16,7 +18,6 @@
#include "wpi/nt/StringArrayTopic.hpp"
#include "wpi/simulation/SimHooks.hpp"
#include "wpi/smartdashboard/SmartDashboard.hpp"
#include "wpi/util/Alert.hpp"
using namespace wpi;
using enum Alert::AlertType;

View File

@@ -2,10 +2,11 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/hardware/rotation/AnalogPotentiometer.hpp"
#include <gtest/gtest.h>
#include "wpi/hal/HAL.h"
#include "wpi/hardware/rotation/AnalogPotentiometer.hpp"
#include "wpi/simulation/AnalogInputSim.hpp"
#include "wpi/simulation/RoboRioSim.hpp"

View File

@@ -2,12 +2,13 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/driverstation/DriverStation.hpp"
#include <string>
#include <tuple>
#include <gtest/gtest.h>
#include "wpi/driverstation/DriverStation.hpp"
#include "wpi/driverstation/Joystick.hpp"
#include "wpi/simulation/DriverStationSim.hpp"
#include "wpi/simulation/SimHooks.hpp"

View File

@@ -2,9 +2,10 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/driverstation/GenericHID.hpp"
#include <gtest/gtest.h>
#include "wpi/driverstation/GenericHID.hpp"
#include "wpi/simulation/GenericHIDSim.hpp"
using namespace wpi;

View File

@@ -2,7 +2,7 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/driverstation/Joystick.hpp" // NOLINT(build/include_order)
#include "wpi/driverstation/Joystick.hpp"
#include <gtest/gtest.h>

View File

@@ -2,9 +2,10 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/hardware/led/LEDPattern.hpp"
#include <gtest/gtest.h>
#include "wpi/hardware/led/LEDPattern.hpp"
#include "wpi/math/util/MathUtil.hpp"
#include "wpi/util/MathExtras.hpp"
#include "wpi/util/timestamp.h"

View File

@@ -2,12 +2,13 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/system/Notifier.hpp"
#include <atomic>
#include <gtest/gtest.h>
#include "wpi/simulation/SimHooks.hpp"
#include "wpi/system/Notifier.hpp"
using namespace wpi;

View File

@@ -2,7 +2,7 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/driverstation/PS4Controller.hpp" // NOLINT(build/include_order)
#include "wpi/driverstation/PS4Controller.hpp"
#include <gtest/gtest.h>

View File

@@ -2,7 +2,7 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/driverstation/PS5Controller.hpp" // NOLINT(build/include_order)
#include "wpi/driverstation/PS5Controller.hpp"
#include <gtest/gtest.h>

View File

@@ -2,12 +2,13 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/system/ScopedTracer.hpp"
#include <string_view>
#include <gtest/gtest.h>
#include "wpi/simulation/SimHooks.hpp"
#include "wpi/system/ScopedTracer.hpp"
#include "wpi/util/SmallString.hpp"
#include "wpi/util/StringExtras.hpp"
#include "wpi/util/raw_ostream.hpp"

View File

@@ -2,9 +2,10 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/hardware/range/SharpIR.hpp"
#include <gtest/gtest.h>
#include "wpi/hardware/range/SharpIR.hpp"
#include "wpi/simulation/SharpIRSim.hpp"
using namespace wpi;

View File

@@ -2,7 +2,7 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/framework/TimedRobot.hpp" // NOLINT(build/include_order)
#include "wpi/framework/TimedRobot.hpp"
#include <stdint.h>

View File

@@ -2,7 +2,7 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/system/Timer.hpp" // NOLINT(build/include_order)
#include "wpi/system/Timer.hpp"
#include <gtest/gtest.h>

View File

@@ -2,7 +2,7 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/framework/TimesliceRobot.hpp" // NOLINT(build/include_order)
#include "wpi/framework/TimesliceRobot.hpp"
#include <stdint.h>

View File

@@ -2,7 +2,7 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/system/Watchdog.hpp" // NOLINT(build/include_order)
#include "wpi/system/Watchdog.hpp"
#include <stdint.h>

View File

@@ -2,7 +2,7 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/driverstation/XboxController.hpp" // NOLINT(build/include_order)
#include "wpi/driverstation/XboxController.hpp"
#include <gtest/gtest.h>

View File

@@ -2,10 +2,11 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/drive/DifferentialDrive.hpp"
#include <gtest/gtest.h>
#include "motorcontrol/MockPWMMotorController.hpp"
#include "wpi/drive/DifferentialDrive.hpp"
TEST(DifferentialDriveTest, ArcadeDriveIK) {
// Forward

View File

@@ -2,10 +2,11 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/drive/MecanumDrive.hpp"
#include <gtest/gtest.h>
#include "motorcontrol/MockPWMMotorController.hpp"
#include "wpi/drive/MecanumDrive.hpp"
TEST(MecanumDriveTest, CartesianIK) {
// Forward

View File

@@ -2,11 +2,12 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/event/BooleanEvent.hpp"
#include <atomic>
#include <gtest/gtest.h>
#include "wpi/event/BooleanEvent.hpp"
#include "wpi/event/EventLoop.hpp"
using namespace wpi;

View File

@@ -2,9 +2,10 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/event/EventLoop.hpp"
#include <gtest/gtest.h>
#include "wpi/event/EventLoop.hpp"
#include "wpi/system/Errors.hpp"
using namespace wpi;

View File

@@ -2,10 +2,11 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/event/NetworkBooleanEvent.hpp"
#include <gtest/gtest.h>
#include "wpi/event/EventLoop.hpp"
#include "wpi/event/NetworkBooleanEvent.hpp"
#include "wpi/nt/BooleanTopic.hpp"
#include "wpi/nt/NetworkTableInstance.hpp"

View File

@@ -2,7 +2,7 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/simulation/AddressableLEDSim.hpp" // NOLINT(build/include_order)
#include "wpi/simulation/AddressableLEDSim.hpp"
#include <array>

View File

@@ -2,6 +2,8 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/simulation/AnalogEncoderSim.hpp"
#include <numbers>
#include <gtest/gtest.h>
@@ -9,7 +11,6 @@
#include "wpi/hal/HAL.h"
#include "wpi/hardware/discrete/AnalogInput.hpp"
#include "wpi/hardware/rotation/AnalogEncoder.hpp"
#include "wpi/simulation/AnalogEncoderSim.hpp"
#include "wpi/units/math.hpp"
#define EXPECT_NEAR_UNITS(val1, val2, eps) \

View File

@@ -2,7 +2,7 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/simulation/AnalogInputSim.hpp" // NOLINT(build/include_order)
#include "wpi/simulation/AnalogInputSim.hpp"
#include <gtest/gtest.h>

View File

@@ -2,7 +2,7 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/simulation/CTREPCMSim.hpp" // NOLINT(build/include_order)
#include "wpi/simulation/CTREPCMSim.hpp"
#include <gtest/gtest.h>

View File

@@ -2,6 +2,8 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/simulation/DCMotorSim.hpp"
#include <gtest/gtest.h>
#include "wpi/hardware/motor/PWMVictorSPX.hpp"
@@ -9,7 +11,6 @@
#include "wpi/math/controller/PIDController.hpp"
#include "wpi/math/system/plant/LinearSystemId.hpp"
#include "wpi/simulation/BatterySim.hpp"
#include "wpi/simulation/DCMotorSim.hpp"
#include "wpi/simulation/EncoderSim.hpp"
#include "wpi/simulation/RoboRioSim.hpp"
#include "wpi/system/RobotController.hpp"

View File

@@ -2,7 +2,7 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/simulation/DIOSim.hpp" // NOLINT(build/include_order)
#include "wpi/simulation/DIOSim.hpp"
#include <gtest/gtest.h>

View File

@@ -2,6 +2,8 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/simulation/DifferentialDrivetrainSim.hpp"
#include <gtest/gtest.h>
#include "wpi/math/controller/LTVUnicycleController.hpp"
@@ -12,7 +14,6 @@
#include "wpi/math/system/plant/LinearSystemId.hpp"
#include "wpi/math/trajectory/TrajectoryGenerator.hpp"
#include "wpi/math/trajectory/constraint/DifferentialDriveKinematicsConstraint.hpp"
#include "wpi/simulation/DifferentialDrivetrainSim.hpp"
#include "wpi/units/current.hpp"
#include "wpi/units/math.hpp"
#include "wpi/units/moment_of_inertia.hpp"

View File

@@ -2,7 +2,7 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/simulation/DigitalPWMSim.hpp" // NOLINT(build/include_order)
#include "wpi/simulation/DigitalPWMSim.hpp"
#include <gtest/gtest.h>

View File

@@ -2,6 +2,8 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/simulation/DriverStationSim.hpp"
#include <string>
#include <tuple>
@@ -11,7 +13,6 @@
#include "wpi/driverstation/DriverStation.hpp"
#include "wpi/driverstation/Joystick.hpp"
#include "wpi/framework/RobotState.hpp"
#include "wpi/simulation/DriverStationSim.hpp"
#include "wpi/simulation/SimHooks.hpp"
using namespace wpi;

View File

@@ -2,7 +2,7 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/simulation/DutyCycleEncoderSim.hpp" // NOLINT(build/include_order)
#include "wpi/simulation/DutyCycleEncoderSim.hpp"
#include <gtest/gtest.h>

View File

@@ -2,7 +2,7 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/simulation/DutyCycleSim.hpp" // NOLINT(build/include_order)
#include "wpi/simulation/DutyCycleSim.hpp"
#include <gtest/gtest.h>

View File

@@ -2,6 +2,8 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/simulation/ElevatorSim.hpp"
#include <gtest/gtest.h>
#include "wpi/hardware/motor/PWMVictorSPX.hpp"
@@ -10,7 +12,6 @@
#include "wpi/math/system/NumericalIntegration.hpp"
#include "wpi/math/system/plant/DCMotor.hpp"
#include "wpi/math/system/plant/LinearSystemId.hpp"
#include "wpi/simulation/ElevatorSim.hpp"
#include "wpi/simulation/EncoderSim.hpp"
#include "wpi/system/RobotController.hpp"
#include "wpi/units/math.hpp"

View File

@@ -2,7 +2,7 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/simulation/EncoderSim.hpp" // NOLINT(build/include_order)
#include "wpi/simulation/EncoderSim.hpp"
#include <gtest/gtest.h>

View File

@@ -2,7 +2,9 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/simulation/PWMMotorControllerSim.hpp" // NOLINT(build/include_order)
// clang-format off
#include "wpi/simulation/PWMMotorControllerSim.hpp"
// clang-format on
#include <gtest/gtest.h>

View File

@@ -2,7 +2,7 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/simulation/PWMSim.hpp" // NOLINT(build/include_order)
#include "wpi/simulation/PWMSim.hpp"
#include <gtest/gtest.h>

View File

@@ -2,7 +2,7 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/simulation/PowerDistributionSim.hpp" // NOLINT(build/include_order)
#include "wpi/simulation/PowerDistributionSim.hpp"
#include <vector>

View File

@@ -2,7 +2,7 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/simulation/REVPHSim.hpp" // NOLINT(build/include_order)
#include "wpi/simulation/REVPHSim.hpp"
#include <gtest/gtest.h>

View File

@@ -2,7 +2,7 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/simulation/RoboRioSim.hpp" // NOLINT(build/include_order)
#include "wpi/simulation/RoboRioSim.hpp"
#include <string>

View File

@@ -2,12 +2,13 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/simulation/SimDeviceSim.hpp"
#include <string_view>
#include <gtest/gtest.h>
#include "wpi/hal/SimDevice.h"
#include "wpi/simulation/SimDeviceSim.hpp"
using namespace wpi::sim;

View File

@@ -2,12 +2,12 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/simulation/SingleJointedArmSim.hpp"
#include <numbers>
#include <gtest/gtest.h>
#include "wpi/simulation/SingleJointedArmSim.hpp"
TEST(SingleJointedArmTest, Disabled) {
wpi::sim::SingleJointedArmSim sim(wpi::math::DCMotor::Vex775Pro(2), 300,
3_kg_sq_m, 30_in, -180_deg, 0_deg, true,

View File

@@ -2,10 +2,11 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/smartdashboard/Mechanism2d.hpp"
#include <gtest/gtest.h>
#include "wpi/nt/NetworkTableInstance.hpp"
#include "wpi/smartdashboard/Mechanism2d.hpp"
#include "wpi/smartdashboard/MechanismLigament2d.hpp"
#include "wpi/smartdashboard/SmartDashboard.hpp"
#include "wpi/units/angle.hpp"

View File

@@ -2,6 +2,8 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/smartdashboard/SendableChooser.hpp"
#include <string>
#include <fmt/format.h>
@@ -10,7 +12,6 @@
#include "wpi/nt/NetworkTableInstance.hpp"
#include "wpi/nt/StringTopic.hpp"
#include "wpi/simulation/SendableChooserSim.hpp"
#include "wpi/smartdashboard/SendableChooser.hpp"
#include "wpi/smartdashboard/SmartDashboard.hpp"
class SendableChooserTest : public ::testing::TestWithParam<int> {};

View File

@@ -2,12 +2,12 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/util/Color8Bit.hpp"
#include <string>
#include <gtest/gtest.h>
#include "wpi/util/Color8Bit.hpp"
TEST(Color8BitTest, ConstructDefault) {
constexpr wpi::Color8Bit color;

View File

@@ -2,12 +2,12 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/util/Color.hpp"
#include <string>
#include <gtest/gtest.h>
#include "wpi/util/Color.hpp"
TEST(ColorTest, ConstructDefault) {
constexpr wpi::Color color;