entities

package
v0.13.3 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

SPDX-License-Identifier: MIT

  • Copyright (C) 2018-2024 SCANOSS.COM *
  • Permission is hereby granted, free of charge, to any person obtaining a copy
  • of this software and associated documentation files (the "Software"), to deal
  • in the Software without restriction, including without limitation the rights
  • to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  • copies of the Software, and to permit persons to whom the Software is
  • furnished to do so, subject to the following conditions: *
  • The above copyright notice and this permission notice shall be included in all
  • copies or substantial portions of the Software. *
  • THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  • IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  • FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  • AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  • LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  • OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  • SOFTWARE.

Index

Constants

View Source
const (
	MatchTypeNone       = "none"
	MatchTypeDependency = "dependency"
)
View Source
const (
	SortByMatchPercentage SortOption = "match_percentage"
	SortByPath            SortOption = "path"

	SortOrderAsc  SortOrder = "asc"
	SortOrderDesc SortOrder = "desc"
)

Variables

View Source
var (
	ErrReadingFile     = errors.New("error reading file")
	ErrFetchingContent = errors.New("error fetching remote file")
)
View Source
var (
	ErrReadingResultFile = errors.New("error reading result file")
	ErrParsingResultFile = errors.New("error parsing result file")
)
View Source
var AllShortcutActions = []struct {
	Value  Action
	TSName string
}{
	{ActionUndo, "Undo"},
	{ActionRedo, "Redo"},
	{ActionSave, "Save"},
	{ActionConfirm, "Confirm"},
	{ActionFocusSearch, "FocusSearch"},
	{ActionSelectAll, "SelectAll"},
	{ActionMoveUp, "MoveUp"},
	{ActionMoveDown, "MoveDown"},
	{ActionIncludeFileDirectly, "IncludeFileDirectly"},
	{ActionIncludeFile, "IncludeFile"},
	{ActionIncludeComponent, "IncludeComponent"},
	{ActionIncludeFolder, "IncludeFolder"},
	{ActionDismissFileDirectly, "DismissFileDirectly"},
	{ActionDismissFile, "DismissFile"},
	{ActionDismissComponent, "DismissComponent"},
	{ActionDismissFolder, "DismissFolder"},
	{ActionReplaceFile, "ReplaceFile"},
	{ActionReplaceFolder, "ReplaceFolder"},
	{ActionReplaceComponent, "ReplaceComponent"},
	{ActionRestoreFile, "RestoreFile"},
	{ActionSkipFile, "SkipFile"},
	{ActionSkipFolder, "SkipFolder"},
	{ActionSkipExtension, "SkipExtension"},
	{ActionToggleSyncScrollPosition, "ToggleSyncScrollPosition"},
	{ActionShowKeyboardShortcutsModal, "ShowKeyboardShortcutsModal"},
	{ActionScanWithOptions, "ScanWithOptions"},
	{ActionOpenSettings, "OpenSettings"},
}

This is necessary to bind the enum in main.go

View Source
var AppVersion = ""

AppVersion Gets updated build time using -ldflags.

