Skip to content

Mark Generated C/C++ files as generated#658

Merged
bocchino merged 3 commits intomainfrom
tumbar-git-attribute
Mar 20, 2025
Merged

Mark Generated C/C++ files as generated#658
bocchino merged 3 commits intomainfrom
tumbar-git-attribute

Conversation

@Kronos3
Copy link
Copy Markdown
Collaborator

@Kronos3 Kronos3 commented Mar 17, 2025

Before:

$ github-linguist
86.58%  11423656   C++
10.58%  1395476    Scala
1.39%   183882     Fortran
1.32%   173503     Shell
0.08%   10088      Emacs Lisp
0.03%   4287       Vim Script
0.02%   3215       Python

After:

$ github-linguist
76.57%  1395476    Scala
10.09%  183882     Fortran
9.52%   173503     Shell
2.85%   52011      C++
0.55%   10088      Emacs Lisp
0.24%   4287       Vim Script
0.18%   3215       Python

I believe the remaining C++ files are our .hpp for abstract type definitions. We can also mark the .fpp files as any language other than Fortran if we wanted to (though the language must exist according to github-linguist unfortunately).

Here's the set of languages understood by linguist https://github.com/github-linguist/linguist/blob/main/vendor/README.md.

@bocchino
Copy link
Copy Markdown
Collaborator

Thanks, this looks good! Question: Do you know what "vendored" is intended to be used for? It's a bit of an unusual term. I suppose we don't use "generated" for the C++ test output files because they are checked into the repo.

@bocchino bocchino self-requested a review March 18, 2025 15:49
@Kronos3
Copy link
Copy Markdown
Collaborator Author

Kronos3 commented Mar 18, 2025

Here's the set of overrides that linguist allows:

https://github.com/github-linguist/linguist/blob/main/docs/overrides.md#summary

Git attribute Defined in Effect on file
linguist-detectable [languages.yml] Included in stats, even if language's type is data or prose
linguist-documentation [documentation.yml] Excluded from stats
linguist-generated [generated.rb] Excluded from stats, hidden in diffs
linguist-language=name [languages.yml] Highlighted and classified as name
linguist-vendored [vendor.yml] Excluded from stats

There is "generated" but that means it won't show up in the diffs. That's usually used for code thats generated in someones tree that just does boilerplate. Since the generated files are part of the output, we definitely want the diffs.

Copy link
Copy Markdown
Collaborator

@bocchino bocchino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@bocchino bocchino merged commit 7329576 into main Mar 20, 2025
11 checks passed
@bocchino bocchino deleted the tumbar-git-attribute branch March 20, 2025 15:17
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