< Summary - go-semantic-release Coverage

Line coverage
100%
Covered lines: 3
Uncovered lines: 0
Coverable lines: 3
Total lines: 60
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
IsRoot0%00100%

File(s)

/home/runner/work/go-semantic-release/go-semantic-release/internal/domain/project.go

#LineLine coverage
 1package domain
 2
 3// ReleaseMode defines whether the repository is released as a whole or per-project.
 4type ReleaseMode string
 5
 6const (
 7  // ReleaseModeRepo performs a single release for the entire repository.
 8  ReleaseModeRepo ReleaseMode = "repo"
 9  // ReleaseModeIndependent versions and releases each project independently.
 10  ReleaseModeIndependent ReleaseMode = "independent"
 11)
 12
 13// ProjectType describes how a project was discovered.
 14type ProjectType string
 15
 16const (
 17  // ProjectTypeGoWorkspace indicates the project was discovered via a go.work file.
 18  ProjectTypeGoWorkspace ProjectType = "go-workspace"
 19  // ProjectTypeGoModule indicates the project was discovered by finding a go.mod file.
 20  ProjectTypeGoModule ProjectType = "go-module"
 21  // ProjectTypeConfigured indicates the project was defined explicitly in the release config.
 22  ProjectTypeConfigured ProjectType = "configured"
 23  // ProjectTypeRoot indicates the project is at the repository root (no path prefix on tags).
 24  ProjectTypeRoot ProjectType = "root"
 25  // ProjectTypeCmdService indicates the project is a deployable binary under cmd/<name>.
 26  ProjectTypeCmdService ProjectType = "cmd-service"
 27  // ProjectTypeCmdLibrary indicates the project is a shared library package (e.g. pkg/<name>)
 28  // imported by one or more cmd services in a single-module monorepo.
 29  ProjectTypeCmdLibrary ProjectType = "cmd-library"
 30)
 31
 32// String returns the string representation of the release mode.
 33func (m ReleaseMode) String() string {
 34  return string(m)
 35}
 36
 37// String returns the string representation of the project type.
 38func (pt ProjectType) String() string {
 39  return string(pt)
 40}
 41
 42// Project represents a versioned unit within a repository.
 43type Project struct {
 44  Name string
 45  // Path is the relative path from the repository root (e.g. "services/auth-server").
 46  // It should always be a relative path; IsRoot handles ".", "", and "/" defensively.
 47  Path          string
 48  Type          ProjectType
 49  ModulePath    string   // Go module path if applicable
 50  Dependencies  []string // names of projects this depends on
 51  TagPrefix     string   // e.g. "myproject/" for tags like "myproject/v1.2.3"
 52  ChangelogFile string   // per-project changelog filename, relative to the project's path; empty means use global
 53}
 54
 55// IsRoot returns true if this project represents the repository root.
 56// The "/" case is defensive — Path should always be a relative path ("." or ""),
 57// but we guard against an absolute-path misuse rather than silently misbehaving.
 558func (p Project) IsRoot() bool {
 559  return p.Path == "." || p.Path == "" || p.Path == "/"
 560}

Methods/Properties

IsRoot