mirror of
https://github.com/github/codeql.git
synced 2026-05-03 04:39:29 +02:00
Python: Minor cleanup
This commit is contained in:
@@ -74,7 +74,7 @@ class File extends Container {
|
||||
string getContents() { file_contents(this, result) }
|
||||
|
||||
/** Holds if this file is likely to get executed directly, and thus act as an entry point for execution. */
|
||||
predicate maybeExecutedDirectly() {
|
||||
predicate isPossibleEntryPoint() {
|
||||
// Only consider files in the source code, and not things like the standard library
|
||||
exists(this.getRelativePath()) and
|
||||
(
|
||||
@@ -148,9 +148,6 @@ class Folder extends Container {
|
||||
this.getBaseName().regexpMatch("[^\\d\\W]\\w*") and
|
||||
result = this.getParent().getImportRoot(n)
|
||||
}
|
||||
|
||||
/** Holds if execution may start in a file in this directory. */
|
||||
predicate mayContainEntryPoint() { any(File f | f.getParent() = this).maybeExecutedDirectly() }
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -211,7 +211,7 @@ private predicate transitively_imported_from_entry_point(File file) {
|
||||
importer.getParent() = file.getParent() and
|
||||
exists(ImportExpr i | i.getLocation().getFile() = importer and i.getName() = file.getStem())
|
||||
|
|
||||
importer.maybeExecutedDirectly() or transitively_imported_from_entry_point(importer)
|
||||
importer.isPossibleEntryPoint() or transitively_imported_from_entry_point(importer)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user