utils

package
v0.1.60 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 6, 2026 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanOriginPath added in v0.1.47

func CleanOriginPath(location string) string

CleanOriginPath normalizes a GitLab include/component path by stripping the version suffix and instance URL prefix, producing a bare path suitable for comparison (e.g. "components/sast/sast").

func DetectGitRepoRoot added in v0.1.41

func DetectGitRepoRoot() string

DetectGitRepoRoot returns the absolute path to the root of the current git repository. Returns an empty string if not in a git repository.

func GenerateFNVHash

func GenerateFNVHash(data []byte) uint64

GenerateFNVHash generates a 64-bit FNV-1a hash from the input bytes

Types

type GitRemoteInfo added in v0.1.30

type GitRemoteInfo struct {
	Host        string // e.g., "gitlab.com" or "gitlab.example.com"
	ProjectPath string // e.g., "group/project" or "group/subgroup/project"
	URL         string // The full GitLab URL, e.g., "https://gitlab.com"
	RepoRoot    string // Absolute path to the git repository root
}

GitRemoteInfo contains parsed information from a git remote URL

func DetectGitRemote added in v0.1.30

func DetectGitRemote() *GitRemoteInfo

DetectGitRemote attempts to detect GitLab URL and project path from git remote. It tries the "origin" remote first. Returns nil if detection fails (not a git repo, no remote, not a GitLab URL, etc.)

func ParseGitRemoteURL added in v0.1.30

func ParseGitRemoteURL(remoteURL string) *GitRemoteInfo

ParseGitRemoteURL parses a git remote URL and extracts host and project path. Supports the following formats:

  • SSH URL: ssh://git@host[:port]/group/project.git
  • SSH SCP-like: git@host:group/project.git
  • HTTPS: https://host[:port]/group/project.git
  • Git protocol: git://host[:port]/group/project.git

Returns nil if the URL cannot be parsed.

type OverriddenJobDetail added in v0.1.47

type OverriddenJobDetail struct {
	JobName        string   `json:"jobName"`
	OverriddenKeys []string `json:"overriddenKeys"`
}

OverriddenJobDetail captures which job was overridden and with which forbidden CI/CD keywords. Shared across control (detection) and pbom (reporting) packages.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL