mirror of
https://github.com/github/codeql.git
synced 2026-01-29 14:23:03 +01:00
Address review comments.
Co-authored-by: Max Schaefer <max-schaefer@github.com>
This commit is contained in:
@@ -22,14 +22,18 @@ abstract class Dependency extends Locatable {
|
||||
/** Gets the version of this dependency. */
|
||||
string getDepVersion() { this.info(_, result) }
|
||||
|
||||
/**
|
||||
* This dependency is relevant for imports in file `file`. That is, an import of this
|
||||
* dependency's path that is in `file` will use this dependency.
|
||||
*/
|
||||
abstract predicate relevantForFile(File file);
|
||||
|
||||
/**
|
||||
* An import of this dependency.
|
||||
*/
|
||||
ImportSpec getAnImport() {
|
||||
result.getPath() = this.getDepPath() and
|
||||
exists(Folder parent | parent.getAFile() = this.getFile() |
|
||||
parent.getAFolder*().getAFile() = result.getFile()
|
||||
)
|
||||
this.relevantForFile(result.getFile())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,8 +48,14 @@ class GoModDependency extends Dependency, GoModRequireLine {
|
||||
this.originalInfo(path, v)
|
||||
}
|
||||
|
||||
override predicate relevantForFile(File file) {
|
||||
exists(Folder parent | parent.getAFile() = this.getFile() |
|
||||
parent.getAFolder*().getAFile() = file
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if there is a replace line that replaces this dependency with a dependency to `path`,
|
||||
* Holds if there is a replace line that replaces this dependency with a dependency on `path`,
|
||||
* version `v`.
|
||||
*/
|
||||
predicate replacementInfo(string path, string v) {
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
/**
|
||||
* Provides classes for dealing with semantic versions, for strings that dependency's versions.
|
||||
*/
|
||||
|
||||
import semmle.go.dependencies.Dependencies
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user