1515as long as you run the script from one of the following locations:
1616 - anywhere from within a clone of the CodeQL Git repo
1717 - from the parent directory of a clone of the CodeQL Git repo (assuming 'codeql'
18- and 'codeql-go' directories both exist )
18+ directory exists )
1919"""
2020
2121parser = argparse .ArgumentParser (__name__ )
@@ -75,7 +75,7 @@ def prefix_repo_nwo(filename):
7575 becomes:
7676 github/codeql/java/ql/src/MyQuery.ql
7777
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
7979 path will be truncated to the root of the git repo:
8080 ql/java/ql/src/MyQuery.ql
8181
@@ -92,13 +92,12 @@ def prefix_repo_nwo(filename):
9292
9393 git_toplevel_dir = git_toplevel_dir_subp .stdout .strip ()
9494
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'
9797 # in the URL
9898 git_remotes = subprocess_run (["git" ,"-C" ,dirname ,"remote" ,"-v" ]).stdout .strip ()
9999
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"
102101 else : prefix = os .path .basename (git_toplevel_dir )
103102
104103 return os .path .join (prefix , filename [len (git_toplevel_dir )+ 1 :])
@@ -142,9 +141,7 @@ def subprocess_run(cmd):
142141 # Define CodeQL search path so it'll find the CodeQL repositories:
143142 # - anywhere in the current Git clone (including current working directory)
144143 # - 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
148145
149146 # Extend CodeQL search path by detecting root of the current Git repo (if any). This means that you
150147 # can run this script from any location within the CodeQL git repository.
@@ -153,7 +150,7 @@ def subprocess_run(cmd):
153150
154151 # Current working directory is in a Git repo. Add it to the search path, just in case it's the CodeQL repo
155152 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
157154 except :
158155 # git rev-parse --show-toplevel exited with non-zero exit code. We're not in a Git repo
159156 pass
@@ -172,7 +169,7 @@ def subprocess_run(cmd):
172169 try :
173170 queries_subp = codeql .command (["resolve" ,"queries" ,"--search-path" , codeql_search_path , "%s-%s.qls" % (lang , pack )])
174171 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
176173 # on the search path.
177174 level = "Warning" if arguments .ignore_missing_query_packs else "Error"
178175 print (
0 commit comments