Files
vscode-codeql/CONTRIBUTING.md
Andrew Eisenberg 50efdea9d6 Remove build before launch in launch.json
And update contributing with new instructions.
2020-10-13 11:35:40 -07:00

5.6 KiB

Contributing

Hi there! We're thrilled that you'd like to contribute to this project. Your help is essential for keeping it great.

Contributions to this project are released to the public under the project's open source license.

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

Submitting a pull request

  1. Fork and clone the repository
  2. Set up a local build
  3. Create a new branch: git checkout -b my-branch-name
  4. Make your change
  5. Push to your fork and submit a pull request
  6. Pat yourself on the back and wait for your pull request to be reviewed and merged.

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

  • Follow the style guide.
  • Write tests. Tests that don't require the VS Code API are located here. Integration tests that do require the VS Code API are located here.
  • 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.
  • Write a good commit message.

Setting up a local build

Make sure you have a fairly recent version of vscode (>1.32) and are using nodejs version >=v10.13.0. (Tested on v10.15.1 and v10.16.0).

Installing all packages

From the command line, go to the directory extensions/ql-vscode and run

npm install

Building the extension

From the command line, go to the directory extensions/ql-vscode and run

npm run build
npm run watch

Alternatively, you can build the extension within VS Code via Terminal > Run Build Task... (or Ctrl+Shift+B with the default key bindings). And you can run the watch command via Terminal > Run Task and then select npm watch from the menu.

Before running any of the launch commands, be sure to have run the build command to ensure that the JavaScript is compiled and the resources are copied to the proper location.

We recommend that you keepnpm run watch running in the backgound and you only need to re-run npm run build in the following situations:

  1. on first checkout
  2. whenever any of the non-TypeScript resources have changed
  3. on any change to files included in the webview

Installing the extension

You can install the .vsix file from within VS Code itself, from the Extensions container in the sidebar:

More Actions... (top right) > Install from VSIX...

Or, from the command line, use something like (depending on where you have VSCode installed):

$ code --install-extension dist/vscode-codeql-*.vsix # normal VSCode installation
# or maybe
$ vscode/scripts/code-cli.sh --install-extension dist/vscode-codeql-*.vsix # if you're using the open-source version from a checkout of https://github.com/microsoft/vscode

Debugging

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.

Running the unit/integration tests

Ensure the CODEQL_PATH environment variable is set to point to the codeql cli executable.

Outside of vscode, run:

npm run test && npm run integration

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.

Releasing (write access required)

  1. Double-check the CHANGELOG.md contains all desired change comments and has the version to be released with date at the top.
  2. Double-check that the extension package.json has the version you intend to release. If you are doing a patch release (as opposed to minor or major version) this should already be correct.
  3. Trigger a release build on Actions by adding a new tag on branch main of the format vxx.xx.xx
  4. Monitor the status of the release build in the Release workflow in the Actions tab.
  5. Download the VSIX from the draft GitHub release at the top of the releases page that is created when the release build finishes.
  6. Optionally unzip the .vsix and inspect its package.json to make sure the version is what you expect, or look at the source if there's any doubt the right code is being shipped.
  7. Log into the Visual Studio Marketplace.
  8. Click the ... menu in the CodeQL row and click Update.
  9. Drag the .vsix file you downloaded from the GitHub release into the Marketplace and click Upload.
  10. Go to the draft GitHub release, click 'Edit', add some summary description, and publish it.
  11. Confirm the new release is marked as the latest release at https://github.com/github/vscode-codeql/releases.
  12. If documentation changes need to be published, notify documentation team that release has been made.
  13. Review and merge the version bump PR that is automatically created by Actions.

Resources