Don't touch the style of generated files #6820
Merged
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.
Ideally the result of the generator would conform to the code style, but this would be difficult, especially with respect to the placement of line breaks in long logical lines. So, to avoid surprises when checking the style of generated files (which happens in releases and in long-time support branches), systematically skip generated files.
code_style.py
reformats the templates, so the generated files are mostly ok. Preferably the parts that are constructed by Perl or Python code should respect the new code style (I've started on that and will make a PR later). However, generating code that conforms to the line length limit would be very difficult, and I don't propose to do that.In development, this will prevent
check-generated-files.sh
from failing when we make a release and commit the generated files into Git, then run the CI. In 2.28, this will preventcheck-generated-files.sh
failing on the CI once the branch is built properly (regenerating files after the code style change).There are other possible approaches. I think it would be realistic to insist on the code style of the generated files apart from the line lengths. But we'd need to test that adequately, because in the
development
branch the problem would only manifest at release time when we check the generated files into Git.Gatekeeper checklist
scripts/code_style.py -f && tests/scripts/check-generated-files.sh -u && scripts/code_style.py >/dev/null
must succeed (no restyling after regeneration); endgoal: Script to update the GitHub preview branches #6758 produces branches that pass CI