Skip to content

Commit b39503e

Browse files
pokeypre-commit-ci[bot]AndreasArvidsson
authored
Create codeql.yml (#1183)
## Checklist - [x] I have added [tests](https://www.cursorless.org/docs/contributing/test-case-recorder/) - [ ] I have updated the [docs](https://github.com/cursorless-dev/cursorless/tree/main/docs) and [cheatsheet](https://github.com/cursorless-dev/cursorless/tree/main/cursorless-talon/src/cheatsheet) - [ ] I have not broken the cheatsheet Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Andreas Arvidsson <andreas.arvidsson87@gmail.com>
1 parent 6450067 commit b39503e

File tree

6 files changed

+106
-6
lines changed

6 files changed

+106
-6
lines changed

.github/workflows/codeql.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
push:
16+
branches: ["main", cursorless-talon-staging]
17+
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: ["main"]
20+
schedule:
21+
- cron: "34 12 * * 5"
22+
23+
jobs:
24+
analyze:
25+
name: Analyze
26+
runs-on: ubuntu-latest
27+
permissions:
28+
actions: read
29+
contents: read
30+
security-events: write
31+
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
language: ["javascript", "python"]
36+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37+
# Use only 'java' to analyze code written in Java, Kotlin or both
38+
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
39+
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
40+
41+
steps:
42+
- name: Checkout repository
43+
uses: actions/checkout@v3
44+
45+
# Initializes the CodeQL tools for scanning.
46+
- name: Initialize CodeQL
47+
uses: github/codeql-action/init@v2
48+
with:
49+
languages: ${{ matrix.language }}
50+
# If you wish to specify custom queries, you can do so here or in a config file.
51+
# By default, queries listed here will override any specified in a config file.
52+
# Prefix the list here with "+" to use these queries and those in the config file.
53+
54+
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
55+
# queries: security-extended,security-and-quality
56+
57+
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
58+
# If this step fails, then you should remove it and run the build manually (see below)
59+
- name: Autobuild
60+
uses: github/codeql-action/autobuild@v2
61+
62+
# ℹ️ Command-line programs to run using the OS shell.
63+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
64+
65+
# If the Autobuild fails above, remove it and uncomment the following three lines.
66+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
67+
68+
# - run: |
69+
# echo "Run, Build Application using script"
70+
# ./location_of_script_within_repo/buildscript.sh
71+
72+
- name: Perform CodeQL Analysis
73+
uses: github/codeql-action/analyze@v2
74+
with:
75+
category: "/language:${{matrix.language}}"

cursorless-nx/apps/cheatsheet-local-e2e/src/support/commands.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ declare namespace Cypress {
1717
}
1818
//
1919
// -- This is a parent command --
20-
Cypress.Commands.add('login', (email, password) => {
21-
console.log('Custom command example: Login', email, password);
20+
Cypress.Commands.add('login', (_email, _password) => {
21+
// console.log('Custom command example: Login', email, password);
2222
});
2323
//
2424
// -- This is a child command --

cursorless-nx/apps/cursorless-org-e2e/src/support/commands.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ declare namespace Cypress {
1717
}
1818
//
1919
// -- This is a parent command --
20-
Cypress.Commands.add('login', (email, password) => {
21-
console.log('Custom command example: Login', email, password);
20+
Cypress.Commands.add('login', (_email, _password) => {
21+
// console.log('Custom command example: Login', email, password);
2222
});
2323
//
2424
// -- This is a child command --

src/test/runners/unitTestsOnly.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ import "module-alias/register";
44
import * as path from "path";
55
import { runAllTestsInDirs } from "../util/runAllTestsInDir";
66

7-
const testDirectories = ["../../libs/cursorless-engine", "../../libs/common"];
7+
const testDirectories = [
8+
"../../libs/cursorless-engine",
9+
"../../libs/common",
10+
"../../test/suite",
11+
];
812

913
export function run(): Promise<void> {
1014
return runAllTestsInDirs(

src/test/suite/snippetParser.test.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See https://github.com/microsoft/vscode/blob/6915debdd61d3db26c39e831babf70b573b1baf0/LICENSE.txt for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
import * as assert from "assert";
6+
import { SnippetParser } from "../../vendor/snippet/snippetParser";
7+
8+
suite("SnippetParser", () => {
9+
test("Marker, toTextmateString()", function () {
10+
function assertTextsnippetString(input: string, expected: string): void {
11+
const snippet = new SnippetParser().parse(input);
12+
const actual = snippet.toTextmateString();
13+
assert.strictEqual(actual, expected);
14+
}
15+
16+
assertTextsnippetString(
17+
"${1|cho\\,ices,wi\\|th,esc\\\\aping,chall\\\\\\,enges|}",
18+
"${1|cho\\,ices,wi\\|th,esc\\\\aping,chall\\\\\\,enges|}",
19+
);
20+
});
21+
});

src/vendor/snippet/snippetParser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ export class Choice extends Marker {
295295

296296
toTextmateString(): string {
297297
return this.options
298-
.map(option => option.value.replace(/\||,/g, '\\$&'))
298+
.map(option => option.value.replace(/\||,|\\/g, '\\$&'))
299299
.join(',');
300300
}
301301

0 commit comments

Comments
 (0)