15
15
as long as you run the script from one of the following locations:
16
16
- anywhere from within a clone of the CodeQL Git repo
17
17
- from the parent directory of a clone of the CodeQL Git repo (assuming 'codeql'
18
- and 'codeql-go' directories both exist )
18
+ directory exists )
19
19
"""
20
20
21
21
parser = argparse .ArgumentParser (__name__ )
@@ -75,7 +75,7 @@ def prefix_repo_nwo(filename):
75
75
becomes:
76
76
github/codeql/java/ql/src/MyQuery.ql
77
77
78
- If we can't detect a known NWO (e.g. github/codeql, github/codeql-go ), the
78
+ If we can't detect a known NWO (e.g. github/codeql), the
79
79
path will be truncated to the root of the git repo:
80
80
ql/java/ql/src/MyQuery.ql
81
81
@@ -92,13 +92,12 @@ def prefix_repo_nwo(filename):
92
92
93
93
git_toplevel_dir = git_toplevel_dir_subp .stdout .strip ()
94
94
95
- # Detect 'github/codeql' and 'github/codeql-go' repositories by checking the remote (it's a bit
96
- # of a hack but will work in most cases, as long as the remotes have 'codeql' and 'codeql-go'
95
+ # Detect 'github/codeql' repository by checking the remote (it's a bit
96
+ # of a hack but will work in most cases, as long as the remotes have 'codeql'
97
97
# in the URL
98
98
git_remotes = subprocess_run (["git" ,"-C" ,dirname ,"remote" ,"-v" ]).stdout .strip ()
99
99
100
- if "codeql-go" in git_remotes : prefix = "github/codeql-go"
101
- elif "codeql" in git_remotes : prefix = "github/codeql"
100
+ if "codeql" in git_remotes : prefix = "github/codeql"
102
101
else : prefix = os .path .basename (git_toplevel_dir )
103
102
104
103
return os .path .join (prefix , filename [len (git_toplevel_dir )+ 1 :])
@@ -142,9 +141,7 @@ def subprocess_run(cmd):
142
141
# Define CodeQL search path so it'll find the CodeQL repositories:
143
142
# - anywhere in the current Git clone (including current working directory)
144
143
# - the 'codeql' subdirectory of the cwd
145
- #
146
- # (and assumes the codeql-go repo is in a similar location)
147
- codeql_search_path = "./codeql:./codeql-go:." # will be extended further down
144
+ codeql_search_path = "./codeql:." # will be extended further down
148
145
149
146
# Extend CodeQL search path by detecting root of the current Git repo (if any). This means that you
150
147
# can run this script from any location within the CodeQL git repository.
@@ -153,7 +150,7 @@ def subprocess_run(cmd):
153
150
154
151
# Current working directory is in a Git repo. Add it to the search path, just in case it's the CodeQL repo
155
152
git_toplevel_dir = git_toplevel_dir .stdout .strip ()
156
- codeql_search_path += ":" + git_toplevel_dir + ":" + git_toplevel_dir + "/../codeql-go"
153
+ codeql_search_path += ":" + git_toplevel_dir
157
154
except :
158
155
# git rev-parse --show-toplevel exited with non-zero exit code. We're not in a Git repo
159
156
pass
@@ -172,7 +169,7 @@ def subprocess_run(cmd):
172
169
try :
173
170
queries_subp = codeql .command (["resolve" ,"queries" ,"--search-path" , codeql_search_path , "%s-%s.qls" % (lang , pack )])
174
171
except Exception as e :
175
- # Resolving queries might go wrong if the github/codeql and github/codeql-go repositories are not
172
+ # Resolving queries might go wrong if the github/codeql repository is not
176
173
# on the search path.
177
174
level = "Warning" if arguments .ignore_missing_query_packs else "Error"
178
175
print (
0 commit comments