options

package
v4.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2022 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"

	// 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"
)
View Source
const (
	// DefaultCommit specifies the default commit reference to use.
	DefaultCommit = clients.HeadSHA

	// FormatJSON specifies that results should be output in JSON format.
	FormatJSON = "json"
	// 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"

	// EnvVarEnableSarif is the environment variable which controls enabling
	// SARIF logging.
	EnvVarEnableSarif = "ENABLE_SARIF"
	// EnvVarScorecardV5 is the environment variable which enables scorecard v5
	// options.
	EnvVarScorecardV5 = "SCORECARD_V5"
	// EnvVarScorecardV6 is the environment variable which enables scorecard v6
	// options.
	EnvVarScorecardV6 = "SCORECARD_V6"
)

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
	PolicyFile string
	// TODO(action): Add logic for writing results to file
	ResultsFile string
	ChecksToRun []string
	Metadata    []string
	ShowDetails bool

	// Feature flags.
	EnableSarif       bool `env:"ENABLE_SARIF"`
	EnableScorecardV5 bool `env:"SCORECARD_V5"`
	EnableScorecardV6 bool `env:"SCORECARD_V6"`
}

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