Repository navigation
style: name _ext's array types so clang-format output is stable - #409
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 AI text below 🤖
Follows @henryiii's suggestion on #408.
src/_ext.cppalready goes through the pinned clang-format hook, but its formatting depends on a parse quirk: clang-format does not treat the binding lambdas as lambdas while their parameter types arepy::array_t<double, py::array::c_style | py::array::forcecast>(the|inside the template arguments). Any change to those parameter types, such as a move to the limited API, then re-indents the whole module body; in #408 that was a 2k-line style-only commit.This PR names the two array types once (
array_d,array_i), so clang-format parses the lambdas, and takes the one-time re-indent now:refactor: name the array parameter types of _ext— the aliases; no other change.style: clang-format src/_ext.cpp— the pinned hook's output (clang-format 23.1.2). Apart from whitespace, it only wraps three long comments.After this, changing what
array_d/array_istand for touches those two lines and nothing else under clang-format.Checks: with the aliases undone and whitespace and comment markers ignored, the reformatted file is identical to
main. It builds, and the full test suite passes locally (148 tests; macOS arm64, Python 3.12).