[ci] Upgrade to wpiformat 2025.36 (#8308)

clang-format 21 made some formatting changes. Since wpiformat's stdlib
task was removed, I removed NOLINT comments for it and removed some
std:: prefixes it added to comments.
This commit is contained in:
Tyler Veness
2025-10-28 20:17:04 -07:00
committed by GitHub
parent a6a4912a80
commit 4aef52a117
23 changed files with 38 additions and 424 deletions

View File

@@ -36,7 +36,7 @@ jobs:
- name: Install wpiformat
run: |
python -m venv ${{ runner.temp }}/wpiformat
${{ runner.temp }}/wpiformat/bin/pip3 install wpiformat==2025.34
${{ runner.temp }}/wpiformat/bin/pip3 install wpiformat==2025.36
- name: Run
run: ${{ runner.temp }}/wpiformat/bin/wpiformat
- 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.34
${{ runner.temp }}/wpiformat/bin/pip3 install wpiformat==2025.36
- name: Create compile_commands.json
run: |
./gradlew generateCompileCommands -Ptoolchain-optional-roboRio

View File

@@ -186,7 +186,7 @@ extern "C" {
#if defined(WIN32) || defined(_WIN32)
__declspec(dllexport)
#endif
int HALSIM_InitExtension(void) {
int HALSIM_InitExtension(void) {
static bool once = false;
if (once) {

View File

@@ -45,7 +45,7 @@ extern "C" {
#if defined(WIN32) || defined(_WIN32)
__declspec(dllexport)
#endif
int HALSIM_InitExtension(void) {
int HALSIM_InitExtension(void) {
std::puts("Simulator GUI Initializing.");
gui::CreateContext();

View File

@@ -57,13 +57,9 @@
HALSIM_Cancel##cbname##Callback(m_index, m_callback); \
} \
\
int32_t GetIndex() const { \
return m_index; \
} \
int32_t GetIndex() const { return m_index; } \
\
int GetChannel() const { \
return m_channel; \
} \
int GetChannel() const { return m_channel; } \
\
private: \
static void CallbackFunc(const char*, void* param, \
@@ -100,13 +96,9 @@
HALSIM_Cancel##cbname##Callback(m_index, m_channel, m_callback); \
} \
\
int32_t GetIndex() const { \
return m_index; \
} \
int32_t GetIndex() const { return m_index; } \
\
int32_t GetChannel() const { \
return m_channel; \
} \
int32_t GetChannel() const { return m_channel; } \
\
private: \
static void CallbackFunc(const char*, void* param, \

View File

@@ -18,7 +18,7 @@ extern "C" {
__declspec(dllexport)
#endif
int HALSIM_InitExtension(void) {
int HALSIM_InitExtension(void) {
std::puts("HALSim WS Client Extension Initializing");
HAL_OnShutdown(nullptr, [](void*) { gClient.reset(); });

View File

@@ -18,7 +18,7 @@ extern "C" {
#if defined(WIN32) || defined(_WIN32)
__declspec(dllexport)
#endif
int HALSIM_InitExtension(void) {
int HALSIM_InitExtension(void) {
std::puts("Websocket WS Server Initializing.");
HAL_OnShutdown(nullptr, [](void*) { gServer.reset(); });

View File

@@ -25,7 +25,7 @@ extern "C" {
__declspec(dllexport)
#endif
int HALSIM_InitExtension(void) {
int HALSIM_InitExtension(void) {
std::puts("HALSim XRP Extension Initializing");
HAL_OnShutdown(nullptr, [](void*) { gClient.reset(); });

View File

@@ -251,17 +251,17 @@ OLSResult CalculateFeedforwardGains(const Storage& data,
if (type == analysis::kArm) {
// dx/dt = -Kv/Ka x + 1/Ka u - Ks/Ka sgn(x)
// - Kg/Ka cos(offset) cos(angle) NOLINT
// + Kg/Ka sin(offset) sin(angle) NOLINT
// dx/dt = αx + βu + γ sgn(x) + δ cos(angle) + ε sin(angle) NOLINT
// - Kg/Ka cos(offset) cos(angle)
// + Kg/Ka sin(offset) sin(angle)
// dx/dt = αx + βu + γ sgn(x) + δ cos(angle) + ε sin(angle)
// δ = -Kg/Ka cos(offset)
// ε = Kg/Ka sin(offset)
double δ = ols.coeffs[3];
double ε = ols.coeffs[4];
// Kg = hypot(δ, ε)/β NOLINT
// offset = atan2(ε, -δ) NOLINT
// Kg = hypot(δ, ε)/β
// offset = atan2(ε, -δ)
gains.emplace_back(std::hypot(δ, ε) / β);
gains.emplace_back(std::atan2(ε, -δ));
}

View File

@@ -19,10 +19,7 @@ def copy_upstream_src(wpilib_root: Path):
# Copy Sleipnir files into allwpilib
walk_cwd_and_copy_if(
lambda dp, f: (has_prefix(dp, Path("include")) or has_prefix(dp, Path("src")))
or f == ".clang-format"
or f == ".clang-tidy"
or f == ".styleguide"
or f == ".styleguide-license",
and f not in [".styleguide", ".styleguide-license"],
wpimath / "src/main/native/thirdparty/sleipnir",
)

View File

@@ -25,8 +25,7 @@ namespace frc2 {
* std::unique_ptr<Command>, use CommandPtr::Unwrap to convert.
* CommandPtr::UnwrapVector does the same for vectors.
*/
class [[nodiscard]]
CommandPtr final {
class [[nodiscard]] CommandPtr final {
public:
explicit CommandPtr(std::unique_ptr<Command>&& command);

View File

@@ -19,8 +19,6 @@ generatedFileExclude {
src/main/native/include/unsupported/
src/main/native/thirdparty/
src/test/native/cpp/UnitsTest\.cpp$
src/test/native/cpp/drake/
src/test/native/include/drake/
src/generated/main/java/edu/wpi/first/math/proto
src/generated/main/native/cpp
}
@@ -41,6 +39,7 @@ includeOtherLibs {
^gcem/
^google/
^gtest/
^sleipnir/
^unsupported/
^wpi/
}

View File

@@ -260,7 +260,7 @@ WPILIB_DLLEXPORT constexpr Eigen::Vector3d PoseTo3dVector(const Pose2d& pose) {
}
/**
* Converts a Pose2d into a vector of [x, y, std::cos(theta), std::sin(theta)].
* Converts a Pose2d into a vector of [x, y, cos(theta), sin(theta)].
*
* @param pose The pose that is being represented.
*

View File

@@ -91,7 +91,7 @@ class WPILIB_DLLEXPORT Ellipse2d {
auto a = units::math::max(m_xSemiAxis, m_ySemiAxis);
// Minor semi-axis
auto b = units::math::min(m_xSemiAxis, m_ySemiAxis); // NOLINT
auto b = units::math::min(m_xSemiAxis, m_ySemiAxis);
auto c = units::math::sqrt(a * a - b * b);
@@ -203,7 +203,9 @@ class WPILIB_DLLEXPORT Ellipse2d {
auto x = rotPoint.X() - m_center.X();
auto y = rotPoint.Y() - m_center.Y();
// NOLINTNEXTLINE (bugprone-integer-division)
return (x * x) / (m_xSemiAxis * m_xSemiAxis) +
// NOLINTNEXTLINE (bugprone-integer-division)
(y * y) / (m_ySemiAxis * m_ySemiAxis);
}
};

View File

@@ -432,8 +432,8 @@ constexpr Pose3d Pose3d::Exp(const Twist3d& twist) const {
B = 1 / 2.0 - thetaSq / 24 + thetaSq * thetaSq / 720;
C = 1 / 6.0 - thetaSq / 120 + thetaSq * thetaSq / 5040;
} else {
// A = std::sin(θ)/θ
// B = (1 - std::cos(θ)) / θ²
// A = sin(θ)/θ
// B = (1 - cos(θ)) / θ²
// C = (1 - A) / θ²
A = gcem::sin(theta) / theta;
B = (1 - gcem::cos(theta)) / thetaSq;
@@ -491,8 +491,8 @@ constexpr Twist3d Pose3d::Log(const Pose3d& end) const {
// https://www.wolframalpha.com/input?i2d=true&i=series+expansion+of+Divide%5B1-Divide%5BDivide%5Bsin%5C%2840%29x%5C%2841%29%2Cx%5D%2C2Divide%5B1-cos%5C%2840%29x%5C%2841%29%2CPower%5Bx%2C2%5D%5D%5D%2CPower%5Bx%2C2%5D%5D+at+x%3D0
C = 1 / 12.0 + thetaSq / 720 + thetaSq * thetaSq / 30240;
} else {
// A = std::sin(θ)/θ
// B = (1 - std::cos(θ)) / θ²
// A = sin(θ)/θ
// B = (1 - cos(θ)) / θ²
// C = (1 - A/(2*B)) / θ²
double A = gcem::sin(theta) / theta;
double B = (1 - gcem::cos(theta)) / thetaSq;

View File

@@ -296,8 +296,8 @@ class WPILIB_DLLEXPORT Quaternion {
// 𝑣⃗ = θ * v̂
// v̂ = 𝑣⃗ / θ
// 𝑞 = std::cos(θ/2) + std::sin(θ/2) * v̂
// 𝑞 = std::cos(θ/2) + std::sin(θ/2) / θ * 𝑣⃗
// 𝑞 = cos(θ/2) + sin(θ/2) * v̂
// 𝑞 = cos(θ/2) + sin(θ/2) / θ * 𝑣⃗
double theta = gcem::hypot(rvec(0), rvec(1), rvec(2));
double cos = gcem::cos(theta / 2);

View File

@@ -1,249 +0,0 @@
---
Language: Cpp
BasedOnStyle: Google
AccessModifierOffset: -1
AlignAfterOpenBracket: Align
AlignArrayOfStructures: None
AlignConsecutiveAssignments:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
PadOperators: true
AlignConsecutiveBitFields:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
PadOperators: false
AlignConsecutiveDeclarations:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
PadOperators: false
AlignConsecutiveMacros:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
PadOperators: false
AlignConsecutiveShortCaseStatements:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCaseColons: false
AlignEscapedNewlines: Left
AlignOperands: Align
AlignTrailingComments:
Kind: Always
OverEmptyLines: 0
AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortEnumsOnASingleLine: true
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: true
BinPackParameters: true
BitFieldColonSpacing: Both
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterExternBlock: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakAfterAttributes: Always
BreakAfterJavaFieldAnnotations: false
BreakArrays: true
BreakBeforeBinaryOperators: None
BreakBeforeConceptDeclarations: Always
BreakBeforeBraces: Attach
BreakBeforeInlineASMColon: OnlyMultiline
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeColon
BreakInheritanceList: BeforeColon
BreakStringLiterals: true
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: LogicalBlock
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^<ext/.*\.h>'
Priority: 2
SortPriority: 0
CaseSensitive: false
- Regex: '^<.*\.h>'
Priority: 1
SortPriority: 0
CaseSensitive: false
- Regex: '^<.*'
Priority: 2
SortPriority: 0
CaseSensitive: false
- Regex: '.*'
Priority: 3
SortPriority: 0
CaseSensitive: false
IncludeIsMainRegex: '([-_](test|unittest))?$'
IncludeIsMainSourceRegex: ''
IndentAccessModifiers: false
IndentCaseBlocks: false
IndentCaseLabels: true
IndentExternBlock: AfterExternBlock
IndentGotoLabels: true
IndentPPDirectives: None
IndentRequiresClause: true
IndentWidth: 2
IndentWrappedFunctionNames: false
InsertBraces: false
InsertNewlineAtEOF: false
InsertTrailingCommas: None
IntegerLiteralSeparator:
Binary: 0
BinaryMinDigits: 0
Decimal: 0
DecimalMinDigits: 0
Hex: 0
HexMinDigits: 0
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
KeepEmptyLinesAtEOF: false
LambdaBodyIndentation: Signature
LineEnding: DeriveLF
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Never
ObjCBlockIndentWidth: 2
ObjCBreakBeforeNestedBlockParam: true
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PackConstructorInitializers: NextLine
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakOpenParenthesis: 0
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyIndentedWhitespace: 0
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
PPIndentWidth: -1
QualifierAlignment: Leave
RawStringFormats:
- Language: Cpp
Delimiters:
- cc
- CC
- cpp
- Cpp
- CPP
- 'c++'
- 'C++'
CanonicalDelimiter: ''
BasedOnStyle: google
- Language: TextProto
Delimiters:
- pb
- PB
- proto
- PROTO
EnclosingFunctions:
- EqualsProto
- EquivToProto
- PARSE_PARTIAL_TEXT_PROTO
- PARSE_TEST_PROTO
- PARSE_TEXT_PROTO
- ParseTextOrDie
- ParseTextProtoOrDie
- ParseTestProto
- ParsePartialTestProto
CanonicalDelimiter: pb
BasedOnStyle: google
ReferenceAlignment: Pointer
ReflowComments: true
RemoveBracesLLVM: false
RemoveParentheses: Leave
RemoveSemicolon: false
RequiresClausePosition: OwnLine
RequiresExpressionIndentation: OuterScope
SeparateDefinitionBlocks: Leave
ShortNamespaceLines: 1
SortIncludes: false
SortJavaStaticImport: Before
SortUsingDeclarations: LexicographicNumeric
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceAroundPointerQualifiers: Default
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeJsonColon: false
SpaceBeforeParens: ControlStatements
SpaceBeforeParensOptions:
AfterControlStatements: true
AfterForeachMacros: true
AfterFunctionDefinitionName: false
AfterFunctionDeclarationName: false
AfterIfMacros: true
AfterOverloadedOperator: false
AfterRequiresInClause: false
AfterRequiresInExpression: false
BeforeNonEmptyParentheses: false
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: Never
SpacesInContainerLiterals: true
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: -1
SpacesInParens: Never
SpacesInParensOptions:
InCStyleCasts: false
InConditionalStatements: false
InEmptyParentheses: false
Other: false
SpacesInSquareBrackets: false
Standard: c++20
TabWidth: 8
UseTab: Never
...

View File

@@ -1,74 +0,0 @@
Checks:
'bugprone-assert-side-effect,
bugprone-bool-pointer-implicit-conversion,
bugprone-copy-constructor-init,
bugprone-dangling-handle,
bugprone-dynamic-static-initializers,
bugprone-forward-declaration-namespace,
bugprone-forwarding-reference-overload,
bugprone-inaccurate-erase,
bugprone-incorrect-roundings,
bugprone-integer-division,
bugprone-lambda-function-name,
bugprone-misplaced-operator-in-strlen-in-alloc,
bugprone-misplaced-widening-cast,
bugprone-move-forwarding-reference,
bugprone-multiple-statement-macro,
bugprone-parent-virtual-call,
bugprone-posix-return,
bugprone-sizeof-container,
bugprone-sizeof-expression,
bugprone-spuriously-wake-up-functions,
bugprone-string-constructor,
bugprone-string-integer-assignment,
bugprone-string-literal-with-embedded-nul,
bugprone-suspicious-enum-usage,
bugprone-suspicious-include,
bugprone-suspicious-memset-usage,
bugprone-suspicious-missing-comma,
bugprone-suspicious-semicolon,
bugprone-suspicious-string-compare,
bugprone-throw-keyword-missing,
bugprone-too-small-loop-variable,
bugprone-undefined-memory-manipulation,
bugprone-undelegated-constructor,
bugprone-unhandled-self-assignment,
bugprone-unused-raii,
bugprone-virtual-near-miss,
cert-err52-cpp,
cert-err60-cpp,
cert-mem57-cpp,
cert-oop57-cpp,
cert-oop58-cpp,
clang-diagnostic-*,
-clang-diagnostic-deprecated-declarations,
-clang-diagnostic-#warnings,
-clang-diagnostic-pedantic,
clang-analyzer-*,
-clang-analyzer-core.uninitialized.UndefReturn,
-clang-analyzer-optin.cplusplus.UninitializedObject,
-clang-analyzer-optin.portability.UnixAPI,
-clang-analyzer-unix.Malloc,
-cppcoreguidelines-slicing,
google-build-namespaces,
google-explicit-constructor,
google-global-names-in-headers,
google-readability-avoid-underscore-in-googletest-name,
google-readability-casting,
google-runtime-operator,
misc-definitions-in-headers,
misc-misplaced-const,
misc-new-delete-overloads,
misc-non-copyable-objects,
modernize-avoid-bind,
modernize-concat-nested-namespaces,
modernize-make-shared,
modernize-make-unique,
modernize-pass-by-value,
modernize-use-default-member-init,
modernize-use-noexcept,
modernize-use-nullptr,
modernize-use-override,
modernize-use-using,
readability-braces-around-statements'
FormatStyle: file

View File

@@ -1,23 +0,0 @@
cppHeaderFileInclude {
\.hpp$
}
cppSrcFileInclude {
\.cpp$
}
modifiableFileExclude {
\.patch$
\.png$
\.svg$
jormungandr/cpp/docstrings\.hpp$
jormungandr/py\.typed$
}
includeOtherLibs {
^Eigen/
^catch2/
^gch/
^nanobind/
^sleipnir/
}

View File

@@ -1 +0,0 @@
// Copyright (c) Sleipnir contributors

View File

@@ -1,14 +0,0 @@
cppHeaderFileInclude {
\.hpp$
}
cppSrcFileInclude {
\.cpp$
}
includeOtherLibs {
^Eigen/
^fmt/
^gch/
^wpi/
}

View File

@@ -1,13 +0,0 @@
cppHeaderFileInclude {
\.hpp$
}
cppSrcFileInclude {
\.cpp$
}
includeOtherLibs {
^Eigen/
^fmt/
^gch/
}

View File

@@ -192,11 +192,11 @@ TEST(LinearFilterOutputTest, CentralFiniteDifference) {
AssertCentralResults<1, 3>(
[](double x) {
// f(x) = std::sin(x)
// f(x) = sin(x)
return std::sin(x);
},
[](double x) {
// df/dx = std::cos(x)
// df/dx = cos(x)
return std::cos(x);
},
h, -20.0, 20.0);
@@ -225,11 +225,11 @@ TEST(LinearFilterOutputTest, CentralFiniteDifference) {
AssertCentralResults<2, 5>(
[](double x) {
// f(x) = std::sin(x)
// f(x) = sin(x)
return std::sin(x);
},
[](double x) {
// d²f/dx² = -std::sin(x)
// d²f/dx² = -sin(x)
return -std::sin(x);
},
h, -20.0, 20.0);
@@ -265,11 +265,11 @@ TEST(LinearFilterOutputTest, BackwardFiniteDifference) {
AssertBackwardResults<1, 2>(
[](double x) {
// f(x) = std::sin(x)
// f(x) = sin(x)
return std::sin(x);
},
[](double x) {
// df/dx = std::cos(x)
// df/dx = cos(x)
return std::cos(x);
},
h, -20.0, 20.0);
@@ -298,11 +298,11 @@ TEST(LinearFilterOutputTest, BackwardFiniteDifference) {
AssertBackwardResults<2, 4>(
[](double x) {
// f(x) = std::sin(x)
// f(x) = sin(x)
return std::sin(x);
},
[](double x) {
// d²f/dx² = -std::sin(x)
// d²f/dx² = -sin(x)
return -std::sin(x);
},
h, -20.0, 20.0);

View File

@@ -39,8 +39,7 @@ class SendableHelper {
// See https://bugzilla.mozilla.org/show_bug.cgi?id=1442819
__attribute__((no_sanitize("vptr")))
#endif
constexpr SendableHelper&
operator=(SendableHelper&& rhs) {
constexpr SendableHelper& operator=(SendableHelper&& rhs) {
if (!std::is_constant_evaluated()) {
// it is safe to call Move() multiple times with the same rhs
SendableRegistry::Move(static_cast<Derived*>(this),