Documentation
¶
Index ¶
- func EvaluateSkipIf(s *types.SkipIf, projectRoot string) bool
- func FindExemption(filePath, contractID string) (reason string, found bool)
- type Result
- func CheckCommandAvailable(c *types.CommandAvailCheck) Result
- func CheckEnvVar(c *types.EnvVarCheck) Result
- func CheckKeyFile(path, format string, c *types.KeyCheck) Result
- func CheckNoEnvVar(c *types.EnvVarCheck) Result
- func CheckNoRegexInFile(path, pattern string) Result
- func CheckPathExists(path string, fileType types.PathType) Result
- func CheckPathNotExists(path string) Result
- func CheckRegexInFile(path, pattern string) Result
- func RunCommand(c *types.CommandCheck, cwd string) Result
- func RunScript(c *types.ScriptCheck, cwd string) Result
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EvaluateSkipIf ¶
EvaluateSkipIf returns true if the check should be skipped.
func FindExemption ¶
FindExemption scans a file for an inline exemption comment. Matches: // @contract:C-001:exempt:reason text
# @contract:C-001:exempt:reason text
Types ¶
type Result ¶
Result is an alias for types.Result for package-local convenience.
func CheckCommandAvailable ¶
func CheckCommandAvailable(c *types.CommandAvailCheck) Result
CheckCommandAvailable returns pass if the named binary is found in PATH.
func CheckEnvVar ¶
func CheckEnvVar(c *types.EnvVarCheck) Result
CheckEnvVar returns pass if the named environment variable is set, optionally matching an exact value or regex pattern.
func CheckKeyFile ¶
CheckKeyFile checks a key in a YAML, JSON, or TOML file.
func CheckNoEnvVar ¶
func CheckNoEnvVar(c *types.EnvVarCheck) Result
CheckNoEnvVar returns pass if the named environment variable is not set, or is set but does not match the optional pattern.
func CheckNoRegexInFile ¶
CheckNoRegexInFile returns pass if pattern does NOT match any content in the file. Patterns are compiled in multiline mode so ^ and $ match line boundaries.
func CheckPathExists ¶
CheckPathExists returns pass if the path exists, optionally asserting file or directory type.
func CheckPathNotExists ¶
CheckPathNotExists returns pass if the path does not exist. Returns fail if the path exists or if the stat call fails for an unexpected reason.
func CheckRegexInFile ¶
CheckRegexInFile returns pass if pattern matches any content in the file. Patterns are compiled in multiline mode so ^ and $ match line boundaries.
func RunCommand ¶
func RunCommand(c *types.CommandCheck, cwd string) Result
RunCommand executes a shell command and checks its exit code and optional output.