Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit the length of the RequestedBy field #59

Merged
merged 1 commit into from
Feb 22, 2022
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
6 changes: 3 additions & 3 deletions build/golang.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,13 @@ func populateZip(packageId, zipPath string) (zipDependency entities.Dependency,
func populateRequestedByField(parentId string, parentRequestedBy [][]string, dependenciesMap map[string]entities.Dependency, dependenciesGraph map[string][]string) {
for _, childName := range dependenciesGraph[parentId] {
if childDep, ok := dependenciesMap[childName]; ok {
if childDep.NodeHasLoop() || len(childDep.RequestedBy) >= entities.RequestedByMaxLength {
continue
}
for _, requestedBy := range parentRequestedBy {
childRequestedBy := append([]string{parentId}, requestedBy...)
childDep.RequestedBy = append(childDep.RequestedBy, childRequestedBy)
}
if childDep.NodeHasLoop() {
continue
}
// Reassign map entry with new entry copy
dependenciesMap[childName] = childDep
// Run recursive call on child dependencies
Expand Down
5 changes: 3 additions & 2 deletions entities/buildinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ import (
type ModuleType string

const (
TimeFormat = "2006-01-02T15:04:05.000-0700"
BuildInfoEnvPrefix = "buildInfo.env."
TimeFormat = "2006-01-02T15:04:05.000-0700"
BuildInfoEnvPrefix = "buildInfo.env."
RequestedByMaxLength = 10

// Build type
Build ModuleType = "build"
Expand Down