mirror of
https://github.com/github/codeql.git
synced 2025-12-16 08:43:11 +01:00
Make scripts executable
This commit is contained in:
2
misc/scripts/check-query-ids.py
Normal file → Executable file
2
misc/scripts/check-query-ids.py
Normal file → Executable file
@@ -1,3 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from pathlib import Path
|
||||
import re
|
||||
import sys
|
||||
|
||||
0
misc/scripts/create-change-note.py
Normal file → Executable file
0
misc/scripts/create-change-note.py
Normal file → Executable file
4
misc/scripts/generate-code-scanning-query-list.py
Normal file → Executable file
4
misc/scripts/generate-code-scanning-query-list.py
Normal file → Executable file
@@ -1,3 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import subprocess
|
||||
import json
|
||||
import csv
|
||||
@@ -52,7 +54,7 @@ class CodeQL:
|
||||
except:
|
||||
self.proc.kill()
|
||||
|
||||
def command(self, args):
|
||||
def command(self, args):
|
||||
data = json.dumps(args)
|
||||
data_bytes = data.encode('utf-8')
|
||||
self.proc.stdin.write(data_bytes)
|
||||
|
||||
4
misc/scripts/models-as-data/generate_flow_model.py
Normal file → Executable file
4
misc/scripts/models-as-data/generate_flow_model.py
Normal file → Executable file
@@ -140,7 +140,7 @@ Requirements: `codeql` should both appear on your path.
|
||||
generator.setenvironment(sys.argv[1], sys.argv[2])
|
||||
|
||||
return generator
|
||||
|
||||
|
||||
|
||||
def runQuery(self, query):
|
||||
print("########## Querying " + query + "...")
|
||||
@@ -224,7 +224,7 @@ extensions:
|
||||
if self.dryRun:
|
||||
print("Models as data extensions generated, but not written to file.")
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
if (self.generateSinks or
|
||||
self.generateSources or
|
||||
self.generateSummaries or
|
||||
|
||||
0
misc/scripts/pre-commit
Normal file → Executable file
0
misc/scripts/pre-commit
Normal file → Executable file
10
misc/scripts/shared-code-metrics.py
Normal file → Executable file
10
misc/scripts/shared-code-metrics.py
Normal file → Executable file
@@ -1,7 +1,7 @@
|
||||
#!/bin/env python3
|
||||
# Generates a report on the amount of code sharing in this repo
|
||||
#
|
||||
# The purpose of this is
|
||||
# The purpose of this is
|
||||
# a) To be able to understand the structure and dependencies
|
||||
# b) To provide a metric that measures the amount of shared vs non-shared code
|
||||
|
||||
@@ -224,7 +224,7 @@ for qlfile in ql_file_index.values():
|
||||
if lang in language_info:
|
||||
info = language_info[lang]
|
||||
if qlfile.isOnlyInLanguage(lang):
|
||||
info.addQlFile(qlfile)
|
||||
info.addQlFile(qlfile)
|
||||
|
||||
# Determine all package dependencies
|
||||
|
||||
@@ -276,15 +276,15 @@ def print_package_dependencies(packages):
|
||||
nlines = package.lines + package.total_imported_lines
|
||||
shared_percentage = 100 * package.total_imported_lines / nlines if nlines>0 else 0
|
||||
print('|', package.link(), '|', package.files, '|', package.lines, '|', package.total_imported_files, '|', package.total_imported_lines, '|',
|
||||
# ','.join([p.name for p in package.all_dependencies]),
|
||||
# ','.join([p.name for p in package.all_dependencies]),
|
||||
"%.2f" % shared_percentage, '|')
|
||||
print()
|
||||
|
||||
def print_language_dependencies(packages):
|
||||
print_package_dependencies([p for p in packages if p.name.endswith('-all') and p.name.count('-')==1])
|
||||
print_package_dependencies([p for p in packages if p.name.endswith('-all') and p.name.count('-')==1])
|
||||
|
||||
def list_shared_code_by_language(language_info):
|
||||
# For each language directory, list the files that are (1) inside the directory and not shared,
|
||||
# For each language directory, list the files that are (1) inside the directory and not shared,
|
||||
# (2) packages from outside the directory, plus identical files
|
||||
print('| Language | Non-shared files | Non-shared lines of code | Imported files | Imported lines of code | Shared code % |')
|
||||
print('| -------- | ---------------- | ------------------------ | -------------- | ---------------------- | ------------- |')
|
||||
|
||||
Reference in New Issue
Block a user