Skip to content

Commit

Permalink
Remove redundant npm version log (#138)
Browse files Browse the repository at this point in the history
  • Loading branch information
sverdlov93 authored Mar 15, 2023
1 parent 7333ca4 commit ff37173
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion build/testdata/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,5 @@ func PrintBuildInfoMismatch(t *testing.T, expected, actual []entities.Module) {
assert.NoError(t, err)
actualStr, err := json.MarshalIndent(actual, "", " ")
assert.NoError(t, err)
t.Errorf("build-info don't match. want: \n %v\n got:\n%s\n", string(excpectedStr), string(actualStr))
t.Errorf("build-info don't match. want: \n%v\ngot:\n%s\n", string(excpectedStr), string(actualStr))
}
11 changes: 5 additions & 6 deletions build/utils/npm.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func CalculateNpmDependenciesList(executablePath, srcPath, moduleId string, npmA
continue
}
if calculateChecksums {
dep.Md5, dep.Sha1, dep.Sha256, err = calculateChecksum(cacache, dep.Name, dep.Version, dep.Integrity, log)
dep.Md5, dep.Sha1, dep.Sha256, err = calculateChecksum(cacache, dep.Name, dep.Version, dep.Integrity)
if err != nil {
if dep.Optional {
missingOptionalDeps = append(missingOptionalDeps, dep.Id)
Expand Down Expand Up @@ -220,7 +220,7 @@ func parseDependencies(data []byte, pathToRoot []string, dependencies map[string
}
return errors.New("failed to parse '" + string(value) + "' from npm ls output.")
}
appendDependency(dependencies, npmLsDependency, pathToRoot, log)
appendDependency(dependencies, npmLsDependency, pathToRoot)
transitive, _, _, err := jsonparser.Get(value, "dependencies")
if err != nil && err.Error() != "Key path not found" {
return err
Expand Down Expand Up @@ -256,7 +256,7 @@ func npmLsDependencyParser(data []byte) (*npmLsDependency, error) {
return npmLsDependency, json.Unmarshal(data, &npmLsDependency)
}

func appendDependency(dependencies map[string]*dependencyInfo, dep *npmLsDependency, pathToRoot []string, log utils.Log) {
func appendDependency(dependencies map[string]*dependencyInfo, dep *npmLsDependency, pathToRoot []string) {
depId := dep.id()
scopes := dep.getScopes()
if dependencies[depId] == nil {
Expand All @@ -275,7 +275,7 @@ func appendDependency(dependencies map[string]*dependencyInfo, dep *npmLsDepende
}

// Lookup for a dependency's tarball in npm cache, and calculate checksum.
func calculateChecksum(cacache *cacache, name, version, integrity string, log utils.Log) (md5 string, sha1 string, sha256 string, err error) {
func calculateChecksum(cacache *cacache, name, version, integrity string) (md5 string, sha1 string, sha256 string, err error) {
if integrity == "" {
var info *cacacheInfo
info, err = cacache.GetInfo(name + "@" + version)
Expand Down Expand Up @@ -370,7 +370,6 @@ func GetNpmVersionAndExecPath(log utils.Log) (*version.Version, string, error) {
if err != nil {
return nil, "", err
}
log.Debug("Using npm version:", string(versionData))
return version.NewVersion(string(versionData)), npmExecPath, nil
}

Expand Down Expand Up @@ -462,5 +461,5 @@ func GetNpmConfigCache(srcPath, executablePath string, npmArgs []string, log uti
}

func printMissingDependenciesWarning(dependencyType string, dependencies []string, log utils.Log) {
log.Debug("The following dependencies will not be included in the build-info, because the 'npm ls' command did not return their integrity.\nThe reason why the version wasn't returned may be because the package is a '" + dependencyType + "', which was not manually installed.\n It is therefore okay to skip this dependency: " + strings.Join(dependencies, ","))
log.Debug("The following dependencies will not be included in the build-info, because the 'npm ls' command did not return their integrity.\nThe reason why the version wasn't returned may be because the package is a '" + dependencyType + "', which was not manually installed.\nIt is therefore okay to skip this dependency: " + strings.Join(dependencies, ","))
}
1 change: 0 additions & 1 deletion utils/pythonutils/poetryutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ func extractProjectFromPyproject(pyprojectFilePath string) (project PoetryPackag
return
}
var pyprojectFile PyprojectToml

_, err = toml.Decode(string(content), &pyprojectFile)
if err != nil {
return
Expand Down

0 comments on commit ff37173

Please sign in to comment.