Documentation
¶
Overview ¶
Package lint runs the checks of a project in one place: the checks of taply, with the ones that depend on a module run only when the module is enabled.
Index ¶
- Constants
- func DownloadSquawk(ctx context.Context) (string, error)
- func ExecCommand(ctx context.Context, dir, name string, args ...string) ([]byte, error)
- func Files(dir string, maxLines int) error
- func Format(dir string) error
- func Names() []string
- func Run(ctx context.Context, dir string, checks []Check, out io.Writer) error
- type Check
- type Exec
- type Migrations
- type Options
- type Runner
Constants ¶
const DefaultMaxLines = 1000
DefaultMaxLines is the file length limit of taply.
Variables ¶
This section is empty.
Functions ¶
func DownloadSquawk ¶ added in v0.5.8
DownloadSquawk returns the pinned squawk binary, downloading it into the user cache on first use and refusing a file whose digest does not match.
func ExecCommand ¶ added in v0.5.8
ExecCommand is Exec for real commands.
func Files ¶
Files fails when a hand written Go file is longer than maxLines: a file that long is several files that have not been split yet. Generated files are exempt.
Types ¶
type Migrations ¶ added in v0.5.8
type Migrations struct {
Dir string // migrations folder in the project; codegen.MigrationsDir when empty
Against string // base branch; empty lints the files not committed yet
Exec Exec // runs git and squawk
Squawk func(ctx context.Context) (string, error) // path to the squawk binary; DownloadSquawk when nil
}
Migrations lints the goose migrations a branch adds. Migrations already applied are history: the databases lived through them, and a rule added later must not turn every old file red.
type Options ¶
type Options struct {
Skip []string // names of checks to skip
MaxLines int // file length limit; DefaultMaxLines when zero
Against string // base branch: proto breaking changes are checked against it and migrations it lacks are linted
Modules []string // enabled modules
API codegen.APILayout // where the proto files are; zero means the defaults
Exec Exec // runs git and squawk for the migrations check
}
Options select what runs.