Documentation ¶
Index ¶
Constants ¶
const ( // MethodHasVersion checks whether a method specifies a version. MethodHasVersion = "method_has_version" // MethodHasCorrectInputName checks if the method input is named correctly. MethodHasCorrectInputName = "method_has_correct_input_name" // MethodHasHTTPPath checks if an HTTP path is specified for the method. MethodHasHTTPPath = "method_has_http_path" // MethodHasBodyTag checks if methods with a required body have the correct body tag. MethodHasBodyTag = "method_has_body_tag" // MethodHasSwaggerTags checks if a method has appropriate Swagger tags. MethodHasSwaggerTags = "method_has_swagger_tags" // MethodHasSwaggerSummary checks if a method has a valid Swagger summary. MethodHasSwaggerSummary = "method_has_swagger_summary" // MethodHasSwaggerDescription checks if a method has a valid Swagger description. MethodHasSwaggerDescription = "method_has_swagger_description" // FieldHasCorrectJSONName checks if a field's JSON name tag is correct. FieldHasCorrectJSONName = "field_has_correct_json_name" // FieldHasNoDescription checks if a field has no description. FieldHasNoDescription = "field_has_no_description" // FieldDescriptionStartsWithCapital checks if a field's description starts with a capital letter. FieldDescriptionStartsWithCapital = "field_description_starts_with_capital" // FieldDescriptionEndsWithDot checks if a field's description ends with a dot. FieldDescriptionEndsWithDot = "field_description_ends_with_dot" // EnumValueHasComments checks if an enum value has leading comments. EnumValueHasComments = "enum_value_has_comments" )
Variables ¶
This section is empty.
Functions ¶
func ExecuteCheck ¶
ExecuteCheck runs the "check" subcommand.
func ExecuteListProtoFullNames ¶
func ExecuteListProtoFullNames(patterns []string)
ExecuteListProtoFullNames runs the "lint" subcommand.
Types ¶
type CheckResult ¶
type CheckResult struct { File linker.File // Checked file. Messages []string // List of informational messages related to the file. Errors []string // List of errors. If empty, the check is considered successful. // contains filtered or unexported fields }
CheckResult holds the results of checking a single protobuf file.
func NewCheckResult ¶
func NewCheckResult(parsedFile linker.File, cfg *config.Config) *CheckResult
NewCheckResult creates a new CheckResult based on the given parsed file and configuration.
func (*CheckResult) AddError ¶
func (c *CheckResult) AddError(desc protoreflect.Descriptor, v string)
AddError appends an error message to the CheckResult's errors.
func (*CheckResult) AddErrorf ¶
func (c *CheckResult) AddErrorf(desc protoreflect.Descriptor, format string, args ...any)
AddErrorf appends a formatted error message to the CheckResult's errors.
func (*CheckResult) AddMessage ¶
func (c *CheckResult) AddMessage(v string)
AddMessage appends an informational message to the CheckResult's messages.
func (*CheckResult) AddMessagef ¶
func (c *CheckResult) AddMessagef(format string, args ...any)
AddMessagef appends a formatted informational message to the CheckResult's messages.
type ListResult ¶
type ListResult struct { File linker.File // Analyzed file. Messages []string // List of full protobuf element names found in the file. // contains filtered or unexported fields }
ListResult holds the results of listing full protobuf element names.
func NewListResult ¶
func NewListResult(parsedFile linker.File, cfg *config.Config) *ListResult
NewListResult creates a new ListResult based on the given parsed file and configuration.
func (*ListResult) AddMessage ¶
func (c *ListResult) AddMessage(v string)
AddMessage appends an informational message to the ListResult's messages.
func (*ListResult) AddMessagef ¶
func (c *ListResult) AddMessagef(format string, args ...interface{})
AddMessagef appends a formatted informational message to the ListResult's messages.
type MimirConfig ¶
type MimirConfig struct {
ProtoPaths []string `yaml:"proto_paths"`
}
MimirConfig defines the structure of the mimir file.
type ProtoChecker ¶
type ProtoChecker struct {
// contains filtered or unexported fields
}
ProtoChecker represents a structure that wraps the compiler and parser for protobuf files.
func NewProtoChecker ¶
func NewProtoChecker(ctx context.Context, cfg *config.Config) *ProtoChecker
NewProtoChecker creates a new ProtoChecker instance.
func (*ProtoChecker) CheckFiles ¶
func (c *ProtoChecker) CheckFiles(ctx context.Context, files ...string) ([]*CheckResult, error)
CheckFiles performs checks on the provided protobuf files and returns a list of CheckResult instances, each containing the checking results for a single file. It uses the compiler and parser associated with the ProtoChecker instance.
func (*ProtoChecker) ListFullNamesFromFiles ¶
func (c *ProtoChecker) ListFullNamesFromFiles(ctx context.Context, files ...string) ([]*ListResult, error)
ListFullNamesFromFiles performs checks on the provided protobuf files and returns a list of CheckResult instances, each containing the checking results for a single file. It uses the compiler and parser associated with the ProtoChecker instance.