diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 9737e18c692..5d9a735d379 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -40,14 +40,32 @@ "problemMatcher": [] }, { - "label": "Create change note", + "label": "Create query change note", "type": "process", "command": "python3", "args": [ "misc/scripts/create-change-note.py", "${input:language}", + "src", "${input:name}", - "${input:category}" + "${input:categoryQuery}" + ], + "presentation": { + "reveal": "never", + "close": true + }, + "problemMatcher": [] + }, + { + "label": "Create library change note", + "type": "process", + "command": "python3", + "args": [ + "misc/scripts/create-change-note.py", + "${input:language}", + "lib", + "${input:name}", + "${input:categoryLibrary}" ], "presentation": { "reveal": "never", @@ -70,25 +88,42 @@ "csharp", "python", "ruby", + "rust", "swift", ] }, { "type": "promptString", "id": "name", - "description": "Name" + "description": "Short name (kebab-case)" }, { "type": "pickString", - "id": "category", - "description": "Category", + "id": "categoryQuery", + "description": "Category (query change)", "options": [ - "minorAnalysis", - "newQuery", - "fix", - "majorAnalysis", "breaking", + "deprecated", + "newQuery", + "queryMetadata", + "majorAnalysis", + "minorAnalysis", + "fix", + ] + }, + { + "type": "pickString", + "id": "categoryLibrary", + "description": "Category (library change)", + "options": + [ + "breaking", + "deprecated", + "feature", + "majorAnalysis", + "minorAnalysis", + "fix", ] } ] diff --git a/misc/scripts/create-change-note.py b/misc/scripts/create-change-note.py index bf82b76a18a..a7a64e76f4c 100644 --- a/misc/scripts/create-change-note.py +++ b/misc/scripts/create-change-note.py @@ -4,6 +4,7 @@ # Expects to receive the following arguments: # - What language the change note is for +# - Whether it's a query or library change (the string `src` or `lib`) # - The name of the change note (in kebab-case) # - The category of the change. @@ -17,8 +18,9 @@ import os # Read the given arguments language = sys.argv[1] -change_note_name = sys.argv[2] -change_category = sys.argv[3] +subdir = sys.argv[2] +change_note_name = sys.argv[3] +change_category = sys.argv[4] # Find the root of the repository. The current script should be located in `misc/scripts`. root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) @@ -26,9 +28,11 @@ root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__) # Go to the repo root os.chdir(root) +output_dir = f"{language}/ql/{subdir}/change-notes" + # Abort if the output directory doesn't exist -if not os.path.exists(f"{language}/ql/lib/change-notes"): - print(f"Output directory {language}/ql/lib/change-notes does not exist") +if not os.path.exists(output_dir): + print(f"Output directory {output_dir} does not exist") sys.exit(1) # Get the current date @@ -36,7 +40,7 @@ import datetime current_date = datetime.datetime.now().strftime("%Y-%m-%d") # Create the change note file -change_note_file = f"{language}/ql/lib/change-notes/{current_date}-{change_note_name}.md" +change_note_file = f"{output_dir}/{current_date}-{change_note_name}.md" change_note = f""" ---