View Source
var DefaultShortcuts = []Shortcut{

	{
		Name:        "Undo",
		Description: "Undo the last action",
		Accelerator: keys.CmdOrCtrl("z"),
		Keys:        "mod+z",
		Group:       GroupGlobal,
		Action:      ActionUndo,
	},
	{
		Name:        "Redo",
		Description: "Redo the last action",
		Accelerator: keys.Combo("z", keys.CmdOrCtrlKey, keys.ShiftKey),
		Keys:        "mod+shift+z",
		Group:       GroupGlobal,
		Action:      ActionRedo,
	},
	{
		Name:        "Save",
		Description: "Save the current changes",
		Accelerator: keys.CmdOrCtrl("s"),
		Keys:        "mod+s",
		Group:       GroupGlobal,
		Action:      ActionSave,
	},
	{
		Name:        "Focus Search",
		Description: "Focus the search bar",
		Accelerator: keys.CmdOrCtrl("f"),
		Keys:        "mod+f",
		Group:       GroupGlobal,
		Action:      ActionFocusSearch,
	},
	{
		Name:        "Select All",
		Description: "Select all text",
		Accelerator: keys.CmdOrCtrl("a"),
		Keys:        "mod+a",
		Group:       GroupGlobal,
		Action:      ActionSelectAll,
	},

	{
		Name:                   "Move Up",
		Description:            "Move the selection up",
		Accelerator:            keys.Key("up"),
		AlternativeAccelerator: keys.Key("k"),
		Keys:                   "k, up",
		Group:                  GroupNavigation,
		Action:                 ActionMoveUp,
	},
	{
		Name:                   "Move Down",
		Description:            "Move the selection down",
		Accelerator:            keys.Key("down"),
		AlternativeAccelerator: keys.Key("j"),
		Keys:                   "j, down",
		Group:                  GroupNavigation,
		Action:                 ActionMoveDown,
	},

	{
		Name:        "Sync Scroll Position",
		Description: "Sync the scroll position of the editors",
		Accelerator: keys.Combo("e", keys.ShiftKey, keys.CmdOrCtrlKey),
		Keys:        "shift+mod+e",
		Group:       GroupView,
		Action:      ActionToggleSyncScrollPosition,
	},
	{
		Name:        "Settings",
		Description: "Open the app settings",
		Accelerator: keys.CmdOrCtrl(","),
		Keys:        "mod+,",
		Group:       GroupView,
		Action:      ActionOpenSettings,
	},

	{
		Name:        "Include file directly",
		Description: "Include the current file directly (no dialog)",
		Keys:        "i, f1",
		Group:       GroupActions,
		Action:      ActionIncludeFileDirectly,
	},
	{
		Name:        "Include file",
		Description: "Open include dialog with file selected",
		Keys:        "alt+i, alt+f1",
		Group:       GroupActions,
		Action:      ActionIncludeFile,
	},
	{
		Name:        "Include component",
		Description: "Open include dialog with component selected",
		Keys:        "shift+i, shift+f1",
		Group:       GroupActions,
		Action:      ActionIncludeComponent,
	},
	{
		Name:        "Include folder",
		Description: "Open include dialog with folder selected",
		Keys:        "alt+shift+i",
		Group:       GroupActions,
		Action:      ActionIncludeFolder,
	},
	{
		Name:        "Dismiss file directly",
		Description: "Dismiss the current file directly (no dialog)",
		Keys:        "d, f2",
		Group:       GroupActions,
		Action:      ActionDismissFileDirectly,
	},
	{
		Name:        "Dismiss file",
		Description: "Open dismiss dialog with file selected",
		Keys:        "alt+d, alt+f2",
		Group:       GroupActions,
		Action:      ActionDismissFile,
	},
	{
		Name:        "Dismiss component",
		Description: "Open dismiss dialog with component selected",
		Keys:        "shift+d, shift+f2",
		Group:       GroupActions,
		Action:      ActionDismissComponent,
	},
	{
		Name:        "Dismiss folder",
		Description: "Open dismiss dialog with folder selected",
		Keys:        "alt+shift+d",
		Group:       GroupActions,
		Action:      ActionDismissFolder,
	},
	{
		Name:        "Replace file",
		Description: "Open replace dialog with file selected",
		Keys:        "r, alt+r, f3, alt+f3",
		Group:       GroupActions,
		Action:      ActionReplaceFile,
	},
	{
		Name:        "Replace component",
		Description: "Open replace dialog with component selected",
		Keys:        "shift+r",
		Group:       GroupActions,
		Action:      ActionReplaceComponent,
	},
	{
		Name:        "Replace folder",
		Description: "Open replace dialog with folder selected",
		Keys:        "alt+shift+r",
		Group:       GroupActions,
		Action:      ActionReplaceFolder,
	},
	{
		Name:        "Restore file",
		Description: "Restore file to pending (undo decision)",
		Keys:        "u",
		Group:       GroupActions,
		Action:      ActionRestoreFile,
	},
	{
		Name:        "Skip file",
		Description: "Open skip dialog for file",
		Keys:        "s, alt+s, f4, alt+f4",
		Group:       GroupActions,
		Action:      ActionSkipFile,
	},
	{
		Name:        "Skip folder",
		Description: "Open skip dialog with folder selected",
		Keys:        "alt+shift+s",
		Group:       GroupActions,
		Action:      ActionSkipFolder,
	},
	{
		Name:        "Skip extension",
		Description: "Open skip dialog with extension selected",
		Keys:        "shift+s",
		Group:       GroupActions,
		Action:      ActionSkipExtension,
	},

	{
		Name:        "Scan With Options",
		Description: "Run a scan with options",
		Accelerator: keys.Combo("c", keys.ShiftKey, keys.CmdOrCtrlKey),
		Keys:        "shift+mod+c",
		Group:       GroupScan,
		Action:      ActionScanWithOptions,
	},
}
View Source
var DefaultSkippedDirExtensions = []string{".egg-info"}
View Source
var DefaultSkippedDirs = []string{
	"nbproject",
	"nbbuild",
	"nbdist",
	"__pycache__",
	"venv",
	"_yardoc",
	"eggs",
	"wheels",
	"htmlcov",
	"__pypackages__",
	"example",
	"examples",
	"docs",
	"doc",
}
View Source
var DefaultSkippedExtensions = []string{}/* 169 elements not displayed */
View Source
var DefaultSkippedFiles = []string{
	"gradlew",
	"gradlew.bat",
	"mvnw",
	"mvnw.cmd",
	"gradle-wrapper.jar",
	"maven-wrapper.jar",
	"thumbs.db",
	"babel.config.js",
	"license.txt",
	"license.md",
	"copying.lib",
	"makefile",
}
View Source
var (
	ScanArguments = []ScanArgDef{
		{"wfp", "w", "", "Scan a WFP File instead of a folder (optional)", "", "string", false, true},
		{"dep", "p", "", "Use a dependency file instead of a folder (optional)", "", "string", false, true},
		{"stdin", "s", "", "Scan the file contents supplied via STDIN (optional)", "", "string", false, false},
		{"files", "e", []string{}, "List of files to scan.", "", "stringSlice", false, false},
		{"identify", "i", "", "Scan and identify components in SBOM file", "", "string", false, true},
		{"ignore", "n", "", "Ignore components specified in the SBOM file", "", "string", false, true},
		{"output", "o", "", "Output result file name (optional - default stdout).", "Location where the scan results will be saved", "string", true, true},
		{"format", "f", "plain", "Result output format (optional - default: plain)", "", "string", false, false},
		{"threads", "T", 5, "Number of threads to use while scanning (optional - default 5)", "", "int", false, false},
		{"flags", "F", 0, "Scanning engine flags", "Advanced scanning engine configuration flags", "int", false, false},
		{"post-size", "P", 32, "Number of kilobytes to limit the post to while scanning (optional - default 32)", "Limits the size of each scan request to improve performance and reliability", "int", false, false},
		{"timeout", "M", 180, "Timeout (in seconds) for API communication (optional - default 180)", "", "int", false, false},
		{"retry", "R", 5, "Retry limit for API communication (optional - default 5)", "", "int", false, false},
		{"dependencies", "D", false, "Add Dependency scanning", "", "bool", false, false},
		{"dependencies-only", "", false, "Run Dependency scanning only", "", "bool", false, false},
		{"sc-command", "", "", "Scancode command and path if required (optional - default scancode).", "", "string", false, false},
		{"sc-timeout", "", 600, "Timeout (in seconds) for scancode to complete (optional - default 600)", "", "int", false, false},
		{"dep-scope", "", "", "Filter dependencies by scope - default all (options: dev/prod)", "", "string", false, false},
		{"dep-scope-inc", "", "", "Include dependencies with declared scopes", "", "string", false, false},
		{"dep-scope-exc", "", "", "Exclude dependencies with declared scopes", "", "string", false, false},
		{"settings", "", "", "Settings file to use for scanning (optional - default scanoss.json)", "Configuration file that defines scanning behavior and rules", "string", true, true},
		{"skip-settings-file", "", false, "Skip default settings file (scanoss.json) if it exists", "", "", false, false},
		{"debug", "d", false, "Enable debug messages", "Show detailed diagnostic information during scanning", "bool", true, false},
		{"trace", "t", false, "Enable trace messages, including API posts", "Display all API communication and detailed execution steps", "bool", true, false},
		{"quiet", "q", false, "Enable quiet mode", "Suppress non-essential output messages", "bool", true, false},
	}
)

Functions

This section is empty.

Types

type Action

type Action string

Action defines the type for keyboard actions

const (
	ActionUndo        Action = "undo"
	ActionRedo        Action = "redo"
	ActionSave        Action = "save"
	ActionConfirm     Action = "confirm"
	ActionFocusSearch Action = "focusSearch"
	ActionSelectAll   Action = "selectAll"
	ActionMoveUp      Action = "moveUp"
	ActionMoveDown    Action = "moveDown"

	// Filter actions (BOM)
	ActionIncludeFileDirectly Action = "includeFileDirectly"
	ActionIncludeFile         Action = "includeFile"
	ActionIncludeComponent    Action = "includeComponent"
	ActionIncludeFolder       Action = "includeFolder"
	ActionDismissFileDirectly Action = "dismissFileDirectly"
	ActionDismissFile         Action = "dismissFile"
	ActionDismissComponent    Action = "dismissComponent"
	ActionDismissFolder       Action = "dismissFolder"
	ActionReplaceFile         Action = "replaceFile"
	ActionReplaceFolder       Action = "replaceFolder"
	ActionReplaceComponent    Action = "replaceComponent"

	// Restore action (undo decision on completed result)
	ActionRestoreFile Action = "restoreFile"

	// Skip action (Scan settings) - always opens modal
	ActionSkipFile      Action = "skipFile"
	ActionSkipFolder    Action = "skipFolder"
	ActionSkipExtension Action = "skipExtension"

	// View
	ActionToggleSyncScrollPosition   Action = "toggleSyncScrollPosition"
	ActionShowKeyboardShortcutsModal Action = "showKeyboardShortcutsModal"
	ActionOpenSettings               Action = "openSettings"
	// Scan
	ActionScanWithOptions Action = "scanWithOptions"
)

type Bom

type Bom struct {
	Include []ComponentFilter `json:"include,omitempty"`
	Remove  []ComponentFilter `json:"remove,omitempty"`
	Replace []ComponentFilter `json:"replace,omitempty"`
	Exclude []ComponentFilter `json:"exclude,omitempty"`
}

type Component

type Component struct {
	ID          string   `json:"id"`
	Lines       string   `json:"lines,omitempty"`
	OssLines    string   `json:"oss_lines,omitempty"`
	Matched     string   `json:"matched,omitempty"`
	FileHash    string   `json:"file_hash,omitempty"`
	SourceHash  string   `json:"source_hash,omitempty"`
	FileURL     string   `json:"file_url,omitempty"`
	Purl        []string `json:"purl,omitempty"`
	Vendor      string   `json:"vendor,omitempty"`
	Component   string   `json:"component,omitempty"`
	Version     string   `json:"version,omitempty"`
	Latest      string   `json:"latest,omitempty"`
	URL         string   `json:"url,omitempty"`
	Status      string   `json:"status,omitempty"`
	ReleaseDate string   `json:"release_date,omitempty"`
	File        string   `json:"file,omitempty"`
	URLHash     string   `json:"url_hash,omitempty"`
	URLStats    struct{} `json:"url_stats,omitempty"`
	Provenance  string   `json:"provenance,omitempty"`
	Licenses    []struct {
		Name             string `json:"name"`
		PatentHints      string `json:"patent_hints"`
		Copyleft         string `json:"copyleft"`
		ChecklistURL     string `json:"checklist_url"`
		OsadlUpdated     string `json:"osadl_updated"`
		Source           string `json:"source"`
		URL              string `json:"url"`
		IncompatibleWith string `json:"incompatible_with,omitempty"`
	} `json:"licenses,omitempty"`
	Health struct {
		CreationDate string `json:"creation_date"`
		LastUpdate   string `json:"last_update"`
		LastPush     string `json:"last_push"`
		Stars        int    `json:"stars"`
		Issues       int    `json:"issues"`
		Forks        int    `json:"forks"`
	} `json:"health"`
	Dependencies []interface{} `json:"dependencies"`
	Copyrights   []struct {
		Name   string `json:"name"`
		Source string `json:"source"`
	} `json:"copyrights"`
	Vulnerabilities []interface{} `json:"vulnerabilities"`
	Server          struct {
		Version   string `json:"version,omitempty"`
		KbVersion struct {
			Monthly string `json:"monthly,omitempty"`
			Daily   string `json:"daily,omitempty"`
		} `json:"kb_version"`
		Hostname string `json:"hostname,omitempty"`
		Flags    string `json:"flags,omitempty"`
		Elapsed  string `json:"elapsed,omitempty"`
	} `json:"server"`
}

type ComponentDTO

type ComponentDTO struct {
	ID          string             `json:"id"`
	Lines       string             `json:"lines,omitempty"`
	OssLines    string             `json:"oss_lines,omitempty"`
	Matched     string             `json:"matched,omitempty"`
	FileHash    string             `json:"file_hash,omitempty"`
	SourceHash  string             `json:"source_hash,omitempty"`
	FileURL     string             `json:"file_url,omitempty"`
	Purl        []string           `json:"purl"`
	Vendor      string             `json:"vendor,omitempty"`
	Component   string             `json:"component,omitempty"`
	Version     string             `json:"version,omitempty"`
	Latest      string             `json:"latest,omitempty"`
	URL         string             `json:"url,omitempty"`
	Status      string             `json:"status,omitempty"`
	ReleaseDate string             `json:"release_date,omitempty"`
	File        string             `json:"file,omitempty"`
	URLHash     string             `json:"url_hash,omitempty"`
	URLStats    struct{}           `json:"url_stats,omitempty"`
	Provenance  string             `json:"provenance,omitempty"`
	Licenses    []ComponentLicense `json:"licenses,omitempty"`
	Server      struct {
		Version   string `json:"version,omitempty"`
		KbVersion struct {
			Monthly string `json:"monthly,omitempty"`
			Daily   string `json:"daily,omitempty"`
		} `json:"kb_version"`
		Hostname string `json:"hostname,omitempty"`
		Flags    string `json:"flags,omitempty"`
		Elapsed  string `json:"elapsed,omitempty"`
	} `json:"server"`
}

type ComponentFilter

type ComponentFilter struct {
	Path        string               `json:"path,omitempty"`
	Purl        string               `json:"purl,omitempty"`
	Usage       ComponentFilterUsage `json:"usage,omitempty"`
	Comment     string               `json:"comment,omitempty"`
	ReplaceWith string               `json:"replace_with,omitempty"`
	License     string               `json:"license,omitempty"`
}

func (ComponentFilter) AppliesTo added in v0.11.0

func (cf ComponentFilter) AppliesTo(result Result) bool

AppliesTo checks if all filter constraints are satisfied by the result. A filter matches when both path and purl constraints are satisfied. Empty constraints are always satisfied (act as wildcards).

func (ComponentFilter) Compare added in v0.11.0

func (cf ComponentFilter) Compare(other ComponentFilter) int

Compare compares this filter with another by priority. Returns: negative if cf comes before other in sort order.

Priority rules (consistent with scanoss.java):

  1. Higher score wins (score 4 > score 2 > score 1)
  2. Same score: longer path wins (more specific)

The length comparison naturally handles file vs folder priority: "src/main.c" (10 chars) beats "src/" (4 chars) at the same score level.

func (ComponentFilter) MatchesAnyPurl added in v0.11.0

func (cf ComponentFilter) MatchesAnyPurl(purls []string) bool

MatchesAnyPurl checks if the purl constraint is satisfied. Empty purl means no constraint (always satisfied). For replace entries, also matches if the result's purl equals ReplaceWith, since the scanner may have already applied the replacement.

func (ComponentFilter) MatchesPath added in v0.11.0

func (cf ComponentFilter) MatchesPath(path string) bool

MatchesPath checks if the path constraint is satisfied.

func (ComponentFilter) Priority added in v0.11.0

func (cf ComponentFilter) Priority() int

Priority returns the priority score for a ComponentFilter. Higher score = higher priority. Score 4: has both path and purl (most specific) Score 2: has purl only Score 1: has path only (folder rules)

type ComponentFilterDTO

type ComponentFilterDTO struct {
	Path        string       `json:"path,omitempty"`
	Purl        string       `json:"purl,omitempty"`
	Usage       string       `json:"usage,omitempty"`
	Action      FilterAction `json:"action" validate:"required,eq=include|eq=remove|eq=replace|eq=restore"`
	Comment     string       `json:"comment,omitempty"`
	ReplaceWith string       `json:"replace_with,omitempty" validate:"omitempty,valid-purl"`
	License     string       `json:"license,omitempty"`
}

type ComponentFilterUsage

type ComponentFilterUsage string

type ComponentLicense

type ComponentLicense interface {
}

type ComponentLicenseInfo added in v0.8.0

type ComponentLicenseInfo struct {
	Purl      string        `json:"purl"`
	License   string        `json:"license"`
	Version   string        `json:"version"`
	Statement string        `json:"statement"`
	Licenses  []LicenseInfo `json:"licenses"`
}

type ComponentRequest added in v0.8.0

type ComponentRequest struct {
	Purl        string `json:"purl" validate:"required,min=1"`
	Requirement string `json:"requirement,omitempty"`
}

type ComponentSearchRequest added in v0.8.0

type ComponentSearchRequest struct {
	Search    string `json:"search" validate:"required,min=1"`
	Vendor    string `json:"vendor,omitempty"`
	Component string `json:"component,omitempty"`
	Package   string `json:"package,omitempty"`
	Limit     int32  `json:"limit,omitempty"`
	Offset    int32  `json:"offset,omitempty"`
}

ComponentSearchRequest represents the request for searching components online

type ComponentSearchResponse added in v0.8.0

type ComponentSearchResponse struct {
	Components []SearchedComponent `json:"components"`
	Status     StatusResponse      `json:"status"`
}

ComponentSearchResponse represents the response from component search

type DeclaredComponent

type DeclaredComponent struct {
	Name string `json:"name"`
	Purl string `json:"purl"`
}

type File

type File struct {
	// contains filtered or unexported fields
}

func NewFile

func NewFile(basePath string, path string, content []byte) *File

func (*File) GetAbsolutePath

func (f *File) GetAbsolutePath() string

func (*File) GetContent

func (f *File) GetContent() []byte

func (*File) GetLanguage

func (f *File) GetLanguage() string

func (*File) GetName

func (f *File) GetName() string

func (*File) GetRelativePath

func (f *File) GetRelativePath() string

type FileDTO

type FileDTO struct {
	Name     string `json:"name"`
	Path     string `json:"path"`
	Content  string `json:"content"`
	Language string `json:"language"`
}

type FileSnippetSettings added in v0.12.0

type FileSnippetSettings struct {
	RankingEnabled   bool `json:"ranking_enabled,omitempty"`
	RankingThreshold *int `json:"ranking_threshold,omitempty"`
	MinSnippetHits   int  `json:"min_snippet_hits,omitempty"`
	MinSnippetLines  int  `json:"min_snippet_lines,omitempty"`
	HonourFileExts   bool `json:"honour_file_exts,omitempty"`
	SkipHeaders      bool `json:"skip_headers,omitempty"`
	SkipHeadersLimit int  `json:"skip_headers_limit,omitempty"`
}

type FilterAction

type FilterAction string
const (
	Include FilterAction = "include"
	Remove  FilterAction = "remove"
	Replace FilterAction = "replace"
	Restore FilterAction = "restore"
)

type FilterConfig

type FilterConfig struct {
	Action FilterAction `json:"action,omitempty"`
	Type   FilterType   `json:"type,omitempty"`
}

type FilterType

type FilterType string
const (
	ByFile   FilterType = "by_file"
	ByPurl   FilterType = "by_purl"
	ByFolder FilterType = "by_folder"
)

type GetLicensesByPurlResponse added in v0.8.0

type GetLicensesByPurlResponse struct {
	Status    StatusResponse       `json:"status"`
	Component ComponentLicenseInfo `json:"component"`
}

type Group

type Group string
const (
	GroupGlobal     Group = "Global"
	GroupNavigation Group = "Navigation"
	GroupActions    Group = "Actions"
	GroupView       Group = "View"
	GroupScan       Group = "Scan"
)

type InitialFilters

type InitialFilters struct {
	Include []ComponentFilter
	Remove  []ComponentFilter
	Replace []ComponentFilter
}

type License

type License struct {
	Name      string `json:"name"`
	LicenseId string `json:"licenseId"`
	Reference string `json:"reference"`
}

type LicenseDTO

type LicenseDTO struct {
	Name             string `json:"name"`
	PatentHints      string `json:"patent_hints"`
	Copyleft         string `json:"copyleft"`
	ChecklistURL     string `json:"checklist_url"`
	OsadlUpdated     string `json:"osadl_updated"`
	Source           string `json:"source"`
	URL              string `json:"url"`
	IncompatibleWith string `json:"incompatible_with,omitempty"`
}

func NewLicenseDTO

func NewLicenseDTO(name string, patentHints string, copyleft string, checklistURL string, osadlUpdated string, source string, url string, incompatibleWith string) *LicenseDTO

type LicenseFile

type LicenseFile struct {
	LicenseListVersion string    `json:"licenseListVersion"`
	Licenses           []License `json:"licenses"`
	ReleaseDate        string    `json:"releaseDate"`
}

type LicenseInfo added in v0.8.0

type LicenseInfo struct {
	Id       string `json:"id"`
	FullName string `json:"full_name"`
}

type MatchType

type MatchType string
const (
	MatchTypeFile    MatchType = "file"
	MatchTypeSnippet MatchType = "snippet"
)

type RequestResultDTO

type RequestResultDTO struct {
	MatchType MatchType  `json:"match_type,omitempty" validate:"omitempty,eq=file|eq=snippet"`
	Query     string     `json:"query,omitempty"`
	Sort      SortConfig `json:"sort,omitempty" validate:"dive"`
}

