Skip to content

Mark generated files with linguist-generated in .gitattributes - #3994

Open
Madrigal wants to merge 1 commit into
mainfrom
linguist-generated
Open

Madrigal wants to merge 1 commit into
mainfrom
linguist-generated

Conversation

@Madrigal

Copy link
Copy Markdown
Contributor

Issue #, if available: None.

Description of changes:

This adds a .gitattributes that marks generated files as linguist-generated. GitHub collapses those files by
default in PR diffs and leaves them out of language stats. It's the same approach as kubernetes/kubernetes and
aws/aws-sdk-go-v2#3636. No source changes.

The generated C++ has no "generated" header, and Linguist's header rule only applies to Go anyway, so today none of
it is collapsed. The rules follow the output paths in the generator code:

Rule What writes it
/generated/** (except generated/smoke-tests/RunTests.cpp) C2J/Smithy client generation (rmtree + extract), endpoint/include tests, protocol_tests_gen.py, smoke_tests_gen.py
core ClientConfigurationDefaults.*, AWSPartitions.* CppDefaultsGenerator, CppPartitionsGenerator
tools/CI/install-test/all_services_test.cpp install_test_gen.py
tools/code-generation/smithy/**/smithy-build.json Smithy build.gradle.kts
api-descriptions/**, endpoints/**, defaults/partitions JSON, protocol-test models and suites fetch_latest_models.py (verbatim upstream copy), and the Smithy protocol-test models

These stay visible on purpose: RunTests.cpp, the mixed install-test/CMakeLists.txt, Region.h, VERSION,
VersionConfig.h, CHANGELOG.md and the generator .java/.vm sources. Release automation touches them, but
they also carry hand-written changes.

Verification. I ran git check-attr linguist-generated on all 175,207 tracked files:

  • 173,194 are marked, exactly the set the generator code owns (derived independently, not from the globs).
  • Nothing outside that set is marked.
  • Every file with a generated-style header is marked, except 7 explained cases: 4 .vm templates, the doxygen
    layout, and 2 gradlew files that Linguist already handles.

Effect on recent PRs (lines hidden by default):

PR Lines hidden Still shown
#3965 380 of 469 the .vm and XmlSerializer changes
#3960 96,370 of 96,633
#3920 19,168 of 19,673 generator and runner changes
#3964 (generator-only) 0 everything

For reviewers: when a PR changes the generator, expand the collapsed regenerated files to see its effect. The
copied-in models are their own block, in case you'd rather keep them visible.

No changelog fragment: this doesn't change SDK behavior (see CONTRIBUTING.md).

Check all that applies:

  • Did a review by yourself.
  • Added proper tests to cover this PR. (Not applicable: .gitattributes only, verified with git check-attr as above.)
  • Checked if this PR is a breaking (APIs have been changed) change. (Not breaking.)
  • Checked if this PR will not introduce cross-platform inconsistent behavior. (No build or runtime effect.)
  • Checked if this PR would require a ReadMe/Wiki update. (No.)

Check which platforms you have built SDK on to verify the correctness of this PR.

  • Linux
  • Windows
  • Android
  • MacOS
  • IOS
  • Other Platforms (not applicable: no build change)

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Collapse generated service clients, tests, generator-written core files
and synced models in GitHub PR diffs.
@Madrigal
Madrigal marked this pull request as ready for review November 11, 2026 15:49
@Madrigal
Madrigal requested review from averyk22 and pulimsr and removed request for pulimsr November 11, 2026 15:56
@Madrigal
Madrigal enabled auto-merge November 11, 2026 18:31
@Madrigal
Madrigal added this pull request to the merge queue Nov 11, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to Branch Protection failures Nov 11, 2026
You're not authorized to push to this branch. Visit "About protected branches" for more information.
@Madrigal
Madrigal added this pull request to the merge queue Nov 11, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 11, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants