Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ go_lint_docker: ## Run docker instance of Go linting across the code base

run: cp_assets ## Runs the application in development mode
$(eval APPARGS := $(ARGS))
@wails dev -ldflags "-X github.com/scanoss/scanoss.cc/backend/entities.AppVersion=$(VERSION)" $(if $(strip $(APPARGS)),-appargs "$(APPARGS)")
@wails dev -ldflags "-X github.com/scanoss/scanoss.cc/backend/entities.AppVersion=$(VERSION)" $(if $(strip $(APPARGS)),-appargs "--debug $(APPARGS)")

npm: ## Install NPM dependencies for the frontend
@echo "Running npm install for frontend..."
Expand Down
10 changes: 6 additions & 4 deletions app.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func (a *App) initializeMenu() {
groupedShortcuts := a.keyboardService.GetGroupedShortcuts()
actionShortcuts := groupedShortcuts[entities.GroupActions]
globalShortcuts := groupedShortcuts[entities.GroupGlobal]

viewShortcuts := groupedShortcuts[entities.GroupView]
// Global edit menu
EditMenu := AppMenu.AddSubmenu("Edit")
for _, shortcut := range globalShortcuts {
Expand All @@ -133,9 +133,11 @@ func (a *App) initializeMenu() {

// View menu
ViewMenu := AppMenu.AddSubmenu("View")
ViewMenu.AddText("Sync Scroll Position", keys.Combo("e", keys.ShiftKey, keys.CmdOrCtrlKey), func(cd *menu.CallbackData) {
runtime.EventsEmit(a.ctx, string(entities.ActionToggleSyncScrollPosition))
})
for _, shortcut := range viewShortcuts {
ViewMenu.AddText(shortcut.Name, shortcut.Accelerator, func(cd *menu.CallbackData) {
runtime.EventsEmit(a.ctx, string(shortcut.Action))
})
}

// Scan menu
ScanMenu := AppMenu.AddSubmenu("Scan")
Expand Down
12 changes: 11 additions & 1 deletion backend/entities/keyboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const (
// View
ActionToggleSyncScrollPosition Action = "toggleSyncScrollPosition"
ActionShowKeyboardShortcutsModal Action = "showKeyboardShortcutsModal"

ActionOpenSettings Action = "openSettings"
// Scan
ActionScanWithOptions Action = "scanWithOptions"
)
Expand Down Expand Up @@ -108,6 +108,7 @@ var AllShortcutActions = []struct {
{ActionToggleSyncScrollPosition, "ToggleSyncScrollPosition"},
{ActionShowKeyboardShortcutsModal, "ShowKeyboardShortcutsModal"},
{ActionScanWithOptions, "ScanWithOptions"},
{ActionOpenSettings, "OpenSettings"},
}

var DefaultShortcuts = []Shortcut{
Expand Down Expand Up @@ -291,6 +292,7 @@ var DefaultShortcuts = []Shortcut{
Action: ActionReplaceComponentWithComments,
},

// View
{
Name: "Sync Scroll Position",
Description: "Sync the scroll position of the editors",
Expand All @@ -299,6 +301,14 @@ var DefaultShortcuts = []Shortcut{
Group: GroupView,
Action: ActionToggleSyncScrollPosition,
},
{
Name: "Settings",
Description: "Open the app settings",
Accelerator: keys.CmdOrCtrl(","),
Keys: "mod+,",
Group: GroupView,
Action: ActionOpenSettings,
},

// Scan
{
Expand Down
1 change: 1 addition & 0 deletions backend/entities/result.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ type WorkflowState string
const (
Pending WorkflowState = "pending"
Completed WorkflowState = "completed"
Mixed WorkflowState = "mixed"
)

type FilterConfig struct {
Expand Down
209 changes: 209 additions & 0 deletions backend/entities/scanoss_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,3 +184,212 @@ func (sf *SettingsFile) GetBomEntryFromResult(result Result) ComponentFilter {

return ComponentFilter{}
}

var DefaultSkippedDirs = []string{
"nbproject",
"nbbuild",
"nbdist",
"__pycache__",
"venv",
"_yardoc",
"eggs",
"wheels",
"htmlcov",
"__pypackages__",
"example",
"examples",
"docs",
"tests",
"doc",
"test",
}

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",
}

var DefaultSkippedDirExtensions = []string{".egg-info"}

var DefaultSkippedExtensions = []string{
".1",
".2",
".3",
".4",
".5",
".6",
".7",
".8",
".9",
".ac",
".adoc",
".am",
".asciidoc",
".bmp",
".build",
".cfg",
".chm",
".class",
".cmake",
".cnf",
".conf",
".config",
".contributors",
".copying",
".crt",
".csproj",
".css",
".csv",
".dat",
".data",
".doc",
".docx",
".dtd",
".dts",
".iws",
".c9",
".c9revisions",
".dtsi",
".dump",
".eot",
".eps",
".geojson",
".gdoc",
".gif",
".glif",
".gmo",
".gradle",
".guess",
".hex",
".htm",
".html",
".ico",
".iml",
".in",
".inc",
".info",
".ini",
".ipynb",
".jpeg",
".jpg",
".json",
".jsonld",
".lock",
".log",
".m4",
".map",
".markdown",
".md",
".md5",
".meta",
".mk",
".mxml",
".o",
".otf",
".out",
".pbtxt",
".pdf",
".pem",
".phtml",
".plist",
".png",
".po",
".ppt",
".prefs",
".properties",
".pyc",
".qdoc",
".result",
".rgb",
".rst",
".scss",
".sha",
".sha1",
".sha2",
".sha256",
".sln",
".spec",
".sql",
".sub",
".svg",
".svn-base",
".tab",
".template",
".test",
".tex",
".tiff",
".toml",
".ttf",
".txt",
".utf-8",
".vim",
".wav",
".woff",
".woff2",
".xht",
".xhtml",
".xls",
".xlsx",
".xml",
".xpm",
".xsd",
".xul",
".yaml",
".yml",
".wfp",
".editorconfig",
".dotcover",
".pid",
".lcov",
".egg",
".manifest",
".cache",
".coverage",
".cover",
".gem",
".lst",
".pickle",
".pdb",
".gml",
".pot",
".plt",
".whml",
".pom",
".smtml",
".min.js",
".mf",
".base64",
".s",
".diff",
".patch",
".rules",
// File endings
"-doc",
"changelog",
"config",
"copying",
"license",
"authors",
"news",
"licenses",
"notice",
"readme",
"swiftdoc",
"texidoc",
"todo",
"version",
"ignore",
"manifest",
"sqlite",
"sqlite3",
}
35 changes: 35 additions & 0 deletions backend/entities/tree.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package entities

import (
"path/filepath"
)

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"`
}

type SkipState string

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

func NewTreeNode(path string, result ResultDTO, isFolder bool) TreeNode {
return TreeNode{
ID: path,
Name: filepath.Base(path),
Path: path,
IsFolder: isFolder,
WorkflowState: result.WorkflowState,
ScanningSkipState: SkipStateIncluded,
Children: make([]TreeNode, 0),
}
}
11 changes: 10 additions & 1 deletion backend/mappers/result_mapper_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,15 @@ func (m ResultMapperImpl) MapToResultDTO(result entities.Result) entities.Result
return cached.(entities.ResultDTO)
}

var detectedPurl string
if result.Purl != nil && len(*result.Purl) > 0 {
detectedPurl = (*result.Purl)[0]
}

dto := entities.ResultDTO{
MatchType: entities.MatchType(result.MatchType),
Path: result.Path,
DetectedPurl: (*result.Purl)[0],
DetectedPurl: detectedPurl,
DetectedPurlUrl: m.mapDetectedPurlUrl(result),
ConcludedPurl: bomEntry.ReplaceWith,
ConcludedPurlUrl: m.mapConcludedPurlUrl(result),
Expand Down Expand Up @@ -160,6 +165,10 @@ func (m ResultMapperImpl) getProjectURL(purl string, compute func() (string, err
}

func (m ResultMapperImpl) mapDetectedPurlUrl(result entities.Result) string {
if result.Purl == nil || len(*result.Purl) == 0 {
return ""
}

detectedPurl := (*result.Purl)[0]

purlObject, err := purlutils.PurlFromString(detectedPurl)
Expand Down
6 changes: 3 additions & 3 deletions backend/repository/component_repository_json_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ func NewJSONComponentRepository(fr utils.FileReader, resultsRepository ResultRep
}

func (r *JSONComponentRepository) FindByFilePath(path string) (entities.Component, error) {
result, err := r.resultsRepository.GetResultByPath(path)
if err != nil {
return entities.Component{}, err
result := r.resultsRepository.GetResultByPath(path)
if result == nil {
return entities.Component{}, errors.New("no result found")
}

components := result.Matches
Expand Down
Loading
Loading