type Result

type Result struct {
	Path      string `json:"path"`
	MatchType string `json:"match_type"`
	// TODO: Consider changing Purl from *[]string to []string.
	// The pointer adds unnecessary complexity (nil checks everywhere).
	// []string with omitempty already omits empty slices from JSON.
	Purl          *[]string   `json:"purl,omitempty"`
	ComponentName string      `json:"component"`
	Matches       []Component `json:"matches,omitempty"`
}

func NewResult

func NewResult() *Result

func (*Result) GetFileName

func (r *Result) GetFileName() string

func (*Result) GetMatchPercentage added in v0.6.0

func (r *Result) GetMatchPercentage() float64

func (*Result) IsDependency added in v0.9.9

func (r *Result) IsDependency() bool

func (*Result) IsEmpty

func (r *Result) IsEmpty() bool

func (*Result) IsValid

func (r *Result) IsValid() bool

type ResultDTO

type ResultDTO struct {
	Path             string        `json:"path"`
	MatchType        MatchType     `json:"match_type"`
	WorkflowState    WorkflowState `json:"workflow_state,omitempty"`
	FilterConfig     FilterConfig  `json:"filter_config,omitempty"`
	Comment          string        `json:"comment,omitempty"`
	DetectedPurl     string        `json:"detected_purl,omitempty"`
	DetectedPurlUrl  string        `json:"detected_purl_url,omitempty"`
	DetectedName     string        `json:"detected_name,omitempty"`
	ConcludedPurl    string        `json:"concluded_purl,omitempty"`
	ConcludedPurlUrl string        `json:"concluded_purl_url,omitempty"`
	ConcludedName    string        `json:"concluded_name,omitempty"`
}

type ResultFilter

type ResultFilter interface {
	IsValid(result Result) bool
}

type ResultFilterAND

type ResultFilterAND struct {
	// contains filtered or unexported fields
}

func NewResultFilterAND

func NewResultFilterAND() *ResultFilterAND

func (*ResultFilterAND) AddFilter

func (f *ResultFilterAND) AddFilter(filter ResultFilter)

func (*ResultFilterAND) HasFilters

func (f *ResultFilterAND) HasFilters() bool

func (*ResultFilterAND) IsValid

func (f *ResultFilterAND) IsValid(result Result) bool

type ResultFilterFactory

type ResultFilterFactory struct {
}

func NewResultFilterFactory

func NewResultFilterFactory() *ResultFilterFactory

func (*ResultFilterFactory) Create

type ResultFilterMatchType

type ResultFilterMatchType struct {
	// contains filtered or unexported fields
}

func NewResultFilterMatchType

func NewResultFilterMatchType(matchType string) *ResultFilterMatchType

func (*ResultFilterMatchType) IsValid

func (f *ResultFilterMatchType) IsValid(result Result) bool

type ResultLicense added in v0.6.0

type ResultLicense struct {
	Name   string `json:"name"`
	Source string `json:"source,omitempty"`
	URL    string `json:"url,omitempty"`
}

type ResultQueryFilter

type ResultQueryFilter struct {
	// contains filtered or unexported fields
}

func NewResultQueryFilter

func NewResultQueryFilter(query string) *ResultQueryFilter

func (*ResultQueryFilter) IsValid

func (f *ResultQueryFilter) IsValid(result Result) bool

type ScanArgDef added in v0.6.0

type ScanArgDef struct {
	Name           string
	Shorthand      string
	Default        interface{}
	Usage          string
	Tooltip        string
	Type           string
	IsCore         bool // true -> option is shown in ScanDialog UI
	IsFileSelector bool
}

type ScanResponse

type ScanResponse struct {
	Output    string `json:"output,omitempty"`
	ErrOutput string `json:"error_output,omitempty"`
	Error     error  `json:"error,omitempty"`
}

type ScanossSettings

type ScanossSettings struct {
	SettingsFile *SettingsFile
}
var (
	ScanossSettingsJson *ScanossSettings
)

type ScanossSettingsSchema

type ScanossSettingsSchema struct {
	Skip        SkipSettings        `json:"skip,omitempty"`
	FileSnippet FileSnippetSettings `json:"file_snippet,omitempty"`
}

type SearchedComponent added in v0.8.0

type SearchedComponent struct {
	Component string `json:"component"`
	Purl      string `json:"purl"`
	URL       string `json:"url"`
}

