Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 81240ca

Browse filesBrowse files
committed
Add create database method
1 parent c5ea428 commit 81240ca
Copy full SHA for 81240ca

File tree

Expand file treeCollapse file tree

1 file changed

+15
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+15
-0
lines changed

‎scripts/shared/codeql.py

Copy file name to clipboardExpand all lines: scripts/shared/codeql.py
+15Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,3 +139,18 @@ def format(self, path: Path) -> None:
139139
if not result.returncode == 0:
140140
raise CodeQLError(
141141
f"Failed to format file {path}", stdout=result.stdout, stderr=result.stderr, returncode=result.returncode)
142+
143+
def create_database(self, src_root: Path, language: str, database: Path, *build_commands : str, **options: str) -> None:
144+
command = ['codeql', 'database', 'create']
145+
options['source-root'] = str(src_root)
146+
options['language'] = language
147+
148+
command_options = self.__build_command_options(**options)
149+
command.extend(command_options)
150+
command.extend([f'--command={build_command}' for build_command in build_commands])
151+
command.append(str(database))
152+
153+
result = subprocess.run(command, capture_output=True)
154+
if not result.returncode == 0:
155+
raise CodeQLError(
156+
f"Failed to build database {database} from {src_root} with language {language} and commands [{','.join(build_commands)}]", stdout=result.stdout, stderr=result.stderr, returncode=result.returncode)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.