Run clang-format on the entire repo
This patch clang-formats the entire repo. Third-party code is
excluded.
I needed to fix up the .clang-format file so that all the header
includes are ordered properly. I could have sworn that it used to work
without the extra modification, but I guess not.
Signed-off-by: Philipp Schrader <philipp.schrader@gmail.com>
Change-Id: I64bb9f2c795401393f9dfe2fefc4f04cb36b52f6
diff --git a/frc971/zeroing/absolute_and_absolute_encoder_test.cc b/frc971/zeroing/absolute_and_absolute_encoder_test.cc
index 59b421a..b28f637 100644
--- a/frc971/zeroing/absolute_and_absolute_encoder_test.cc
+++ b/frc971/zeroing/absolute_and_absolute_encoder_test.cc
@@ -1,10 +1,11 @@
#include "frc971/zeroing/absolute_and_absolute_encoder.h"
-#include "frc971/zeroing/zeroing_test.h"
#include "glog/logging.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
+#include "frc971/zeroing/zeroing_test.h"
+
namespace frc971 {
namespace zeroing {
namespace testing {
diff --git a/frc971/zeroing/absolute_encoder.cc b/frc971/zeroing/absolute_encoder.cc
index d0cd0d9..aa68acf 100644
--- a/frc971/zeroing/absolute_encoder.cc
+++ b/frc971/zeroing/absolute_encoder.cc
@@ -3,9 +3,10 @@
#include <cmath>
#include <numeric>
+#include "glog/logging.h"
+
#include "aos/containers/error_list.h"
#include "frc971/zeroing/wrap.h"
-#include "glog/logging.h"
namespace frc971 {
namespace zeroing {
diff --git a/frc971/zeroing/absolute_encoder_test.cc b/frc971/zeroing/absolute_encoder_test.cc
index ce485eb..fdc1fa0 100644
--- a/frc971/zeroing/absolute_encoder_test.cc
+++ b/frc971/zeroing/absolute_encoder_test.cc
@@ -1,9 +1,10 @@
#include "frc971/zeroing/absolute_encoder.h"
-#include "frc971/zeroing/zeroing_test.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
+#include "frc971/zeroing/zeroing_test.h"
+
namespace frc971 {
namespace zeroing {
namespace testing {
diff --git a/frc971/zeroing/averager_test.cc b/frc971/zeroing/averager_test.cc
index 9f8f727..50eac72 100644
--- a/frc971/zeroing/averager_test.cc
+++ b/frc971/zeroing/averager_test.cc
@@ -1,6 +1,7 @@
-#include "gtest/gtest.h"
#include "frc971/zeroing/averager.h"
+#include "gtest/gtest.h"
+
namespace frc971 {
namespace zeroing {
diff --git a/frc971/zeroing/imu_zeroer.cc b/frc971/zeroing/imu_zeroer.cc
index 0872b1c..c06ed43 100644
--- a/frc971/zeroing/imu_zeroer.cc
+++ b/frc971/zeroing/imu_zeroer.cc
@@ -80,7 +80,7 @@
last_gyro_sample_ << values.gyro_x(), values.gyro_y(), values.gyro_z();
gyro_averager_.AddData(last_gyro_sample_);
last_accel_sample_ << values.accelerometer_x(), values.accelerometer_y(),
- values.accelerometer_z();
+ values.accelerometer_z();
accel_averager_.AddData(last_accel_sample_);
return true;
}
diff --git a/frc971/zeroing/imu_zeroer.h b/frc971/zeroing/imu_zeroer.h
index 7fad58c..2a5036d 100644
--- a/frc971/zeroing/imu_zeroer.h
+++ b/frc971/zeroing/imu_zeroer.h
@@ -48,14 +48,14 @@
// Max variation (difference between the maximum and minimum value) in a
// kSamplesToAverage range before we allow using the samples for zeroing.
// These values are currently based on looking at results from the ADIS16448.
- static constexpr double kGyroMaxVariation = 0.02; // rad / sec
+ static constexpr double kGyroMaxVariation = 0.02; // rad / sec
// Maximum magnitude we allow the gyro zero to have--this is used to prevent
// us from zeroing the gyro if we just happen to be spinning at a very
// consistent non-zero rate. Currently this is only plausible in simulation.
static constexpr double kGyroMaxZeroingMagnitude = 0.1; // rad / sec
// Max variation in the range before we consider the accelerometer readings to
// be steady.
- static constexpr double kAccelMaxVariation = 0.05; // g's
+ static constexpr double kAccelMaxVariation = 0.05; // g's
// If we ever are able to rezero and get a zero that is more than
// kGyroFaultVariation away from the original zeroing, fault.
static constexpr double kGyroFaultVariation = 0.05; // rad / sec
diff --git a/frc971/zeroing/imu_zeroer_test.cc b/frc971/zeroing/imu_zeroer_test.cc
index deff1b6..566a7b8 100644
--- a/frc971/zeroing/imu_zeroer_test.cc
+++ b/frc971/zeroing/imu_zeroer_test.cc
@@ -1,7 +1,9 @@
-#include "aos/flatbuffers.h"
-#include "gtest/gtest.h"
#include "frc971/zeroing/imu_zeroer.h"
+#include "gtest/gtest.h"
+
+#include "aos/flatbuffers.h"
+
namespace frc971::zeroing {
static constexpr int kMinSamplesToZero =
@@ -113,7 +115,8 @@
(static_cast<double>(ii) / (kMinSamplesToZero - 1) - 0.5) * 0.001;
zeroer.InsertAndProcessMeasurement(
MakeMeasurement({0.01 + offset, 0.02 + offset, 0.03 + offset},
- {4 + offset, 5 + offset, 6 + offset}).message());
+ {4 + offset, 5 + offset, 6 + offset})
+ .message());
}
ASSERT_TRUE(zeroer.Zeroed());
ASSERT_FALSE(zeroer.Faulted());
@@ -143,7 +146,8 @@
(static_cast<double>(ii) / (kMinSamplesToZero - 1) - 0.5) * 1.0;
zeroer.InsertAndProcessMeasurement(
MakeMeasurement({0.01 + offset, 0.02 + offset, 0.03 + offset},
- {4 + offset, 5 + offset, 6 + offset}).message());
+ {4 + offset, 5 + offset, 6 + offset})
+ .message());
}
ASSERT_FALSE(zeroer.Zeroed());
ASSERT_FALSE(zeroer.Faulted());
diff --git a/frc971/zeroing/pot_and_absolute_encoder.cc b/frc971/zeroing/pot_and_absolute_encoder.cc
index 32c4f60..f62b393 100644
--- a/frc971/zeroing/pot_and_absolute_encoder.cc
+++ b/frc971/zeroing/pot_and_absolute_encoder.cc
@@ -3,9 +3,10 @@
#include <cmath>
#include <numeric>
+#include "glog/logging.h"
+
#include "aos/containers/error_list.h"
#include "frc971/zeroing/wrap.h"
-#include "glog/logging.h"
namespace frc971 {
namespace zeroing {
diff --git a/frc971/zeroing/pot_and_absolute_encoder.h b/frc971/zeroing/pot_and_absolute_encoder.h
index 2ff141f..d250a50 100644
--- a/frc971/zeroing/pot_and_absolute_encoder.h
+++ b/frc971/zeroing/pot_and_absolute_encoder.h
@@ -3,8 +3,9 @@
#include <vector>
-#include "aos/containers/error_list.h"
#include "flatbuffers/flatbuffers.h"
+
+#include "aos/containers/error_list.h"
#include "frc971/zeroing/zeroing.h"
namespace frc971 {
diff --git a/frc971/zeroing/pot_and_absolute_encoder_test.cc b/frc971/zeroing/pot_and_absolute_encoder_test.cc
index 1784fed..5c05cc1 100644
--- a/frc971/zeroing/pot_and_absolute_encoder_test.cc
+++ b/frc971/zeroing/pot_and_absolute_encoder_test.cc
@@ -1,9 +1,10 @@
#include "frc971/zeroing/pot_and_absolute_encoder.h"
-#include "frc971/zeroing/zeroing_test.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
+#include "frc971/zeroing/zeroing_test.h"
+
namespace frc971 {
namespace zeroing {
namespace testing {
diff --git a/frc971/zeroing/pot_and_index.cc b/frc971/zeroing/pot_and_index.cc
index 7c713d9..0f1e9e0 100644
--- a/frc971/zeroing/pot_and_index.cc
+++ b/frc971/zeroing/pot_and_index.cc
@@ -78,8 +78,8 @@
// If there are no index pulses to use or we don't have enough samples yet to
// have a well-filtered starting position then we use the filtered value as
// our best guess.
- if (!zeroed_ &&
- (info.index_pulses() == last_used_index_pulse_count_ || !offset_ready())) {
+ if (!zeroed_ && (info.index_pulses() == last_used_index_pulse_count_ ||
+ !offset_ready())) {
offset_ = start_average;
} else if (!zeroed_ || last_used_index_pulse_count_ != info.index_pulses()) {
// Note the accurate start position and the current index pulse count so
diff --git a/frc971/zeroing/relative_encoder_test.cc b/frc971/zeroing/relative_encoder_test.cc
index a29ba4b..6256fe7 100644
--- a/frc971/zeroing/relative_encoder_test.cc
+++ b/frc971/zeroing/relative_encoder_test.cc
@@ -1,6 +1,7 @@
+#include "gtest/gtest.h"
+
#include "frc971/zeroing/zeroing.h"
#include "frc971/zeroing/zeroing_test.h"
-#include "gtest/gtest.h"
namespace frc971 {
namespace zeroing {
diff --git a/frc971/zeroing/unwrap_test.cc b/frc971/zeroing/unwrap_test.cc
index d1e6db9..b71c8b6 100644
--- a/frc971/zeroing/unwrap_test.cc
+++ b/frc971/zeroing/unwrap_test.cc
@@ -1,6 +1,7 @@
-#include "frc971/zeroing/wrap.h"
#include "gtest/gtest.h"
+#include "frc971/zeroing/wrap.h"
+
namespace frc971 {
namespace zeroing {
namespace testing {
diff --git a/frc971/zeroing/wrap_test.cc b/frc971/zeroing/wrap_test.cc
index b5f9100..6597e03 100644
--- a/frc971/zeroing/wrap_test.cc
+++ b/frc971/zeroing/wrap_test.cc
@@ -34,8 +34,8 @@
break;
}
}
- EXPECT_TRUE(found_interval) << ": Wrap(" << i << ", " << j
- << ") = " << wrapped_val;
+ EXPECT_TRUE(found_interval)
+ << ": Wrap(" << i << ", " << j << ") = " << wrapped_val;
}
}
}
diff --git a/frc971/zeroing/zeroing.h b/frc971/zeroing/zeroing.h
index 028194c..f7b52a6 100644
--- a/frc971/zeroing/zeroing.h
+++ b/frc971/zeroing/zeroing.h
@@ -7,6 +7,7 @@
#include <vector>
#include "flatbuffers/flatbuffers.h"
+
#include "frc971/constants.h"
#include "frc971/control_loops/control_loops_generated.h"
diff --git a/frc971/zeroing/zeroing_test.h b/frc971/zeroing/zeroing_test.h
index 9b7ba95..cadbe6c 100644
--- a/frc971/zeroing/zeroing_test.h
+++ b/frc971/zeroing/zeroing_test.h
@@ -1,8 +1,8 @@
-#include "frc971/zeroing/zeroing.h"
+#include "gtest/gtest.h"
#include "frc971/control_loops/control_loops_generated.h"
#include "frc971/control_loops/position_sensor_sim.h"
-#include "gtest/gtest.h"
+#include "frc971/zeroing/zeroing.h"
namespace frc971 {
namespace zeroing {