SearchedComponent represents a component found in the search results

type SettingsFile

type SettingsFile struct {
	Settings ScanossSettingsSchema `json:"settings,omitempty"`
	Bom      Bom                   `json:"bom,omitempty"`
}

func (*SettingsFile) Equal

func (sf *SettingsFile) Equal(other *SettingsFile) (bool, error)

func (*SettingsFile) GetBomEntryFromResult

func (sf *SettingsFile) GetBomEntryFromResult(result Result) ComponentFilter

func (*SettingsFile) GetResultFilterConfig

func (sf *SettingsFile) GetResultFilterConfig(result Result) FilterConfig

func (*SettingsFile) GetResultWorkflowState

func (sf *SettingsFile) GetResultWorkflowState(result Result) WorkflowState

func (*SettingsFile) IsResultInList

func (sf *SettingsFile) IsResultInList(result Result, list []ComponentFilter) (bool, int)

func (*SettingsFile) IsResultIncluded

func (sf *SettingsFile) IsResultIncluded(result Result) (bool, int)

func (*SettingsFile) IsResultRemoved

func (sf *SettingsFile) IsResultRemoved(result Result) (bool, int)

func (*SettingsFile) IsResultReplaced

func (sf *SettingsFile) IsResultReplaced(result Result) (bool, int)

type Shortcut

type Shortcut struct {
	Name                   string            `json:"name"`
	Description            string            `json:"description"`
	Accelerator            *keys.Accelerator `json:"accelerator"`
	AlternativeAccelerator *keys.Accelerator `json:"alternativeAccelerator,omitempty"`
	Keys                   string            `json:"keys"`
	Group                  Group             `json:"group,omitempty"`
	Action                 Action            `json:"action,omitempty"`
}

type Sizes

type Sizes struct {
	Scanning       []SizesSkipSettings `json:"scanning,omitempty"`
	Fingerprinting []SizesSkipSettings `json:"fingerprinting,omitempty"`
}

type SizesSkipSettings

type SizesSkipSettings struct {
	Patterns []string `json:"patterns,omitempty"`
	Min      int      `json:"min,omitempty"`
	Max      int      `json:"max,omitempty"`
}

type SkipPatterns

type SkipPatterns struct {
	Scanning       []string `json:"scanning,omitempty"`
	Fingerprinting []string `json:"fingerprinting,omitempty"`
}

type SkipSettings

type SkipSettings struct {
	Patterns SkipPatterns `json:"patterns,omitempty"`
	Sizes    Sizes        `json:"sizes,omitempty"`
}

type SkipState added in v0.6.5

type SkipState string
const (
	SkipStateIncluded SkipState = "included"
	SkipStateExcluded SkipState = "excluded"
	SkipStateMixed    SkipState = "mixed"
)

type SortConfig added in v0.6.0

type SortConfig struct {
	Option SortOption `json:"option"`
	Order  SortOrder  `json:"order"`
}

type SortOption added in v0.6.0

type SortOption string

type SortOrder added in v0.6.0

type SortOrder string

type StatusResponse added in v0.8.0

type StatusResponse struct {
	Status  string `json:"status,omitempty"`
	Message string `json:"message,omitempty"`
}

type TreeNode added in v0.6.5

type TreeNode struct {
	ID                string        `json:"id"`
	Name              string        `json:"name"`
	Path              string        `json:"path"`
	IsFolder          bool          `json:"isFolder"`
	WorkflowState     WorkflowState `json:"workflowState"`
	ScanningSkipState SkipState     `json:"scanningSkipState"`
	Children          []TreeNode    `json:"children"`
}

func NewTreeNode added in v0.6.5

func NewTreeNode(path string, result ResultDTO, isFolder bool) TreeNode

type UpdateInfo added in v0.9.0

type UpdateInfo struct {
	Version        string    `json:"version"`
	DownloadURL    string    `json:"download_url"`
	ReleaseNotes   string    `json:"release_notes"`
	PublishedAt    time.Time `json:"published_at"`
	Size           int64     `json:"size"`
	Available      bool      `json:"available"`
	ExpectedSHA256 string    `json:"expected_sha256,omitempty"` // Expected SHA256 checksum for verification
}

UpdateInfo contains information about an available update.

type WorkflowState

type WorkflowState string
const (
	Pending   WorkflowState = "pending"
	Completed WorkflowState = "completed"
	Mixed     WorkflowState = "mixed"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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