options

package
v5.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

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"

	// FlagShowAnnotations is the flag name for outputting annotations on checks.
	FlagShowAnnotations = "show-annotations"

	// 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"

	FlagProbes = "probes"
)
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"
	// FormatProbe specifies that results should be output in probe JSON format.
	FormatProbe = "probe"
	// 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 = sclog.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
	ProbesToRun     []string
	Metadata        []string
	CommitDepth     int
	ShowDetails     bool
	ShowAnnotations 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

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

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

func (*Options) IsInternalGitHubIntegrationEnabled

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) Probes

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

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