Skip to content

Commit

Permalink
Merge pull request #18247 from github/redsun82/executable-scripts
Browse files Browse the repository at this point in the history
Make scripts executable
  • Loading branch information
redsun82 authored Dec 11, 2024
2 parents ba9d21e + f74dcc7 commit a36d226
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 8 deletions.
2 changes: 2 additions & 0 deletions misc/scripts/check-query-ids.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env python3

from pathlib import Path
import re
import sys
Expand Down
Empty file modified misc/scripts/create-change-note.py
100644 → 100755
Empty file.
4 changes: 3 additions & 1 deletion misc/scripts/generate-code-scanning-query-list.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env python3

import subprocess
import json
import csv
Expand Down Expand Up @@ -52,7 +54,7 @@ def __exit__(self, type, value, tb):
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)
Expand Down
4 changes: 2 additions & 2 deletions misc/scripts/models-as-data/generate_flow_model.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def make(language):
generator.setenvironment(sys.argv[1], sys.argv[2])

return generator


def runQuery(self, query):
print("########## Querying " + query + "...")
Expand Down Expand Up @@ -224,7 +224,7 @@ def run(self):
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
Expand Down
Empty file modified misc/scripts/pre-commit
100644 → 100755
Empty file.
10 changes: 5 additions & 5 deletions misc/scripts/shared-code-metrics.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -224,7 +224,7 @@ def calculateDependencies(self, packageNameMap):
if lang in language_info:
info = language_info[lang]
if qlfile.isOnlyInLanguage(lang):
info.addQlFile(qlfile)
info.addQlFile(qlfile)

# Determine all package dependencies

Expand Down Expand Up @@ -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('| -------- | ---------------- | ------------------------ | -------------- | ---------------------- | ------------- |')
Expand Down

0 comments on commit a36d226

Please sign in to comment.