Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mark snaps with @generated #2026

Open
maxheld83 opened this issue Nov 12, 2024 · 0 comments
Open

mark snaps with @generated #2026

maxheld83 opened this issue Nov 12, 2024 · 0 comments

Comments

@maxheld83
Copy link
Member

maxheld83 commented Nov 12, 2024

Since snaps from expect_snapshot_*() are automatically generated, they should be treated differently by tooling.

For example, I wouldn't want to run a linter on them.

There's a (somewhat widely?) used "standard", the @generated marker for this purpose: https://generated.at
The @generated marker is specifically for generated files which should be committed to SCM
(so not .gitignored).

For example, GitHub's super-linter can be set up to ignore all files thus marked.

I've so far made do with my own transformer like so:

https://github.com/dataheld/elf/blob/0fbc0fdbac7db70c0751b00819423fd58ce1f39e/R/tests.R#L1-L18

Happy to add a PR to this effect, if people find this useful.
(The transform arguments docs suggest a different use,
so @generated probably shouldn't happen via that argument.

Needs some care as to how this can be wrapped in different file formats, i.e. for markdown "<!--@generated-->" seemed idiomatic.

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

No branches or pull requests

1 participant