goscorecardcheck

package module
v0.0.0-...-065d0a1 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

README

goscorecardcheck

This tool is a linter that checks imports against their scorecard.dev score, using the scorecard api.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Configuration

type Configuration struct {
	Policies []Policy `yaml:"policies"`
}

Configuration of for allowing/blocking dependencies using its https://github.com/ossf/scorecard score

type Issue

type Issue struct {
	FileName   string
	LineNumber int
	Position   token.Position
	Reason     string
}

Issue represents the result of one error.

func (*Issue) String

func (r *Issue) String() string

String returns the filename, line number and reason of a Issue.

type Policy

type Policy struct {
	// Description of the policy
	Description string `yaml:"description"`
	// Packages to include, supports wildcards in paths
	Include []string `yaml:"include,omitempty"`
	// Packages to exclude, supports wildcards in paths
	Exclude []string `yaml:"exclude,omitempty"`
	// Rules for this policy
	Rules []Rule `yaml:"rules"`
}

Policy a policy to apply when validating scorecards

type Processor

type Processor struct {
	Config  *Configuration
	Modfile *modfile.File
	// contains filtered or unexported fields
}

Processor processes go files

func NewProcessor

func NewProcessor(config *Configuration) (*Processor, error)

NewProcessor will create a Processor to lint blocked packages.

func (*Processor) ProcessFiles

func (p *Processor) ProcessFiles(ctx context.Context, filenames []string) (issues []Issue)

ProcessFiles takes a string slice with file names (full paths) and lints them.

type Rule

type Rule struct {
	// Check to check minimum score against, if unset will check against the
	// overall score
	Check string `yaml:"check,omitempty"`
	// The minimum allowed score
	MinimumScore float64 `yaml:"minimumScore"`
}

Directories

Path Synopsis
cmd
internal

Jump to

Keyboard shortcuts

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