options

package
v4.13.1 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2023 License: Apache-2.0 Imports: 9 Imported by: 3

Documentation

Overview

Package options implements Scorecard options.

Index

Constants

View Source
const (
	// FlagRepo is the flag name for specifying a repository.
	FlagRepo = "repo"

	// FlagLocal is the flag name for specifying a local run.
	FlagLocal = "local"

	// FlagCommit is the flag name for specifying a commit.
	FlagCommit = "commit"

	// FlagLogLevel is the flag name for specifying the log level.
	FlagLogLevel = "verbosity"

	// FlagNPM is the flag name for specifying a NPM repository.
	FlagNPM = "npm"

	// FlagPyPI is the flag name for specifying a PyPI repository.
	FlagPyPI = "pypi"

	// FlagRubyGems is the flag name for specifying a RubyGems repository.
	FlagRubyGems = "rubygems"

	// FlagNuget is the flag name for specifying a Nuget repository.
	FlagNuget = "nuget"

	// FlagMetadata is the flag name for specifying metadata for the project.
	FlagMetadata = "metadata"

	// FlagShowDetails is the flag name for outputting additional check info.
	FlagShowDetails = "show-details"

	// FlagChecks is the flag name for specifying which checks to run.
	FlagChecks = "checks"

	// FlagPolicyFile is the flag name for specifying a policy file.
	FlagPolicyFile = "policy"

	// FlagFormat is the flag name for specifying output format.
	FlagFormat = "format"

	// FlagResultsFile is the flag name for specifying output file.
	FlagResultsFile = "output"

	// ShorthandFlagResultsFile is the shorthand flag name for specifying output file.
	ShorthandFlagResultsFile = "o"

	FlagCommitDepth = "commit-depth"
)
View Source
const (
	// DefaultCommit specifies the default commit reference to use.
	DefaultCommit = clients.HeadSHA

	// Formats.
	// FormatJSON specifies that results should be output in JSON format.
	FormatJSON = "json"
	// FormatFJSON specifies that results should be output in JSON format,
	// but with structured findings.
	FormatFJSON = "finding"
	// FormatPJSON specifies that results should be output in probe JSON format.
	FormatPJSON = "probe"
	// FormatSJSON specifies that results should be output in structured JSON format.
	FormatSJSON = "structured"
	// FormatSarif specifies that results should be output in SARIF format.
	FormatSarif = "sarif"
	// FormatDefault specifies that results should be output in default format.
	FormatDefault = "default"
	// FormatRaw specifies that results should be output in raw format.
	FormatRaw = "raw"

	// Environment variables.
	// EnvVarEnableSarif is the environment variable which controls enabling
	// SARIF logging.
	EnvVarEnableSarif = "ENABLE_SARIF"
	// EnvVarScorecardV6 is the environment variable which enables scorecard v6
	// options.
	EnvVarScorecardV6 = "SCORECARD_V6"
	// EnvVarScorecardExperimental is the environment variable which enables experimental
	// features.
	EnvVarScorecardExperimental = "SCORECARD_EXPERIMENTAL"
)

Variables

View Source
var (
	// DefaultLogLevel retrieves the default log level.
	DefaultLogLevel = log.DefaultLevel.String()
)

Functions

This section is empty.

Types

type Command

type Command interface {
	// AddFlags adds this options' flags to the cobra command.
	AddFlags(cmd *cobra.Command)
}

Command is an interface for handling options for command-line utilities.

type Options

type Options struct {
	Repo        string
	Local       string
	Commit      string
	LogLevel    string
	Format      string
	NPM         string
	PyPI        string
	RubyGems    string
	Nuget       string
	PolicyFile  string
	ResultsFile string
	ChecksToRun []string
	Metadata    []string
	CommitDepth int
	ShowDetails bool
	// Feature flags.
	EnableSarif                 bool `env:"ENABLE_SARIF"`
	EnableScorecardV6           bool `env:"SCORECARD_V6"`
	EnableScorecardExperimental bool `env:"SCORECARD_EXPERIMENTAL"`
}

Options define common options for configuring scorecard.

func New

func New() *Options

New creates a new instance of `Options`.

func (*Options) AddFlags

func (o *Options) AddFlags(cmd *cobra.Command)

AddFlags adds this options' flags to the cobra command.

func (*Options) Checks added in v4.10.5

func (o *Options) Checks() []string

Checks returns the list of checks and honours the GitHub integration.

func (*Options) IsInternalGitHubIntegrationEnabled added in v4.10.5

func (o *Options) IsInternalGitHubIntegrationEnabled() bool

GitHub integration support. See https://github.com/ossf/scorecard-action/issues/1107. NOTE: We don't add a field to to the Option structure to simplify integration. If we did, the Action would also need to be aware of the integration and pass the relevant values. This would add redundancy and complicate maintenance.

func (*Options) Validate

func (o *Options) Validate() error

Validate validates scorecard configuration options. TODO(options): Cleanup error messages.

Jump to

Keyboard shortcuts

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