Skip to content

dev/sg: add suggestions for fixable sg lints

Warren Gifford requested to merge sg-lint-fix-suggest into main

Created by: bobheadxi

In practice, this only works for the go check at the moment, which has the fixable go-generate check, but other linters can implement Fix as well in the future 😁

Test plan

Add a test lint target that is always broken, but is "fixable":

	{
		Name:        "test",
		Description: "Check for broken urls in the codebase",
		Checks: []*linter{
			{
				Name: "test",
				Check: func(ctx context.Context, out *std.Output, args *repo.State) error {
					return errors.New("ah")
				},
				Fix: func(ctx context.Context, cio check.IO, args *repo.State) error {
					cio.WriteSuccessf("Yay!")
					return nil
				},
			},
		},
	},

Get a suggestion!

image

Merge request reports

Loading