Documentation
¶
Index ¶
- Variables
- func DetectFormat(content string) string
- func Register(cfg *Config)
- func ResetChangelogParser()
- func Unregister()
- func ValidFormats() []string
- type ChangelogInferrer
- type ChangelogParserPlugin
- func (p *ChangelogParserPlugin) Description() string
- func (p *ChangelogParserPlugin) GetConfig() *Config
- func (p *ChangelogParserPlugin) GetFormat() string
- func (p *ChangelogParserPlugin) InferBumpType() (string, error)
- func (p *ChangelogParserPlugin) InferBumpTypeWithConfidence() (bumpType, confidence string, err error)
- func (p *ChangelogParserPlugin) IsEnabled() bool
- func (p *ChangelogParserPlugin) Name() string
- func (p *ChangelogParserPlugin) ShouldTakePrecedence() bool
- func (p *ChangelogParserPlugin) ValidateHasEntries() error
- func (p *ChangelogParserPlugin) Version() string
- type ChangelogSection
- type Config
- type ParsedEntry
- type ParsedSection
- type Parser
- type UnreleasedSection
Constants ¶
This section is empty.
Variables ¶
var ( RegisterChangelogParserFn = registerChangelogParser GetChangelogParserFn = getChangelogParser )
Functions ¶
func DetectFormat ¶ added in v0.8.0
DetectFormat is exported for testing purposes.
func Register ¶
func Register(cfg *Config)
Register registers the changelog parser plugin with the sley plugin system.
func ResetChangelogParser ¶
func ResetChangelogParser()
ResetChangelogParser clears the registered changelog parser (for testing).
func ValidFormats ¶ added in v0.8.0
func ValidFormats() []string
ValidFormats returns the list of valid parser format names.
Types ¶
type ChangelogInferrer ¶
type ChangelogInferrer interface {
Name() string
Description() string
Version() string
InferBumpType() (string, error)
ValidateHasEntries() error
}
ChangelogInferrer defines the interface for parsing changelog files.
type ChangelogParserPlugin ¶
type ChangelogParserPlugin struct {
// contains filtered or unexported fields
}
ChangelogParserPlugin implements the ChangelogInferrer interface.
func NewChangelogParser ¶
func NewChangelogParser(cfg *Config) *ChangelogParserPlugin
NewChangelogParser creates a new changelog parser plugin.
func (*ChangelogParserPlugin) Description ¶
func (p *ChangelogParserPlugin) Description() string
func (*ChangelogParserPlugin) GetConfig ¶
func (p *ChangelogParserPlugin) GetConfig() *Config
func (*ChangelogParserPlugin) GetFormat ¶ added in v0.8.0
func (p *ChangelogParserPlugin) GetFormat() string
GetFormat returns the configured format.
func (*ChangelogParserPlugin) InferBumpType ¶
func (p *ChangelogParserPlugin) InferBumpType() (string, error)
InferBumpType parses the changelog and infers the bump type.
func (*ChangelogParserPlugin) InferBumpTypeWithConfidence ¶ added in v0.8.0
func (p *ChangelogParserPlugin) InferBumpTypeWithConfidence() (bumpType, confidence string, err error)
InferBumpTypeWithConfidence returns bump type and confidence level.
func (*ChangelogParserPlugin) IsEnabled ¶
func (p *ChangelogParserPlugin) IsEnabled() bool
func (*ChangelogParserPlugin) Name ¶
func (p *ChangelogParserPlugin) Name() string
func (*ChangelogParserPlugin) ShouldTakePrecedence ¶
func (p *ChangelogParserPlugin) ShouldTakePrecedence() bool
ShouldTakePrecedence returns true if changelog parser should take precedence.
func (*ChangelogParserPlugin) ValidateHasEntries ¶
func (p *ChangelogParserPlugin) ValidateHasEntries() error
ValidateHasEntries validates that the Unreleased section has entries.
func (*ChangelogParserPlugin) Version ¶
func (p *ChangelogParserPlugin) Version() string
type ChangelogSection ¶
ChangelogSection represents a parsed section from CHANGELOG.md.
type Config ¶
type Config struct {
Enabled bool
Path string
RequireUnreleasedSection bool
InferBumpType bool
Priority string
Format string
GroupedSectionMap map[string]string
}
Config holds configuration for the changelog parser plugin.
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns the default changelog parser configuration.
type ParsedEntry ¶ added in v0.8.0
type ParsedEntry struct {
Category string // Semantic: Added, Changed, Fixed, Removed, etc.
OriginalSection string // As it appeared in changelog
Description string // Entry text (cleaned)
Scope string // Optional scope
IsBreaking bool
CommitType string // Original type if parseable
}
ParsedEntry represents a single changelog entry.
type ParsedSection ¶ added in v0.8.0
type ParsedSection struct {
Version string
Date string
HasEntries bool
Entries []ParsedEntry
InferredBumpType string // major, minor, patch, or empty
BumpTypeConfidence string // high, medium, low, none
}
ParsedSection represents a parsed changelog section (format-agnostic).
type Parser ¶ added in v0.8.0
type Parser interface {
// ParseUnreleased extracts the Unreleased/latest version section.
ParseUnreleased(reader io.Reader) (*ParsedSection, error)
// Format returns the format name this parser handles.
Format() string
}
Parser defines the interface for changelog format parsers.
type UnreleasedSection ¶
type UnreleasedSection struct {
HasEntries bool
Added []string
Changed []string
Deprecated []string
Removed []string
Fixed []string
Security []string
Subsections map[string][]string
}
UnreleasedSection represents the parsed Unreleased section with change types.
func FromParsedSection ¶ added in v0.8.0
func FromParsedSection(ps *ParsedSection) *UnreleasedSection
FromParsedSection creates UnreleasedSection from ParsedSection.
func (*UnreleasedSection) InferBumpType ¶
func (s *UnreleasedSection) InferBumpType() (string, error)
InferBumpType determines the bump type based on changelog entries.
func (*UnreleasedSection) ToParsedSection ¶ added in v0.8.0
func (s *UnreleasedSection) ToParsedSection() *ParsedSection
ToParsedSection converts UnreleasedSection to format-agnostic ParsedSection.