Distinguishing code-generated files during review

64 views
Skip to first unread message

Paul Jolly

unread,
Aug 2, 2023, 11:59:15 AM8/2/23
to Repo and Gerrit Discussion
Hi all,

Apologies if this has come up before. My searches for various combinations of terms didn't through up a specific enough search for me to find a previous conversation if it does exist.

In the CUE project (https://cuelang.org/) we have lots of code generated files. We review almost all of our code via the excellent GerritHub. 

Some changes contain changes to (lots of) code generated files.

All of our code generated files have a signalling comment (header), similar to that prescribed by https://golang.org/s/generatedcode. For Go code that is a comment matching the regular expression:

^// Code generated .* DO NOT EDIT\.$

In situations (like JSON files) where this is not possible, we have used .gitattributes to signal to tools like GitHub that a file is generated.

One thing I've found myself wanting is a way of distinguishing, at a glance, whether a file I am reviewing as part of a change is code generated or not. Such a visual cue (no pun intended) would help me to more quickly skim/skip over that file. 

Is there such a thing within Gerrit? 

(We are agnostic on whether such a system is driven by a comment/similar within a file, the file name, or .gitattributes specification)

Thanks,


Paul


Nasser Grainawi

unread,
Aug 7, 2023, 1:59:00 PM8/7/23
to Paul Jolly, Repo and Gerrit Discussion
On Wed, Aug 2, 2023 at 10:01 AM Paul Jolly <pa...@myitcv.org.uk> wrote:
Hi all,

Apologies if this has come up before. My searches for various combinations of terms didn't through up a specific enough search for me to find a previous conversation if it does exist.

In the CUE project (https://cuelang.org/) we have lots of code generated files. We review almost all of our code via the excellent GerritHub. 

Some changes contain changes to (lots of) code generated files.

All of our code generated files have a signalling comment (header), similar to that prescribed by https://golang.org/s/generatedcode. For Go code that is a comment matching the regular expression:

^// Code generated .* DO NOT EDIT\.$

In situations (like JSON files) where this is not possible, we have used .gitattributes to signal to tools like GitHub that a file is generated.

What do you use in .gitattributes to do this? I think that's the most likely path for adding support for something like this in Gerrit.
 

One thing I've found myself wanting is a way of distinguishing, at a glance, whether a file I am reviewing as part of a change is code generated or not. Such a visual cue (no pun intended) would help me to more quickly skim/skip over that file. 

Is there such a thing within Gerrit? 

(We are agnostic on whether such a system is driven by a comment/similar within a file, the file name, or .gitattributes specification)

Thanks,


Paul


--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/repo-discuss/a0da223a-e4ff-47b5-906d-770db1436e95n%40googlegroups.com.

Paul Jolly

unread,
Aug 14, 2023, 12:38:45 AM8/14/23
to Nasser Grainawi, Repo and Gerrit Discussion
>> In situations (like JSON files) where this is not possible, we have used .gitattributes to signal to tools like GitHub that a file is generated.
>
> What do you use in .gitattributes to do this? I think that's the most likely path for adding support for something like this in Gerrit.

The GitHub method uses .gitattributes. There docs are fairly limited:

https://docs.github.com/en/repositories/working-with-files/managing-files/customizing-how-changed-files-appear-on-github

An example of that in action:

https://github.com/cue-lang/cuelang.org/blob/master/.gitattributes

Thanks
Reply all
Reply to author
Forward
0 new messages