Documentation
¶
Index ¶
- Variables
- func Register(cfg *Config)
- func ResetDependencyChecker()
- func Unregister()
- type Config
- type DependencyChecker
- type DependencyCheckerPlugin
- func (p *DependencyCheckerPlugin) CheckConsistency(currentVersion string) ([]Inconsistency, error)
- func (p *DependencyCheckerPlugin) Description() string
- func (p *DependencyCheckerPlugin) GetConfig() *Config
- func (p *DependencyCheckerPlugin) IsEnabled() bool
- func (p *DependencyCheckerPlugin) Name() string
- func (p *DependencyCheckerPlugin) SyncVersions(newVersion string) error
- func (p *DependencyCheckerPlugin) Version() string
- type FileConfig
- type Inconsistency
Constants ¶
This section is empty.
Variables ¶
var GetDependencyCheckerFn = func() DependencyChecker {
return defaultDependencyChecker
}
GetDependencyCheckerFn allows overriding the getter function for testing.
var RegisterDependencyCheckerFn = func(dc DependencyChecker) {
defaultDependencyChecker = dc
}
RegisterDependencyCheckerFn allows overriding the registration function for testing.
Functions ¶
func Register ¶
func Register(cfg *Config)
Register initializes the dependency checker plugin with the given configuration.
func ResetDependencyChecker ¶
func ResetDependencyChecker()
ResetDependencyChecker clears the registered dependency checker (for testing).
Types ¶
type Config ¶
type Config struct {
// Enabled controls whether the plugin is active.
Enabled bool
// AutoSync automatically syncs versions after bumps.
AutoSync bool
// Files lists the files to check and sync.
Files []FileConfig
}
Config holds configuration for the dependency checker plugin.
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns the default dependency checker configuration.
type DependencyChecker ¶
type DependencyChecker interface {
Name() string
Description() string
Version() string
// CheckConsistency validates all configured files match the current version.
CheckConsistency(currentVersion string) ([]Inconsistency, error)
// SyncVersions updates all configured files to the new version.
SyncVersions(newVersion string) error
// IsEnabled returns whether the plugin is active.
IsEnabled() bool
// GetConfig returns the plugin configuration.
GetConfig() *Config
}
DependencyChecker defines the interface for dependency version checking.
type DependencyCheckerPlugin ¶
type DependencyCheckerPlugin struct {
// contains filtered or unexported fields
}
DependencyCheckerPlugin implements the DependencyChecker interface.
func NewDependencyChecker ¶
func NewDependencyChecker(cfg *Config) *DependencyCheckerPlugin
NewDependencyChecker creates a new dependency checker plugin with the given configuration.
func (*DependencyCheckerPlugin) CheckConsistency ¶
func (p *DependencyCheckerPlugin) CheckConsistency(currentVersion string) ([]Inconsistency, error)
CheckConsistency validates all configured files match the current version.
func (*DependencyCheckerPlugin) Description ¶
func (p *DependencyCheckerPlugin) Description() string
func (*DependencyCheckerPlugin) GetConfig ¶
func (p *DependencyCheckerPlugin) GetConfig() *Config
GetConfig returns the plugin configuration.
func (*DependencyCheckerPlugin) IsEnabled ¶
func (p *DependencyCheckerPlugin) IsEnabled() bool
IsEnabled returns whether the plugin is active.
func (*DependencyCheckerPlugin) Name ¶
func (p *DependencyCheckerPlugin) Name() string
func (*DependencyCheckerPlugin) SyncVersions ¶
func (p *DependencyCheckerPlugin) SyncVersions(newVersion string) error
SyncVersions updates all configured files to the new version.
func (*DependencyCheckerPlugin) Version ¶
func (p *DependencyCheckerPlugin) Version() string
type FileConfig ¶
type FileConfig struct {
// Path is the file path relative to repository root.
Path string
// Field is the dot-notation path to the version field (for JSON/YAML/TOML).
// Example: "version", "tool.poetry.version", "metadata.version"
Field string
// Format specifies the file format: json, yaml, toml, raw, regex
Format string
// Pattern is the regex pattern for "regex" format.
// Use capturing group for version: e.g., `version = "(.*?)"`
Pattern string
}
FileConfig defines a single file to check/sync.
type Inconsistency ¶
Inconsistency represents a version mismatch in a file.
func (Inconsistency) String ¶
func (i Inconsistency) String() string
String returns a formatted string representation of the inconsistency.