Documentation
¶
Index ¶
- type CIWorkflowCheck
- type ChangelogCheck
- type Check
- type CodeownersCheck
- type ContributingCheck
- type Finding
- type GitIgnoreCheck
- type Guidance
- type JavaScriptFrameworkCheck
- type Level
- type LicenseCheck
- type ManifestCheck
- type Options
- type PythonProjectCheck
- type ReadmeCheck
- type ReadmeLinksCheck
- type SecurityPolicyCheck
- type StaticSiteCheck
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CIWorkflowCheck ¶ added in v0.2.0
type CIWorkflowCheck struct{}
CIWorkflowCheck ensures the repository has at least one workflow in .github/workflows.
func (CIWorkflowCheck) Description ¶ added in v0.2.0
func (CIWorkflowCheck) Description() string
func (CIWorkflowCheck) Key ¶ added in v0.2.0
func (CIWorkflowCheck) Key() string
type ChangelogCheck ¶
type ChangelogCheck struct{}
ChangelogCheck ensures a project includes a CHANGELOG.md file. A changelog helps consumers understand what changed across versions.
Behavior
- If CHANGELOG.md exists, no findings are emitted.
- If missing, a warning is reported with guidance.
func (ChangelogCheck) Description ¶
func (ChangelogCheck) Description() string
Description provides a one-line explanation of this check.
func (ChangelogCheck) Key ¶
func (ChangelogCheck) Key() string
Key returns the unique identifier for this check.
type Check ¶
type Check interface {
Key() string
Description() string
Run(ctx context.Context, root string, opts Options) ([]Finding, error)
}
Check is the interface that all yardstick checks must implement.
Each check:
- returns a unique Key identifying itself.
- provides a Description for listing and documentation.
- implements Run, which performs the check and returns one or more Findings.
Example usage pattern:
type MyCheck struct {}
func (MyCheck) Key() string { return "mycheck" }
func (MyCheck) Description() string { return "verifies something important" }
func (MyCheck) Run(ctx context.Context, root string, opts Options) ([]Finding, error) {
// perform validation logic here
return []Finding{{Check: "mycheck", Level: LevelWarn, Message: "example"}}, nil
}
func All ¶
func All() []Check
All returns the complete list of registered checks.
This registry is how yardstick discovers which checks to execute. Each check implements the Check interface (see types.go), and must be explicitly listed here to be included in the scanning process.
When you create a new check:
- Define it in a new file under internal/checks (e.g., mycheck.go).
- Implement the Check interface (Key, Description, Run).
- Add an instance to the slice below.
Keeping this list explicit helps ensure that all checks are intentionally loaded, rather than automatically discovered, which improves predictability and makes CI output easier to reason about.
type CodeownersCheck ¶ added in v0.2.0
type CodeownersCheck struct{}
CodeownersCheck ensures a repository defines ownership rules in CODEOWNERS.
func (CodeownersCheck) Description ¶ added in v0.2.0
func (CodeownersCheck) Description() string
func (CodeownersCheck) Key ¶ added in v0.2.0
func (CodeownersCheck) Key() string
type ContributingCheck ¶ added in v0.2.0
type ContributingCheck struct{}
ContributingCheck ensures contribution guidelines are present.
func (ContributingCheck) Description ¶ added in v0.2.0
func (ContributingCheck) Description() string
func (ContributingCheck) Key ¶ added in v0.2.0
func (ContributingCheck) Key() string
type Finding ¶
type Finding struct {
// Check is the unique key of the check that produced this finding.
Check string `json:"check"`
// Level indicates how severe the finding is (info, warn, or error).
Level Level `json:"level"`
// Path points to the file or directory the finding concerns.
// For project-wide findings, this may be the repository root path.
Path string `json:"path"`
// Message provides a short human-readable description of the issue.
Message string `json:"message"`
// Fixed is true if the issue was automatically corrected when --fix was used.
Fixed bool `json:"fixed"`
}
Finding describes the result of a single check. It represents one piece of evidence found by a rule execution.
type GitIgnoreCheck ¶
type GitIgnoreCheck struct{}
GitIgnoreCheck ensures a repository has a .gitignore file with a reasonable starter set of entries. This avoids committing build artifacts, editor settings, and OS files.
Behavior
- If .gitignore exists, no findings are emitted.
- If missing, a warning is reported with guidance.
func (GitIgnoreCheck) Description ¶
func (GitIgnoreCheck) Description() string
Description provides a short explanation of what this check validates.
func (GitIgnoreCheck) Key ¶
func (GitIgnoreCheck) Key() string
Key returns the unique identifier for this check.
type Guidance ¶ added in v0.3.0
Guidance captures why a check matters and how to resolve failures.
func GuidanceForCheck ¶ added in v0.3.0
GuidanceForCheck returns guidance for a check key.
type JavaScriptFrameworkCheck ¶ added in v0.4.0
type JavaScriptFrameworkCheck struct{}
JavaScriptFrameworkCheck validates baseline structure for JavaScript framework projects. It applies broad checks for framework projects and adds Next.js-specific compatibility checks.
func (JavaScriptFrameworkCheck) Description ¶ added in v0.4.0
func (JavaScriptFrameworkCheck) Description() string
func (JavaScriptFrameworkCheck) Key ¶ added in v0.4.0
func (JavaScriptFrameworkCheck) Key() string
type Level ¶
type Level string
Level represents the severity level of a finding. Each check can report results at different levels depending on importance. - info: informational, no action required. - warn: something is suboptimal but not a failure. - error: policy violation or missing critical element.
type LicenseCheck ¶
type LicenseCheck struct{}
LicenseCheck ensures that a LICENSE file is present in the repository.
Licensing clarity is essential for both internal and external code sharing. This check verifies that a LICENSE file exists. Yardstick is read-only and does not create files; it provides guidance when the license is missing.
func (LicenseCheck) Description ¶
func (LicenseCheck) Description() string
Description provides a short explanation of what this check validates.
func (LicenseCheck) Key ¶
func (LicenseCheck) Key() string
Key returns the unique identifier for this check.
type ManifestCheck ¶
type ManifestCheck struct{}
ManifestCheck attempts to detect a project's primary ecosystem by looking for common manifest files. It is intentionally neutral so yardstick can be used across Go, Node, Python, Ruby, Rust, and static site projects.
Behavior
- If a known manifest is found, emit an info finding stating which ecosystem was detected and which file triggered it.
- If no known manifests are found, emit a warn finding suggesting the user add an appropriate manifest for their stack.
- This check does not auto-create manifests, since that choice is project specific and harder to do safely.
Extending detection
- Add new entries to the candidates slice with the filename and a short label. Keep the check simple and fast.
- If needed later, we can add per-ecosystem subchecks, for example NodeLockfileCheck, PythonVenvCheck, etc.
Examples of files detected
- Go: go.mod
- Node: package.json
- Python: pyproject.toml or requirements.txt
- Ruby: Gemfile
- Rust: Cargo.toml
- PHP: composer.json
- Static: _config.yml, .eleventy.js, mkdocs.yml
- Docs only: README.md without a manifest will still pass other checks but this one will warn.
func (ManifestCheck) Description ¶
func (ManifestCheck) Description() string
Description provides a short explanation of what this check validates.
func (ManifestCheck) Key ¶
func (ManifestCheck) Key() string
Key returns the unique identifier for this check.
type Options ¶
type Options struct {
// AutoFix is reserved for potential future use. Yardstick is read-only
// and does not write; checks must not modify files regardless of this flag.
AutoFix bool
}
Options contains runtime flags passed into each check. Used to control whether a check should attempt auto-remediation.
type PythonProjectCheck ¶ added in v0.4.0
type PythonProjectCheck struct{}
PythonProjectCheck validates baseline conventions for Python projects.
func (PythonProjectCheck) Description ¶ added in v0.4.0
func (PythonProjectCheck) Description() string
func (PythonProjectCheck) Key ¶ added in v0.4.0
func (PythonProjectCheck) Key() string
type ReadmeCheck ¶
type ReadmeCheck struct{}
ReadmeCheck verifies that a project contains a README.md file and that it includes key sections for documentation consistency.
This check encourages projects to maintain minimal structure for clarity when others view the repository, ensuring discoverability and maintainability.
func (ReadmeCheck) Description ¶
func (ReadmeCheck) Description() string
Description provides a one-line explanation of what this check does.
func (ReadmeCheck) Key ¶
func (ReadmeCheck) Key() string
Key returns the unique identifier for this check.
type ReadmeLinksCheck ¶ added in v0.2.0
type ReadmeLinksCheck struct{}
ReadmeLinksCheck validates local links in README.md.
func (ReadmeLinksCheck) Description ¶ added in v0.2.0
func (ReadmeLinksCheck) Description() string
func (ReadmeLinksCheck) Key ¶ added in v0.2.0
func (ReadmeLinksCheck) Key() string
type SecurityPolicyCheck ¶ added in v0.2.0
type SecurityPolicyCheck struct{}
SecurityPolicyCheck ensures a repository provides a vulnerability disclosure policy.
func (SecurityPolicyCheck) Description ¶ added in v0.2.0
func (SecurityPolicyCheck) Description() string
func (SecurityPolicyCheck) Key ¶ added in v0.2.0
func (SecurityPolicyCheck) Key() string
type StaticSiteCheck ¶
type StaticSiteCheck struct{}
StaticSiteCheck validates minimal structure for static-site projects. Currently focuses on Jekyll-style repos (detected via _config.yml). If no static-site config is detected, this check is a no-op.
func (StaticSiteCheck) Description ¶
func (StaticSiteCheck) Description() string
func (StaticSiteCheck) Key ¶
func (StaticSiteCheck) Key() string