Skip to content

Commit dfd1645

Browse files
authored
Merge pull request #267 from aeisenberg/docs
Update contributing documentation and launch config
2 parents bbbea29 + ce0f8ad commit dfd1645

File tree

5 files changed

+63
-32
lines changed

5 files changed

+63
-32
lines changed

.editorconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ indent_size = 2
44
charset = utf-8
55
end_of_line = lf
66
trim_trailing_whitespace = true
7+
insert_final_newline = true

.vscode/launch.json

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,30 @@
2323
},
2424
{
2525
"name": "Launch Unit Tests (vscode-codeql)",
26-
"type": "extensionHost",
26+
"type": "node",
2727
"request": "launch",
28-
"runtimeExecutable": "${execPath}",
28+
"program": "${workspaceFolder}/extensions/ql-vscode/node_modules/mocha/bin/_mocha",
29+
"showAsyncStacks": true,
30+
"cwd": "${workspaceFolder}/extensions/ql-vscode",
31+
"runtimeArgs": [
32+
"--inspect=9229"
33+
],
2934
"args": [
30-
"--extensionDevelopmentPath=${workspaceRoot}/dist/vscode-codeql",
31-
"--extensionTestsPath=${workspaceRoot}/extensions/ql-vscode/out/test"
35+
"--exit",
36+
"-u",
37+
"bdd",
38+
"--colors",
39+
"--diff",
40+
"-r",
41+
"ts-node/register",
42+
"test/pure-tests/**/*.ts"
3243
],
44+
"port": 9229,
3345
"stopOnEntry": false,
3446
"sourceMaps": true,
35-
"outFiles": [
36-
"${workspaceRoot}/dist/vscode-codeql/out/**/*.js",
37-
"${workspaceRoot}/dist/vscode-codeql/node_modules/semmle-bqrs/out/**/*.js",
38-
"${workspaceRoot}/dist/vscode-codeql/node_modules/semmle-io/out/**/*.js",
39-
"${workspaceRoot}/dist/vscode-codeql/node_modules/semmle-io-node/out/**/*.js",
40-
"${workspaceRoot}/dist/vscode-codeql/node_modules/semmle-vscode-utils/out/**/*.js",
41-
"${workspaceRoot}/extensions/ql-vscode/out/test/**/*.js"
42-
],
43-
"preLaunchTask": "Build"
47+
"preLaunchTask": "Build",
48+
"console": "integratedTerminal",
49+
"internalConsoleOptions": "neverOpen"
4450
},
4551
{
4652
"name": "Launch Integration Tests - No Workspace (vscode-codeql)",

CONTRIBUTING.md

Lines changed: 41 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Contributing
1+
# Contributing
22

33
[fork]: https://github.com/github/vscode-codeql/fork
44
[pr]: https://github.com/github/vscode-codeql/compare
@@ -13,19 +13,19 @@ Please note that this project is released with a [Contributor Code of Conduct][c
1313

1414
## Submitting a pull request
1515

16-
0. [Fork][fork] and clone the repository
17-
0. Set up a local build
18-
0. Create a new branch: `git checkout -b my-branch-name`
19-
0. Make your change
20-
0. Push to your fork and [submit a pull request][pr]
21-
0. Pat yourself on the back and wait for your pull request to be reviewed and merged.
16+
1. [Fork][fork] and clone the repository
17+
1. Set up a local build
18+
1. Create a new branch: `git checkout -b my-branch-name`
19+
1. Make your change
20+
1. Push to your fork and [submit a pull request][pr]
21+
1. Pat yourself on the back and wait for your pull request to be reviewed and merged.
2222

2323
Here are a few things you can do that will increase the likelihood of your pull request being accepted:
2424

25-
- Follow the [style guide][style].
26-
- Write tests. Tests that don't require the VS Code API are located [here](extensions/ql-vscode/test). Integration tests that do require the VS Code API are located [here](extensions/ql-vscode/src/vscode-tests).
27-
- Keep your change as focused as possible. If there are multiple changes you would like to make that are not dependent upon each other, consider submitting them as separate pull requests.
28-
- Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
25+
* Follow the [style guide][style].
26+
* Write tests. Tests that don't require the VS Code API are located [here](extensions/ql-vscode/test). Integration tests that do require the VS Code API are located [here](extensions/ql-vscode/src/vscode-tests).
27+
* Keep your change as focused as possible. If there are multiple changes you would like to make that are not dependent upon each other, consider submitting them as separate pull requests.
28+
* Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
2929

3030
## Setting up a local build
3131

@@ -42,12 +42,22 @@ If you plan on building from the command line, it's easiest if Rush is installed
4242
npm install -g @microsoft/rush
4343
```
4444

45+
To get started, run:
46+
47+
```shell
48+
rush update && rush build
49+
```
50+
4551
Note that when you run the `rush` command from the globally installed version, it will examine the
4652
`rushVersion` property in the repo's `rush.json`, and if it differs from the globally installed
4753
version, it will download, cache, and run the version of Rush specified in the `rushVersion`
4854
property.
4955

50-
If you plan on only building via VS Code tasks, you don't need Rush installed at all, since those
56+
A few more things to know about using rush:
57+
58+
* Avoid running `npm` for any commands that install/link dependencies
59+
* Instead use the *rush* equivalent: `rush add <package>`, `rush update`, etc.
60+
* If you plan on only building via VS Code tasks, you don't need Rush installed at all, since those
5161
tasks run `common/scripts/install-run-rush.js` to bootstrap a locally installed and cached copy of
5262
Rush.
5363

@@ -66,7 +76,7 @@ a single-project repo. With Rush, you need to do an "update" instead:
6676
##### From the command line
6777

6878
```shell
69-
$ rush update
79+
rush update
7080
```
7181

7282
#### Building all projects (instead of `gulp`)
@@ -100,6 +110,8 @@ force a full rebuild of all projects:
100110
rush rebuild --verbose
101111
```
102112

113+
Note that `rush rebuild` performs a complete rebuild, whereas `rush build` performs an incremental build and in many cases will not need to do anything at all.
114+
103115
### Installing
104116

105117
You can install the `.vsix` file from within VS Code itself, from the Extensions container in the sidebar:
@@ -118,6 +130,18 @@ $ vscode/scripts/code-cli.sh --install-extension dist/vscode-codeql-*.vsix # if
118130

119131
You can use VS Code to debug the extension without explicitly installing it. Just open this directory as a workspace in VS Code, and hit `F5` to start a debugging session.
120132

133+
### Running the unit/integration tests
134+
135+
Ensure the `CODEQL_PATH` environment variable is set to point to the `codeql` cli executable.
136+
137+
Outside of vscode, run:
138+
139+
```shell
140+
npm run test && npm run integration
141+
```
142+
143+
Alternatively, you can run the tests inside of vscode. There are several vscode launch configurations defined that run the unit and integration tests. They can all be found in the debug view.
144+
121145
## Releasing (write access required)
122146

123147
1. Trigger a release build on Actions by adding a new tag on master of the format `vxx.xx.xx`
@@ -126,10 +150,10 @@ You can use VS Code to debug the extension without explicitly installing it. Jus
126150
1. Log into the [Visual Studio Marketplace](https://marketplace.visualstudio.com/manage/publishers/github).
127151
1. Click the `...` menu in the CodeQL row and click **Update**.
128152
1. Drag the `.vsix` file you downloaded from the GitHub release into the Marketplace and click **Upload**.
129-
1. Publish the draft GitHub release and confirm the new release is marked as the latest release at https://github.com/github/vscode-codeql/releases.
153+
1. Publish the draft GitHub release and confirm the new release is marked as the latest release at <https://github.com/github/vscode-codeql/releases>.
130154

131155
## Resources
132156

133-
- [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/)
134-
- [Using Pull Requests](https://help.github.com/articles/about-pull-requests/)
135-
- [GitHub Help](https://help.github.com)
157+
* [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/)
158+
* [Using Pull Requests](https://help.github.com/articles/about-pull-requests/)
159+
* [GitHub Help](https://help.github.com)

extensions/ql-vscode/test/pure-tests/location.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import 'mocha';
33
import { LocationStyle, StringLocation, tryGetWholeFileLocation } from 'semmle-bqrs';
44

55
describe('processing string locations', function () {
6-
76
it('should detect Windows whole-file locations', function () {
87
const loc: StringLocation = {
98
t: LocationStyle.String,

tsfmt.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"newLineCharacter": "\n",
23
"indentStyle": 2,
34
"insertSpaceAfterCommaDelimiter": true,
45
"insertSpaceAfterSemicolonInForStatements": true,
@@ -15,4 +16,4 @@
1516
"insertSpaceBeforeFunctionParenthesis": false,
1617
"placeOpenBraceOnNewLineForFunctions": false,
1718
"placeOpenBraceOnNewLineForControlBlocks": false
18-
}
19+
}

0 commit comments

Comments
 (0)