Skip to content

Commit

Permalink
source path fixed to relative
Browse files Browse the repository at this point in the history
  • Loading branch information
Rchanger committed Jul 15, 2021
1 parent 67b3ac1 commit 79a6294
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion pkg/iac-providers/docker/v1/load-dir.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,23 @@ func (dc *DockerV1) LoadIacDir(absRootDir string, nonRecursive bool) (output.All
continue
}
minSeverity, maxSeverity := utils.GetMinMaxSeverity(comments)
sourcePath := file
sourcePath, err = filepath.Rel(absRootDir, file)
if err != nil {
zap.S().Debug("error while getting the relative path for", zap.String("IAC file", file), zap.Error(err))
}
config := output.ResourceConfig{
Name: *files[i],
Type: resourceTypeDockerfile,
Line: 1,
ID: dockerDirectory + "." + GetresourceIdforDockerfile(file),
Source: file,
Source: sourcePath,
Config: data,
SkipRules: utils.GetSkipRules(comments),
MinSeverity: minSeverity,
MaxSeverity: maxSeverity,
}

allResourcesConfig[dockerDirectory] = append(allResourcesConfig[dockerDirectory], config)
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/iac-providers/docker/v1/load-file.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func (dc *DockerV1) LoadIacFile(absFilePath string) (allResourcesConfig output.A
Type: resourceTypeDockerfile,
Line: 1,
ID: dockerDirectory + "." + GetresourceIdforDockerfile(absFilePath),
Source: absFilePath,
Source: filepath.Base(absFilePath),
Config: data,
SkipRules: utils.GetSkipRules(comments),
MinSeverity: minSeverity,
Expand Down

0 comments on commit 79a6294

Please sign in to comment.