Documentation
¶
Overview ¶
Package core contains every logic for working cli.
Index ¶
- Variables
- func CheckIsIgnored(comments []*parser.Comment, ruleName string) bool
- func GetRuleName(rule Rule) string
- func SetAllowCommentIgnores(val bool)
- type BUFConfig
- type Breaking
- type Build
- type Config
- type Console
- type Core
- func (c *Core) Download(ctx context.Context, dependencies []string) error
- func (c *Core) Generate(ctx context.Context, root, directory string) error
- func (c *Core) Get(ctx context.Context, requestedModule models.Module) error
- func (i *Core) Initialize(ctx context.Context, disk FS, defaultLinters []string) error
- func (c *Core) Lint(ctx context.Context, disk fs.FS, path string) ([]IssueInfo, error)
- func (c *Core) Update(ctx context.Context, dependencies []string) error
- func (c *Core) Vendor(ctx context.Context) error
- type EasyPConfig
- type FS
- type ImportPath
- type Inputs
- type InstructionInfo
- type InstructionParser
- type Issue
- type IssueInfo
- type Lint
- type LockFile
- type Migrate
- type ModuleConfig
- type OpenImportFileError
- type Plugin
- type ProtoInfo
- type Query
- type Rule
- type Storage
Constants ¶
This section is empty.
Variables ¶
var (
ErrInvalidRule = errors.New("invalid rule")
)
Functions ¶
func CheckIsIgnored ¶
CheckIsIgnored check if passed ruleName has to be ignored due to ignore command in comments
func SetAllowCommentIgnores ¶
func SetAllowCommentIgnores(val bool)
Types ¶
type BUFConfig ¶
type BUFConfig struct { Version string `yaml:"version"` Deps []string `yaml:"deps"` Build Build `yaml:"build"` Lint Lint `yaml:"lint"` Breaking Breaking `yaml:"breaking"` }
BUFConfig is the configuration for the buf tool.
type Breaking ¶
type Breaking struct { Use []string `yaml:"use"` Except []string `yaml:"except"` Ignore []string `yaml:"ignore"` IgnoreOnly map[string][]string `yaml:"ignore_only"` IgnoreUnstablePackages bool `yaml:"ignore_unstable_packages"` }
Breaking is the configuration for the breaking section of the buf tool.
type Build ¶
type Build struct {
Excludes []string `yaml:"excludes"`
}
Build is the configuration for the build section of the buf tool.
type Config ¶
type Config struct { Deps []string Plugins []Plugin Inputs Inputs ModuleReflect *modulereflect.ModuleReflect }
Config is the configuration for EasyP generate.
type Console ¶
type Console interface {
RunCmd(ctx context.Context, dir string, command string, commandParams ...string) (string, error)
}
Console is provide to terminal command in console.
type Core ¶
type Core struct {
// contains filtered or unexported fields
}
Core provide to business logic of EasyP.
func (*Core) Download ¶
Download all packages from config dependencies slice of strings format: origin@version: github.com/company/repository@v1.2.3 if version is absent use the latest commit
func (*Core) Initialize ¶
Initialize initializes the EasyP configuration.
type EasyPConfig ¶
type EasyPConfig struct { Version string `yaml:"version"` Deps []string `yaml:"deps"` Build Build `yaml:"build"` Lint Lint `yaml:"lint"` Breaking Breaking `yaml:"breaking"` }
EasyPConfig is the configuration for EasyP.
type ImportPath ¶
type ImportPath string
ImportPath type alias for path import in proto file
func ConvertImportPath ¶
func ConvertImportPath(source string) ImportPath
type InstructionInfo ¶
instructionInfo collects info about instruction in proto file e.g `google.api.http`:
`google.api` - package name 'http' - instruction name
func (InstructionInfo) GetFullName ¶
func (i InstructionInfo) GetFullName() string
type InstructionParser ¶
type InstructionParser struct {
SourcePkgName string
}
parseInstruction parse input string and return its package name if passed input does not have package -> return pkgName as package name source proto file
func (InstructionParser) Parse ¶
func (p InstructionParser) Parse(input string) InstructionInfo
type Lint ¶
type Lint struct { Use []string `yaml:"use"` Except []string `yaml:"except"` Ignore []string `yaml:"ignore"` IgnoreOnly map[string][]string `yaml:"ignore_only"` AllowCommentIgnores bool `yaml:"allow_comment_ignores"` EnumZeroValueSuffix string `yaml:"enum_zero_value_suffix"` RPCAllowSameRequestResponse bool `yaml:"rpc_allow_same_request_response"` RPCAllowGoogleProtobufEmptyRequests bool `yaml:"rpc_allow_google_protobuf_empty_requests"` RPCAllowGoogleProtobufEmptyResponses bool `yaml:"rpc_allow_google_protobuf_empty_responses"` ServiceSuffix string `yaml:"service_suffix"` }
Lint is the configuration for the lint section of the buf tool.
type LockFile ¶
type LockFile interface { Read(moduleName string) (models.LockFileInfo, error) Write( moduleName string, revisionVersion string, installedPackageHash models.ModuleHash, ) error IsEmpty() bool DepsIter() iter.Seq[models.LockFileInfo] }
LockFile should implement adapter for lock file workflow
type Migrate ¶
type Migrate struct {
BUF *BUFConfig
}
Migrate contains original configuration for the migration.
type ModuleConfig ¶
type ModuleConfig interface {
ReadFromRepo(ctx context.Context, repo repository.Repo, revision models.Revision) (models.ModuleConfig, error)
}
ModuleConfig should implement adapter for reading module configs
type OpenImportFileError ¶
type OpenImportFileError struct {
FileName string
}
func (*OpenImportFileError) Error ¶
func (e *OpenImportFileError) Error() string
type ProtoInfo ¶
type ProtoInfo struct { Path string Info *unordered.Proto ProtoFilesFromImport map[ImportPath]*unordered.Proto }
ProtoInfo is the information of a proto file.
type Rule ¶
type Rule interface { // Message returns the message of the rule. Message() string // Validate validates the proto rule. Validate(ProtoInfo) ([]Issue, error) }
Rule is an interface for a rule checking.
type Storage ¶
type Storage interface { CreateCacheRepositoryDir(name string) (string, error) CreateCacheDownloadDir(models.CacheDownloadPaths) error GetCacheDownloadPaths(module models.Module, revision models.Revision) models.CacheDownloadPaths Install( cacheDownloadPaths models.CacheDownloadPaths, module models.Module, revision models.Revision, moduleConfig models.ModuleConfig, ) (models.ModuleHash, error) GetInstalledModuleHash(moduleName string, revisionVersion string) (models.ModuleHash, error) IsModuleInstalled(module models.Module) (bool, error) }
Storage should implement workflow with storage adapter