Skip to content

Conversation

@gssbzn
Copy link
Contributor

@gssbzn gssbzn commented Mar 4, 2025

Proposed changes

Improve the generate code to leverage tools conventions for detecting autogenerated code

Screenshot 2025-03-04 at 11 18 42

As a side note I find a bit confusing I need to run make bin/api-generator if I do changes to the generation code since make will cache the bin and won't try to rebuild, I wonder why we went with a pre-built binary over go run

//
// This code was autogenerated using `make gen-L1-commands`

// Code generated using `make gen-api-commands`. DO NOT EDIT.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

GH will consider any file with // Code generated ... as auto generated
Intellij will show a warning when opening files with DO NOT EDIT.

@@ -1,4 +1,5 @@
{{- /* Template for generating L1 commands */ -}}
{{- /*gotype: github.com/mongodb/mongodb-atlas-cli/atlascli/internal/api.GroupedAndSortedCommands */ -}}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

intellij type hint

@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2025

Coverage Report 📈

Branch Commit Coverage
master 316d6d7 37.9%
improve-command-auto-doc c61a594 37.9%
Difference 0%

@gssbzn gssbzn marked this pull request as ready for review March 4, 2025 11:51
@gssbzn gssbzn requested a review from a team as a code owner March 4, 2025 11:51
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this file has a year that auto-updates which means tests will start failing on January next year

Copy link
Collaborator

Choose a reason for hiding this comment

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

yeap, we will need to regenerate the snapshots once a year, I think that is ok, better the write 2024 like before

Copy link
Contributor Author

Choose a reason for hiding this comment

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

copyright years don't need to be updated FYI, we also skip the whole copyright header on some autogenerated files like mocks and we tell the checks to ignore those folders, just things to consider if this becomes a problem

Copy link
Collaborator

Choose a reason for hiding this comment

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

on old files is ok, but generating new files on old dates seems weird.

@gssbzn gssbzn merged commit 2266909 into master Mar 5, 2025
24 checks passed
@gssbzn gssbzn deleted the improve-command-auto-doc branch March 5, 2025 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants