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

Feature request: add an flag for strict matching of generated code #225

Open
alcortesm opened this issue Dec 30, 2024 · 1 comment
Open

Comments

@alcortesm
Copy link

What version of GCI are you using?

; gci --version
gci version 0.13.4

Feature Request

Would it be possible to have a flag for a more strict matching for generated files?

For example, something like --skip-generated-strict that only matches files with the regular expression ^// Code generated .* DO NOT EDIT\.$ as the first non-comment, non-blank text in the file, as explained in https://pkg.go.dev/cmd/go#hdr-Generate_Go_files_by_processing_source?

Rationale

Right now, the --skip-generated flag instructs gci to ignore files containing any of these strings:

	const (
		genCodeGenerated = "code generated"
		genDoNotEdit     = "do not edit"
		genAutoFile      = "autogenerated file"      // easyjson
		genAutoGenerated = "automatically generated" // genny
	)

Some of these strings create false positives, often appearing in hand-written files (especially the last one, genAutoGenerated).

@alcortesm alcortesm changed the title add an option for strict matching for generated code add an option for strict matching of generated code Dec 30, 2024
@alcortesm alcortesm changed the title add an option for strict matching of generated code add an flag for strict matching of generated code Dec 30, 2024
@alcortesm alcortesm changed the title add an flag for strict matching of generated code Feature request: add an flag for strict matching of generated code Dec 30, 2024
@ccoVeille
Copy link
Contributor

It looks like a legitimate requests, maybe skip-generated could becomeva flag parameter that accepts coma separated value of header that are accepted.

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

2 participants