mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
Move TransformPath into FileLabelFor
This way we don't have to remember to transform it at all call sites.
This commit is contained in:
@@ -815,12 +815,12 @@ func (extraction *Extraction) extractFileInfo(tw *trap.Writer, file string, isDu
|
|||||||
displayPath = rawPath
|
displayPath = rawPath
|
||||||
}
|
}
|
||||||
if i == len(components)-1 {
|
if i == len(components)-1 {
|
||||||
lbl := tw.Labeler.FileLabelFor(path)
|
lbl := tw.Labeler.FileLabelFor(file)
|
||||||
dbscheme.FilesTable.Emit(tw, lbl, displayPath)
|
dbscheme.FilesTable.Emit(tw, lbl, displayPath)
|
||||||
dbscheme.ContainerParentTable.Emit(tw, parentLbl, lbl)
|
dbscheme.ContainerParentTable.Emit(tw, parentLbl, lbl)
|
||||||
dbscheme.HasLocationTable.Emit(tw, lbl, emitLocation(tw, lbl, 0, 0, 0, 0))
|
dbscheme.HasLocationTable.Emit(tw, lbl, emitLocation(tw, lbl, 0, 0, 0, 0))
|
||||||
extraction.Lock.Lock()
|
extraction.Lock.Lock()
|
||||||
slbl := extraction.StatWriter.Labeler.FileLabelFor(path)
|
slbl := extraction.StatWriter.Labeler.FileLabelFor(file)
|
||||||
if !isDummy {
|
if !isDummy {
|
||||||
dbscheme.CompilationCompilingFilesTable.Emit(extraction.StatWriter, extraction.Label, extraction.GetFileIdx(file), slbl)
|
dbscheme.CompilationCompilingFilesTable.Emit(extraction.StatWriter, extraction.Label, extraction.GetFileIdx(file), slbl)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,14 +69,14 @@ func (l *Labeler) GlobalID(key string) Label {
|
|||||||
// FileLabel returns the label for a file with path `path`.
|
// FileLabel returns the label for a file with path `path`.
|
||||||
func (l *Labeler) FileLabel() Label {
|
func (l *Labeler) FileLabel() Label {
|
||||||
if l.fileLabel == InvalidLabel {
|
if l.fileLabel == InvalidLabel {
|
||||||
l.fileLabel = l.FileLabelFor(srcarchive.TransformPath(l.tw.path))
|
l.fileLabel = l.FileLabelFor(l.tw.path)
|
||||||
}
|
}
|
||||||
return l.fileLabel
|
return l.fileLabel
|
||||||
}
|
}
|
||||||
|
|
||||||
// FileLabelFor returns the label for the file for which the trap writer `tw` is associated
|
// FileLabelFor returns the label for the file for which the trap writer `tw` is associated
|
||||||
func (l *Labeler) FileLabelFor(path string) Label {
|
func (l *Labeler) FileLabelFor(path string) Label {
|
||||||
return l.GlobalID(util.EscapeTrapSpecialChars(filepath.ToSlash(path)) + ";sourcefile")
|
return l.GlobalID(util.EscapeTrapSpecialChars(filepath.ToSlash(srcarchive.TransformPath(path))) + ";sourcefile")
|
||||||
}
|
}
|
||||||
|
|
||||||
// LocalID associates a label with the given AST node `nd` and returns it
|
// LocalID associates a label with the given AST node `nd` and returns it
|
||||||
|
|||||||
Reference in New Issue
Block a user