lint

package
v0.1.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 3, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package lint provides the core functionality of easyp lint.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrServiceCommentIsEmpty        = errors.New("service comment is empty")
	ErrPackageIsNotDefined          = errors.New("package is not defined")
	ErrPackageIsNotMatchedWithPath  = errors.New("package is not matched with the path")
	ErrRPCCommentIsEmpty            = errors.New("rpc comment is empty")
	ErrEnumCommentIsEmpty           = errors.New("enum comment is empty")
	ErrOneOfCommentIsEmpty          = errors.New("oneof comment is empty")
	ErrMessageCommentIsEmpty        = errors.New("message comment is empty")
	ErrMessageFieldCommentIsEmpty   = errors.New("message field comment is empty")
	ErrEnumValueCommentIsEmpty      = errors.New("enum value comment is empty")
	ErrEnumPascalCase               = errors.New("enum is not pascal case")
	ErrEnumValueUpperSnakeCase      = errors.New("enum value is not upper snake case")
	ErrRpcPascalCase                = errors.New("rpc is not pascal case")
	ErrServicePascalCase            = errors.New("service is not pascal case")
	ErrEnumFirstValueZero           = errors.New("enum first value is not zero")
	ErrDirectorySamePackage         = errors.New("different proto files in the same directory should have the same package")
	ErrMessagePascalCase            = errors.New("message is not pascal case")
	ErrMessageFieldLowerSnakeCase   = errors.New("message field is not lower snake case")
	ErrOneofLowerSnakeCase          = errors.New("oneof is not lower snake case")
	ErrPackageLowerSnakeCase        = errors.New("package is not lower snake case")
	ErrPackageSameDirectory         = errors.New("different proto files in the same package should be in the same directory")
	ErrEnumNoAllowAlias             = errors.New("enum no allow alias")
	ErrImportIsPublic               = errors.New("import is public")
	ErrImportIsWeak                 = errors.New("import is weak")
	ErrEnumValuePrefix              = errors.New("enum value prefix is not valid")
	ErrEnumZeroValueSuffix          = errors.New("enum zero value suffix is not valid")
	ErrFileLowerSnakeCase           = errors.New("file is not lower snake case")
	ErrRPCRequestResponseUnique     = errors.New("rpc request and response should be unique")
	ErrRPCRequestStandardName       = errors.New("rpc request should have suffix 'Request'")
	ErrRPCResponseStandardName      = errors.New("rpc response should have suffix 'Response'")
	ErrPackageVersionSuffix         = errors.New("package version suffix is not valid")
	ErrServiceSuffix                = errors.New("service name should have suffix")
	ErrRPCClientStreaming           = errors.New("rpc client streaming is forbidden")
	ErrRPCServerStreaming           = errors.New("rpc server streaming is forbidden")
	ErrImportIsNotUsed              = errors.New("import is not used")
	ErrPackageSameCSharpNamespace   = errors.New("different proto files in the same package should have the same csharp_namespace")
	ErrPackageSameGoPackage         = errors.New("different proto files in the same package should have the same go_package")
	ErrPackageSameJavaMultipleFiles = errors.New("different proto files in the same package should have the same java_multiple_files")
	ErrPackageSameJavaPackage       = errors.New("different proto files in the same package should have the same java_package")
	ErrPackageSamePhpNamespace      = errors.New("different proto files in the same package should have the same php_namespace")
	ErrPackageSameRubyPackage       = errors.New("different proto files in the same package should have the same ruby_package")
	ErrPackageSameSwiftPrefix       = errors.New("different proto files in the same package should have the same swift_prefix")
)

Comment errors.

View Source
var (
	ErrInvalidRule = errors.New("invalid rule")
)

Functions

This section is empty.

Types

type Lint

type Lint struct {
	// contains filtered or unexported fields
}

Lint is the core functionality of easyp lint.

func New

func New(rules []Rule, rootPath string, excludesDirs []string) *Lint

New creates a new Lint.

func (*Lint) Lint

func (c *Lint) Lint(ctx context.Context, disk fs.FS) error

Lint lints the proto file.

type ProtoInfo

type ProtoInfo struct {
	Path string
	Info *unordered.Proto
}

ProtoInfo is the information of a proto file.

type Rule

type Rule interface {
	// Validate validates the proto rule.
	Validate(ProtoInfo) []error
}

Rule is an interface for a rule checking.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL