Compare commits

...

831 Commits

Author SHA1 Message Date
Anders Starcke Henriksen
bb796b0c27 v1.12.3
Some checks failed
Release / Release (push) Has been cancelled
Release / Publish to VS Code Marketplace (push) Has been cancelled
Release / Publish to Open VSX Registry (push) Has been cancelled
2024-02-29 10:24:32 +01:00
Koen Vlaswinkel
f73ea67967 Merge pull request #3413 from github/koesie10/fix-tests-with-warnings
Show test results for tests with warnings
2024-02-28 16:02:32 +01:00
Koen Vlaswinkel
eaa432b9d7 Add tests for new test warning behavior 2024-02-28 14:01:06 +01:00
Charis Kyriakou
23bbff230f Update variant analysis monitor to get the whole variant analysis object (#3415) 2024-02-28 12:12:27 +00:00
Charis Kyriakou
b884cff14d Some restructuring around variant analysis mapper functions (#3412) 2024-02-28 11:45:49 +00:00
Koen Vlaswinkel
359ee76d52 Merge pull request #3401 from github/koesie10/hide-generated-type-models
Generate separate file for generated type models in Ruby by default
2024-02-28 11:47:58 +01:00
Koen Vlaswinkel
d14c7b4114 Show test results for tests with warnings 2024-02-28 10:47:29 +01:00
Charis Kyriakou
ab36153511 Minor renames in variant analysis monitor tests (#3411)
* Rename mockGetVariantAnalysis -> mockGetVariantAnalysisFromApi

* Rename mockEecuteCommand -> mockExecuteCommand
2024-02-28 09:12:26 +00:00
Koen Vlaswinkel
0599adccc0 Fix generated text
Co-authored-by: Shati Patel <42641846+shati-patel@users.noreply.github.com>
2024-02-28 09:58:33 +01:00
Charis Kyriakou
e86127672a Drop async from some functions that are not async (#3410) 2024-02-27 16:57:53 +00:00
Charis Kyriakou
040c7fc726 Add support for 'canceling' status for variant analysis (#3405) 2024-02-27 16:32:24 +00:00
Charis Kyriakou
5f047386c9 Rename getVariantAnalysis to tryGetVariantAnalysis (#3409) 2024-02-27 14:31:43 +00:00
Charis Kyriakou
a416bcf544 Rename variable in variant analysis manager (#3408) 2024-02-27 14:07:12 +00:00
Robert
c45a8158a3 Merge pull request #3395 from github/robertbrignull/set-modeled-and-modified-methods
Set modeled methods and modified methods together
2024-02-26 13:24:39 +00:00
Robert
a74e36314c Update extensions/ql-vscode/test/__mocks__/model-editor/modelingEventsMock.ts
Co-authored-by: Koen Vlaswinkel <koesie10@users.noreply.github.com>
2024-02-26 13:11:22 +00:00
Robert
7fac0405b3 Remove dedicated modified methods event 2024-02-26 11:22:46 +00:00
Robert
7c77b39d30 Rename to ModeledAndModifiedMethodsChanged 2024-02-26 11:22:44 +00:00
Robert
1567d83463 modifiedMethodSignatures is always defined 2024-02-26 11:22:41 +00:00
Koen Vlaswinkel
7dceded98c Use showTypeModels setting instead of canary mode 2024-02-26 12:11:16 +01:00
Robert
ec67df3373 Merge branch 'main' into robertbrignull/set-modeled-and-modified-methods 2024-02-26 11:06:34 +00:00
Robert
6e61ddb0f2 Merge pull request #3398 from github/robertbrignull/sort-in-modeling-store
Move all sorting to the modeling store, and then all views preserve the sorting
2024-02-26 11:05:59 +00:00
Koen Vlaswinkel
32d981ace4 Merge remote-tracking branch 'origin/main' into koesie10/hide-generated-type-models 2024-02-26 11:59:23 +01:00
Koen Vlaswinkel
1da465f7df Merge pull request #3399 from github/koesie10/hide-type-models-non-canary
Hide type models for Ruby by default
2024-02-26 11:58:30 +01:00
Koen Vlaswinkel
713ca9f785 Fix test names 2024-02-26 11:45:23 +01:00
Robert
9a5654648d Rename to createGroups 2024-02-26 10:35:51 +00:00
Robert
a1c84ac689 Reorder expected test data 2024-02-26 10:32:46 +00:00
Koen Vlaswinkel
7591c65db2 Add showTypeModels setting 2024-02-26 11:19:23 +01:00
Koen Vlaswinkel
c8ec1d6ea3 Merge remote-tracking branch 'origin/main' into koesie10/hide-type-models-non-canary 2024-02-26 11:07:54 +01:00
Koen Vlaswinkel
8063d6c46b Merge pull request #3402 from github/koesie10/simplify-multiple-modeled-methods-panel-spec
Reduce repetition in `MultipleModeledMethodsPanel.spec.tsx`
2024-02-23 16:32:45 +01:00
Koen Vlaswinkel
48718ca2e6 Reduce repetition in MultipleModeledMethodsPanel.spec.tsx 2024-02-23 15:47:40 +01:00
Koen Vlaswinkel
22024462fb Generate separate file for generated type models in Ruby 2024-02-23 15:38:12 +01:00
Koen Vlaswinkel
b4a9ef0d4c Merge pull request #3400 from github/koesie10/refactor-yaml-save
Extract saving of model extension YAML file
2024-02-23 15:24:16 +01:00
Koen Vlaswinkel
5468aef458 Extract saving of model extension YAML file 2024-02-23 14:38:12 +01:00
Charis Kyriakou
f4a866b04b Add logic to trigger model evaluation run (#3397) 2024-02-23 11:17:25 +00:00
Koen Vlaswinkel
f57d4418c7 Hide type models for Ruby in non-canary mode 2024-02-23 10:32:17 +01:00
Chris Smowton
a62522ec67 Merge pull request #3388 from github/github-action/bump-cli
Bump CLI Version to v2.16.3 for integration tests
2024-02-23 09:28:01 +00:00
Koen Vlaswinkel
6031d9b496 Merge pull request #3394 from github/koesie10/auto-run-generate-ruby-type-models
Auto-generate type models for Ruby
2024-02-23 10:15:05 +01:00
Koen Vlaswinkel
c216b52c8d Merge pull request #3370 from github/koesie10/model-pack-mrva-test
Add test for model packs in MRVA to test plan
2024-02-23 10:14:55 +01:00
Robert
ff685f0233 Move all sorting to the modeling store, and then all views preserve the sorting 2024-02-22 17:20:36 +00:00
Charis Kyriakou
948c1e2eb7 Add model evaluation run to store and view (#3385) 2024-02-22 16:28:32 +00:00
Robert
5ce09e6ccc Include modifiedMethodSignatures in SetModeledMethodsMessage 2024-02-22 15:45:57 +00:00
Robert
8832655c2f Add modifiedMethodSignatures to ModeledMethodsChangedEvent 2024-02-22 15:45:53 +00:00
Koen Vlaswinkel
e408c0ac95 Auto-generate type models for Ruby 2024-02-22 16:44:03 +01:00
dependabot[bot]
07d9c4efc4 Bump @storybook/components from 7.6.7 to 7.6.17 in /extensions/ql-vscode (#3393)
Bumps [@storybook/components](https://github.com/storybookjs/storybook/tree/HEAD/code/ui/components) from 7.6.7 to 7.6.17.
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v7.6.17/code/ui/components)

---
updated-dependencies:
- dependency-name: "@storybook/components"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-22 06:23:26 -08:00
dependabot[bot]
98491fb1dc Bump @typescript-eslint/parser in /extensions/ql-vscode (#3392)
Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 6.16.0 to 6.21.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.21.0/packages/parser)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-22 06:23:05 -08:00
dependabot[bot]
5c305f96de Bump @faker-js/faker from 8.3.1 to 8.4.1 in /extensions/ql-vscode (#3391)
Bumps [@faker-js/faker](https://github.com/faker-js/faker) from 8.3.1 to 8.4.1.
- [Release notes](https://github.com/faker-js/faker/releases)
- [Changelog](https://github.com/faker-js/faker/blob/next/CHANGELOG.md)
- [Commits](https://github.com/faker-js/faker/compare/v8.3.1...v8.4.1)

---
updated-dependencies:
- dependency-name: "@faker-js/faker"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-22 06:22:45 -08:00
dependabot[bot]
4b64e98e9f Bump @testing-library/react in /extensions/ql-vscode (#3390)
Bumps [@testing-library/react](https://github.com/testing-library/react-testing-library) from 14.1.2 to 14.2.1.
- [Release notes](https://github.com/testing-library/react-testing-library/releases)
- [Changelog](https://github.com/testing-library/react-testing-library/blob/main/CHANGELOG.md)
- [Commits](https://github.com/testing-library/react-testing-library/compare/v14.1.2...v14.2.1)

---
updated-dependencies:
- dependency-name: "@testing-library/react"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-22 06:22:18 -08:00
dependabot[bot]
2b14639c80 Bump chokidar from 3.5.3 to 3.6.0 in /extensions/ql-vscode (#3389)
Bumps [chokidar](https://github.com/paulmillr/chokidar) from 3.5.3 to 3.6.0.
- [Release notes](https://github.com/paulmillr/chokidar/releases)
- [Commits](https://github.com/paulmillr/chokidar/compare/3.5.3...3.6.0)

---
updated-dependencies:
- dependency-name: chokidar
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-22 06:21:58 -08:00
Koen Vlaswinkel
b826ed3d9c Merge pull request #3373 from github/koesie10/download-timeout
Add timeouts to downloading databases and the CLI
2024-02-22 13:39:38 +01:00
Robert
63de6cece5 Allow changeModeledMethods to also call fireModifiedMethodsChangedEvent 2024-02-22 12:36:06 +00:00
Robert
59118f63aa Change addModeledMethods and updateModeledMethods to also set methods as modified 2024-02-22 12:31:17 +00:00
Robert
91e59323f3 Delete setModifiedMethods as it is unused 2024-02-22 12:31:17 +00:00
Koen Vlaswinkel
54e1275f68 Merge pull request #3387 from github/koesie10/update-ruby-generate-query-constraints
Update Ruby model generation query constraints
2024-02-22 13:27:43 +01:00
Koen Vlaswinkel
9437cd094b Update CHANGELOG 2024-02-22 13:25:03 +01:00
github-actions[bot]
6161c7d3d4 Bump CLI version from v2.16.2 to v2.16.3 for integration tests 2024-02-22 11:54:32 +00:00
Koen Vlaswinkel
873ccaa7fd Update Ruby model generation query constraints 2024-02-22 12:09:00 +01:00
Robert
7a2688edac Merge pull request #3382 from github/robertbrignull/automodel-sort-order
Update method sort order to place auto-model predictions earlier
2024-02-22 11:00:51 +00:00
Koen Vlaswinkel
bf35909375 Merge pull request #3380 from github/koesie10/processed-method-modeling
Add processed by auto model state to method modeling panel
2024-02-22 09:34:55 +01:00
Robert
4096ded330 Merge branch 'main' into robertbrignull/automodel-sort-order 2024-02-21 17:38:50 +00:00
Robert
fee7eae702 Merge pull request #3377 from github/robertbrignull/disable-automodel-button
Disable the automodel button if there are no methods that can be modeled
2024-02-21 16:11:21 +00:00
Koen Vlaswinkel
2c6eb3c832 Fix incorrect modelPending prop 2024-02-21 16:24:11 +01:00
Robert
2fdafaf616 Move getCandidates to the shared directory 2024-02-21 12:29:43 +00:00
Robert
b59437e7dc Cover in unit test that unmodeled and unsaved manual models are sorted together 2024-02-21 11:49:13 +00:00
Charis Kyriakou
e78f7e62fb Moved logic to get standard pack for variant analysis (#3384) 2024-02-21 11:42:08 +00:00
Robert
759f8d4768 Give test methods signatures that'll be easier to identify 2024-02-21 11:39:54 +00:00
Robert
3ca4c7623e Update sort order for supported methods and unsaved manual models 2024-02-21 11:38:58 +00:00
Robert
7a68fcd05d Add comment explaining sort order more 2024-02-21 10:40:38 +00:00
Robert
1bad26a67d Merge branch 'main' into robertbrignull/automodel-sort-order 2024-02-21 10:33:27 +00:00
Koen Vlaswinkel
db73cfeb76 Merge pull request #3378 from github/koesie10/ignore-more-location-indexes
Ignore more location indexes in SARIF comparison
2024-02-21 10:37:47 +01:00
Koen Vlaswinkel
3d2d86bf6e Merge pull request #3379 from github/koesie10/italic-model-pending
Show auto-model negative predictions in italics
2024-02-21 09:55:29 +01:00
Charis Kyriakou
0533dad9ea Add progress ring in 'stop evaluation' button (#3383) 2024-02-20 16:44:47 +00:00
Robert
95fd015414 Add unit tests of method sorting 2024-02-20 16:07:03 +00:00
Robert
70a64886d6 Rename + expand existing helper for shuffling lists 2024-02-20 15:19:01 +00:00
Charis Kyriakou
46a15bfdd6 Add dummy model evaluation buttons to model editor (#3381) 2024-02-20 14:50:15 +00:00
Robert
14dbb65f50 Change sort order to place AI predictions at the start 2024-02-20 14:38:30 +00:00
Robert
8f3ab61422 Perform filtering before sorting when determining auto-model candidates 2024-02-20 14:24:13 +00:00
Koen Vlaswinkel
409c89653c Add processed by auto model state to method modeling panel 2024-02-20 15:05:49 +01:00
Robert
3598b1871f Merge pull request #3376 from github/robertbrignull/dont-model-twice
Don't send methods to AutoModel more than once
2024-02-20 13:57:17 +00:00
Robert
e3d9efef06 Use anonymous function instead of direct function reference 2024-02-20 13:35:27 +00:00
Koen Vlaswinkel
694bb21713 Ignore more location indexes in SARIF comparison 2024-02-20 14:32:41 +01:00
Robert
d6c5ebe73a Pass methodSignatures to getProcessedByAutoModelMethods 2024-02-20 13:27:09 +00:00
Koen Vlaswinkel
899b159209 Use auto-model status for determining model pending 2024-02-20 14:22:31 +01:00
Koen Vlaswinkel
545311f26d Switch from model accepted to model pending 2024-02-20 14:17:25 +01:00
Robert
d9ae0c6d17 Disable the automodel button if there are no methods that can be modeled 2024-02-20 12:34:49 +00:00
Koen Vlaswinkel
4727e0ecab Merge pull request #3375 from github/koesie10/react-processed-by-auto-model
Add `processedByAutoModelMethods` state to React view
2024-02-20 13:11:24 +01:00
Robert
dbdb561598 Don't send methods to AutoModel more than once 2024-02-20 12:06:07 +00:00
Koen Vlaswinkel
bca4910bf2 Add processedByAutoModelMethods state to React view 2024-02-20 12:15:57 +01:00
Robert
3b30f22143 Merge pull request #3374 from github/robertbrignull/sentToLLMMethods
Add sentToLLM to ModelingStore
2024-02-20 10:05:27 +00:00
Robert
67f46b7fb2 Add processedByAUtoModel to modelingEventsMock 2024-02-20 09:47:37 +00:00
Robert
f98c5319cb Rename to processedByAutoModel 2024-02-20 09:44:25 +00:00
Koen Vlaswinkel
7cd43cd894 Merge pull request #3369 from github/koesie10/stream-cli-output
Stream CLI server command stderr instead of buffering
2024-02-20 09:29:39 +01:00
Robert
4c4820f76a add sentToLLM to ModelingStore 2024-02-19 16:48:40 +00:00
Koen Vlaswinkel
1b66767d43 Simplify stderr buffers and EOL splitting
Co-authored-by: Robert <robertbrignull@github.com>
2024-02-19 16:40:28 +01:00
Koen Vlaswinkel
1a9c792756 Extract timeout and apply to it to CLI downloads 2024-02-19 16:11:53 +01:00
Koen Vlaswinkel
feeb9d68b7 Add timeout to downloading databases 2024-02-19 14:10:28 +01:00
Robert
58b26d2b41 Merge pull request #3363 from github/robertbrignull/database-picker
Small usability improvements to database picker
2024-02-19 10:52:31 +00:00
Robert
0f18c841dc Update placeholder text 2024-02-19 10:39:29 +00:00
Koen Vlaswinkel
67870cac08 Merge pull request #3372 from github/koesie10/upgrade-ip
Upgrade ip package
2024-02-19 10:37:33 +01:00
Koen Vlaswinkel
3de57d82ab Upgrade ip package 2024-02-19 09:44:30 +01:00
Charis Kyriakou
60e497a763 Remove support for CodeQL CLI v2.12.7 and v2.11.6 (#3371) 2024-02-16 16:22:02 +00:00
Koen Vlaswinkel
abda1baca7 Add test for model packs in MRVA to test plan 2024-02-16 13:45:35 +01:00
Koen Vlaswinkel
5ddc3c11d3 Stream CLI server command stderr instead of buffering 2024-02-16 13:14:39 +01:00
dependabot[bot]
d2f4cd12a1 Bump @storybook/addon-a11y in /extensions/ql-vscode (#3364)
Bumps [@storybook/addon-a11y](https://github.com/storybookjs/storybook/tree/HEAD/code/addons/a11y) from 7.6.13 to 7.6.15.
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v7.6.15/code/addons/a11y)

---
updated-dependencies:
- dependency-name: "@storybook/addon-a11y"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-16 02:26:16 -08:00
dependabot[bot]
01b53f1709 Bump @testing-library/jest-dom in /extensions/ql-vscode (#3368)
Bumps [@testing-library/jest-dom](https://github.com/testing-library/jest-dom) from 6.2.0 to 6.4.2.
- [Release notes](https://github.com/testing-library/jest-dom/releases)
- [Changelog](https://github.com/testing-library/jest-dom/blob/main/CHANGELOG.md)
- [Commits](https://github.com/testing-library/jest-dom/compare/v6.2.0...v6.4.2)

---
updated-dependencies:
- dependency-name: "@testing-library/jest-dom"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-16 08:42:03 +00:00
dependabot[bot]
2224ff936f Bump storybook from 7.6.10 to 7.6.15 in /extensions/ql-vscode (#3366)
Bumps [storybook](https://github.com/storybookjs/storybook/tree/HEAD/code/lib/cli) from 7.6.10 to 7.6.15.
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v7.6.15/code/lib/cli)

---
updated-dependencies:
- dependency-name: storybook
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-16 08:40:59 +00:00
dependabot[bot]
29cbe9a273 Bump mini-css-extract-plugin in /extensions/ql-vscode (#3365)
Bumps [mini-css-extract-plugin](https://github.com/webpack-contrib/mini-css-extract-plugin) from 2.7.7 to 2.8.0.
- [Release notes](https://github.com/webpack-contrib/mini-css-extract-plugin/releases)
- [Changelog](https://github.com/webpack-contrib/mini-css-extract-plugin/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack-contrib/mini-css-extract-plugin/compare/v2.7.7...v2.8.0)

---
updated-dependencies:
- dependency-name: mini-css-extract-plugin
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-16 08:40:26 +00:00
Shati Patel
f1cc347e2a Add "short-paths" test (#3350) 2024-02-15 16:09:35 +00:00
Shati Patel
b7010aa102 Replace deprecated telemetry setting in the tests (#3362) 2024-02-15 10:22:08 +00:00
Charis Kyriakou
574ba177cd Tidy up auto-modeling rate limit error message (#3361) 2024-02-15 08:28:50 +00:00
Robert
d440c1080c Make placeholder messages more descriptive 2024-02-14 17:08:43 +00:00
Robert
bb1bd5ce8b Add test for when there are no databases 2024-02-14 16:44:37 +00:00
Robert
dd98a968ce Fix naming in test databases 2024-02-14 16:41:07 +00:00
Robert
8c87493d76 Don't offer existing databases if there aren't any 2024-02-14 16:30:58 +00:00
Koen Vlaswinkel
0f4a7788a7 Merge pull request #3360 from github/koesie10/remove-any-from-gulpfile
Add types to TextMate gulp step
2024-02-14 14:59:49 +01:00
Robert
f12629ec4a Merge pull request #3359 from github/robertbrignull/resultsapp
Remove cases from ResultsApp that seem to be impossible
2024-02-14 13:52:37 +00:00
Koen Vlaswinkel
3cb92233ac Add types to TextMate gulp step 2024-02-14 14:26:42 +01:00
Robert
51c81f9172 Move setState call later 2024-02-14 12:41:18 +00:00
Robert
9eb7f96ac0 Remove impossible cases because resultsInfo cannot be null 2024-02-14 12:40:10 +00:00
Robert
9f4b82710a Merge pull request #3354 from github/robertbrignull/multi-mrva-test
Add a CLI test for MRVA with multiple queries
2024-02-14 12:23:56 +00:00
Charis Kyriakou
715b2004f7 Make some clarifications in the test plan (#3358) 2024-02-14 12:05:24 +00:00
Robert
2138f859f5 Skip test when CLI version is not high enough 2024-02-14 11:48:58 +00:00
Robert
9e2b16afe3 Merge pull request #3353 from github/robertbrignull/eslint_no_any
Enable no-explicit-any throughout production code
2024-02-14 11:25:46 +00:00
Robert
93e6c53c8d Merge eslintrc files 2024-02-14 11:10:35 +00:00
Koen Vlaswinkel
f4eed4d6a0 Merge pull request #3352 from github/koesie10/python-mad-format
Add support for Python in the model editor
2024-02-14 12:04:09 +01:00
Charis Kyriakou
c9a7c11731 Merge pull request #3357 from github/version/bump-to-v1.12.3
Bump version to v1.12.3
2024-02-14 10:47:37 +00:00
github-actions[bot]
701539fb7f Bump version to v1.12.3 2024-02-14 10:29:50 +00:00
Charis Kyriakou
2ca61fb2d3 Merge pull request #3356 from github/v1.12.2
v1.12.2
2024-02-14 10:28:25 +00:00
Robert
d1ba99f2b4 Add test files 🤦 2024-02-14 10:07:29 +00:00
Charis Kyriakou
ad98388b66 v1.12.2
Some checks failed
Release / Release (push) Has been cancelled
Release / Publish to VS Code Marketplace (push) Has been cancelled
Release / Publish to Open VSX Registry (push) Has been cancelled
2024-02-14 09:24:55 +00:00
Koen Vlaswinkel
38816b9f52 Merge pull request #3355 from github/koesie10/fix-view-compilation
Recompile view when shared files change
2024-02-14 10:04:08 +01:00
Koen Vlaswinkel
1ce652629c Recompile view when shared files change 2024-02-14 09:46:58 +01:00
Robert
644f917b67 Add CLI test of multiple queries 2024-02-13 17:39:56 +00:00
Robert
e16468754a Convert doVariantAnalysisTest to take multiple queries 2024-02-13 17:22:01 +00:00
Robert
ed96cbb2c9 Use as unknown as ResultsPaths in ResultsApp.tsx 2024-02-13 14:59:17 +00:00
Robert
ac707ff75c Ignore any in useEffectEvent.ts 2024-02-13 14:59:14 +00:00
Robert
334dbf57ef Ignore any in CommandManager.ts 2024-02-13 14:53:15 +00:00
Robert
a4294e2e28 Disable no-explicit-any in gulpfile.ts directory 2024-02-13 14:53:15 +00:00
Robert
e3a6678dc7 Disable no-explicit-any in test directory 2024-02-13 14:53:15 +00:00
Robert
55c86016a3 Disallow use of any by default 2024-02-13 14:38:43 +00:00
Koen Vlaswinkel
070af9eb42 Add support for Python in the model editor 2024-02-13 15:22:37 +01:00
Shati Patel
70b8ddfa37 Add feature flag for Python model editor (#3351) 2024-02-13 14:02:13 +00:00
Robert
923a480ddd Merge pull request #3349 from github/robertbrignull/add_types
Add new type parameters to functions where possible
2024-02-13 14:02:04 +00:00
Robert
cd0d64605a Change registerCommandWithErrorHandling from two type args to one 2024-02-13 12:35:04 +00:00
Robert
fcc5f6967e Add generic types to registerCommandWithErrorHandling 2024-02-13 11:10:16 +00:00
Robert
74070fbc1a Add type information to Memento.update 2024-02-13 11:10:16 +00:00
Robert
f8e825287c Add typing to readJsonlFile
We're still not verifying the actual object returned by JSON.parse so
this isn't any safer at runtime than using 'any', but it helps add more
static typing to the code calling readJsonlFile.
2024-02-13 11:10:16 +00:00
Koen Vlaswinkel
d7e9606bfa Merge pull request #3331 from github/koesie10/endpoint-type-supported
Add supported endpoint types to predicates
2024-02-13 12:04:45 +01:00
Robert
be6166497f Merge pull request #3342 from github/robertbrignull/cached_operation
Give more types to CachedOperation to avoid use of any
2024-02-13 10:48:31 +00:00
Robert
01f6884b6c Undo changes to comment 2024-02-13 10:17:15 +00:00
Koen Vlaswinkel
8d1480ab35 Merge pull request #3348 from github/koesie10/ruby-canary
Remove `enableRuby` feature flag
2024-02-13 11:06:59 +01:00
Robert
4ed6a7b95b Merge pull request #3346 from github/robertbrignull/telemetry-unknown
Avoid use of any in TelemetryListener
2024-02-13 09:37:34 +00:00
Koen Vlaswinkel
00076a9538 Remove enableRuby feature flag 2024-02-13 10:18:50 +01:00
Dave Bartolomeo
3f02ff4151 Merge pull request #3347 from github/github-action/bump-cli
Bump CLI Version to v2.16.2 for integration tests
2024-02-12 10:37:37 -08:00
github-actions[bot]
9e7fefe724 Bump CLI version from v2.16.1 to v2.16.2 for integration tests 2024-02-12 18:23:59 +00:00
Robert
0f6afac222 Use type import 2024-02-12 17:16:34 +00:00
Robert
f7731e2e12 Merge pull request #3344 from github/robertbrignull/correct-types
Use correct types where possible instead of any
2024-02-12 16:51:06 +00:00
Robert
f4edc6e5a9 Merge pull request #3345 from github/robertbrignull/addWatcher-unknown
Use bind instead of thisArg parameter in MultiFileSystemWatcher
2024-02-12 16:37:21 +00:00
Robert
478d41648e Use type import 2024-02-12 16:32:42 +00:00
Robert
6472ea8fde Merge pull request #3341 from github/robertbrignull/unknown_type_checking
Use unknown instead of any in type functions
2024-02-12 15:57:23 +00:00
Robert
5a80d02a91 Merge pull request #3343 from github/robertbrignull/use-unknown
Use unknown instead of any where possible
2024-02-12 15:56:42 +00:00
Robert
939616372c Use correct type for envelope argument 2024-02-12 15:39:23 +00:00
Robert
bfe78eba9a Use string index notation instead of as any 2024-02-12 15:39:23 +00:00
Robert
8a389f2eb7 Remove thisArg from addWatcher and use bind instead 2024-02-12 15:38:26 +00:00
Robert
1004f16b10 Change addWatcher listener to return void 2024-02-12 15:38:26 +00:00
Robert
e5961f2967 Use Record<string, unknown> for additionalRunQueryArgs 2024-02-12 15:37:46 +00:00
Robert
25f179ca0e Use unknown in QLDebugSession.customRequest 2024-02-12 15:37:46 +00:00
Robert
e7adfdc8bc Use unknown for extension type 2024-02-12 15:37:45 +00:00
Robert
281242fa3f Use unknown in Disposable 2024-02-12 15:37:45 +00:00
Robert
4b832bd85c Use QlPackFile type in quick-query.ts 2024-02-12 15:36:43 +00:00
Robert
7af65ed86a Use computed type instead of any for listCodeqlDatabases response
This endpoint actually has the correct type already. We could explicitly
declare it as
RestEndpointMethodTypes["codeScanning"]["listCodeqlDatabases"]["response"]["data"][0]
but this seems unnecessary given how ugly that type is. If we just do nothing
then typescript already computes the correct type for us.
2024-02-12 15:36:22 +00:00
Robert
116aceffc1 Use correct type for octokit options 2024-02-12 15:36:13 +00:00
Robert
f6efcd5a21 onCancellationRequested listener should not return anything (I think) 2024-02-12 15:34:19 +00:00
Robert
bdbd123d32 Give type information to convertedLabelArray 2024-02-12 15:33:49 +00:00
Robert
f0ce52d01a Remove use of any in scripts/source-map.ts 2024-02-12 15:32:42 +00:00
Robert
31ff3577c4 Remove use of any in scripts/add-fields-to-scenarios.ts 2024-02-12 15:32:33 +00:00
Robert
98c96b09ee Give CachedOperation a type parameter for its args 2024-02-12 15:15:58 +00:00
Robert
f4727fe7b5 Convert CachedOperation callbacks to use Error type 2024-02-12 15:15:58 +00:00
Robert
e943e7fa2e Convert isTabInputText to use unknown 2024-02-12 15:15:33 +00:00
Robert
6e53f28972 Convert isIOError to use unknown 2024-02-12 15:15:32 +00:00
Robert
3b366a6f51 Convert isErrorLike to use unknown 2024-02-12 15:15:32 +00:00
Shati Patel
c906e76214 Update databases README (#3340) 2024-02-12 12:15:37 +00:00
Koen Vlaswinkel
aedc063d1a Merge pull request #3326 from github/koesie10/add-endpoint-type
Add endpoint type to method definition
2024-02-12 12:34:22 +01:00
Charis Kyriakou
ecea102292 Merge pull request #3333 from github/dependabot/npm_and_yarn/extensions/ql-vscode/floating-ui/react-0.26.9
Bump @floating-ui/react from 0.26.5 to 0.26.9 in /extensions/ql-vscode
2024-02-09 11:43:03 +00:00
Koen Vlaswinkel
59e20f0fcb Select option before accepting it
In the new version of Floating UI, it corrects that the JSDOM click was
seen as a "mobile" click. Since [`focusItemOnOpen`](https://floating-ui.com/docs/useListNavigation#focusitemonopen)
is set to `auto`, this results in selecting the first option when the
suggest box was opened. Now that JSDOM is correctly detected as a keyboard
input device, it will not select the first option when the suggest box is
opened. The tests have been updated to account for this by always first
selecting the first option before accepting it.
2024-02-09 12:00:53 +01:00
dependabot[bot]
1135f7a7f8 Bump @storybook/addon-a11y from 7.6.9 to 7.6.13 in /extensions/ql-vscode (#3332)
Bumps [@storybook/addon-a11y](https://github.com/storybookjs/storybook/tree/HEAD/code/addons/a11y) from 7.6.9 to 7.6.13.
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v7.6.13/code/addons/a11y)

---
updated-dependencies:
- dependency-name: "@storybook/addon-a11y"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-08 15:58:11 +00:00
Robert
d6bd482c89 Merge pull request #3330 from github/robertbrignull/debug_configuration_makearray
Remove use of any and make typing clearer in debugger code
2024-02-08 15:52:10 +00:00
Charis Kyriakou
11e5db9aca Merge branch 'main' into dependabot/npm_and_yarn/extensions/ql-vscode/floating-ui/react-0.26.9 2024-02-08 15:29:29 +00:00
Koen Vlaswinkel
0b4c611a5f Add supported endpoint types 2024-02-08 16:27:41 +01:00
dependabot[bot]
39cbe3b373 Bump semver from 7.5.4 to 7.6.0 in /extensions/ql-vscode (#3335)
Bumps [semver](https://github.com/npm/node-semver) from 7.5.4 to 7.6.0.
- [Release notes](https://github.com/npm/node-semver/releases)
- [Changelog](https://github.com/npm/node-semver/blob/main/CHANGELOG.md)
- [Commits](https://github.com/npm/node-semver/compare/v7.5.4...v7.6.0)

---
updated-dependencies:
- dependency-name: semver
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-08 15:26:48 +00:00
dependabot[bot]
d62ac97a7b Bump prettier from 3.2.4 to 3.2.5 in /extensions/ql-vscode (#3336)
Bumps [prettier](https://github.com/prettier/prettier) from 3.2.4 to 3.2.5.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/3.2.4...3.2.5)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-08 15:24:08 +00:00
dependabot[bot]
6615c3df84 Bump @floating-ui/react from 0.26.5 to 0.26.9 in /extensions/ql-vscode
Bumps [@floating-ui/react](https://github.com/floating-ui/floating-ui/tree/HEAD/packages/react) from 0.26.5 to 0.26.9.
- [Release notes](https://github.com/floating-ui/floating-ui/releases)
- [Changelog](https://github.com/floating-ui/floating-ui/blob/master/packages/react/CHANGELOG.md)
- [Commits](https://github.com/floating-ui/floating-ui/commits/@floating-ui/react@0.26.9/packages/react)

---
updated-dependencies:
- dependency-name: "@floating-ui/react"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-08 13:48:25 +00:00
Robert
db5293a142 Convert makeArray to use NotArray 2024-02-08 12:06:20 +00:00
Robert
e93ef98a67 Convert debug-protocol and friends to use unknown instead of any 2024-02-08 12:03:06 +00:00
Robert
bd823b5745 Merge pull request #3329 from github/robertbrignull/asString
Use type 'string | Buffer' for process stdout/stderr
2024-02-08 10:56:27 +00:00
Robert
3e716e91c8 Merge pull request #3327 from github/robertbrignull/VsCodeWindow
Introduce VsCodeWindow to provide types for the fields we're reading/writing
2024-02-08 10:32:48 +00:00
Robert
58a06191c0 Use type of 'string | Buffer' 2024-02-08 10:26:32 +00:00
Robert
dd74372702 Merge pull request #3328 from github/robertbrignull/ref_types
Provide types for all react refs
2024-02-08 10:02:53 +00:00
Koen Vlaswinkel
6fd628b49c Add endpointType in tests 2024-02-08 11:02:09 +01:00
Robert
4f11f7560b Introduce VsCodeWindow to provide types for the fields we're reading/writing 2024-02-07 17:35:50 +00:00
Robert
388f4299b0 Introduce asString to call toString() safely on process stdout/stderr 2024-02-07 17:21:32 +00:00
Robert
b577576b00 Add typing to useScrollIntoView ref 2024-02-07 17:20:32 +00:00
Robert
126acc3979 Add typing to RawTableRow ref and friends 2024-02-07 17:20:31 +00:00
Robert
c6e6b5736c Add typing to AlertTableResultRow ref and friends 2024-02-07 17:20:31 +00:00
Robert
5fe5f70867 Merge pull request #3325 from github/robertbrignull/delete-additional-typings
Delete src/additional-typings.d.ts
2024-02-07 17:14:37 +00:00
Koen Vlaswinkel
c9be2ce32c Add endpoint type to method definition
This adds an `endpointType` property to method definitions since we
already have different endpoints (for example methods and modules in
Ruby) and it would be useful to make a distinction between these (it's
not possible to model a module as a source/sink/summary, but it should
be possible to model as a type).
2024-02-07 16:49:40 +01:00
Koen Vlaswinkel
bbfc5d88dd Merge pull request #3324 from github/koesie10/access-path-suggest-box
Extract `AccessPathSuggestBox` component
2024-02-07 16:34:14 +01:00
Shati Patel
b418f479d6 Don't try to parse output of codeql pack add as JSON (#3323) 2024-02-07 15:07:55 +00:00
Koen Vlaswinkel
f2eea4025a Merge pull request #3322 from github/koesie10/suggest-box-command-palette
Fix not being able to open command palette in suggest box
2024-02-07 14:36:19 +01:00
Koen Vlaswinkel
fdb4d42bf3 Add comment about returnFocus 2024-02-07 14:22:47 +01:00
Koen Vlaswinkel
688aa304f5 Extract AccessPathSuggestBox component
This extracts all common functionality from the various model editor
suggest box components into a single component that can be shared by
the model editor suggest box components to make improvements easier.
2024-02-07 14:00:08 +01:00
Robert
65a84f940d Delete src/additional-typings.d.ts 2024-02-07 12:50:52 +00:00
Koen Vlaswinkel
b74306249e Fix not being able to open command palette in suggest box 2024-02-07 13:41:29 +01:00
Shati Patel
57faebd5b9 Minor changelog update (#3321) 2024-02-06 16:28:02 +00:00
Koen Vlaswinkel
303e04ba64 Merge pull request #3320 from github/koesie10/access-paths-query-bqrs
Parse new access paths query BQRS output
2024-02-06 17:03:02 +01:00
Shati Patel
cc2e28c886 CodeQL model editor: Always show the "Generate" button for Ruby DBs (#3319) 2024-02-06 15:27:42 +00:00
Koen Vlaswinkel
c6e7bcd8fa Merge branch 'main' into koesie10/access-paths-query-bqrs 2024-02-06 16:21:11 +01:00
Koen Vlaswinkel
a03863cd4b Merge pull request #3317 from github/koesie10/sarif-comparison
Fix bug in SARIF comparison
2024-02-06 16:15:35 +01:00
Shati Patel
19d85a73e1 CodeQL model editor: Use suggest box for type path suggestions (#3316) 2024-02-06 15:11:56 +00:00
Koen Vlaswinkel
6030137f43 Merge pull request #3318 from github/koesie10/access-paths-configurable-query-constraints
Make query constraints for access paths query configurable
2024-02-06 15:38:43 +01:00
Koen Vlaswinkel
11e0f49135 Parse new access paths query BQRS output 2024-02-06 15:09:46 +01:00
Shati Patel
b35d6cbb3a Don't select a model editor row when you click the suggest box (#3307) 2024-02-06 14:01:21 +00:00
Koen Vlaswinkel
0477a9dee3 Make query constraints for access paths query configurable 2024-02-06 14:07:06 +01:00
Koen Vlaswinkel
c5db597676 Add tests for SARIF diff 2024-02-06 13:48:37 +01:00
Koen Vlaswinkel
73b6cc475c Fix bug in SARIF comparison
The SARIF comparison code was comparing the index of the artifact
location, which is not useful for comparison and may differ between runs
of very similar queries. This adds a function to convert a SARIF result
to a canonical form, which removes the index from the artifact location.
2024-02-06 13:40:09 +01:00
Shati Patel
7c233db4eb CodeQL model editor: Show access path suggestions in the webview (#3305) 2024-02-05 14:16:38 +00:00
Koen Vlaswinkel
ad5ae27a0d Merge pull request #3315 from github/koesie10/nightly-distribution-check
Execute a distribution check when changing the CLI channel
2024-02-05 14:36:02 +01:00
Koen Vlaswinkel
e9c7331c29 Execute a distribution check when changing the CLI channel 2024-02-05 13:16:17 +01:00
Charis Kyriakou
bc4d74246a Stop allowing running MRVA with query outside of workspace (#3302) 2024-02-05 11:17:11 +00:00
Koen Vlaswinkel
70171807c7 Merge pull request #3314 from github/koesie10/skip-tab-tests
Skip suggest box tests using Tab
2024-02-05 09:41:32 +01:00
Koen Vlaswinkel
490b7fbe70 Merge pull request #3313 from github/github-action/bump-node-version
Bump Node version to v18.17.1
2024-02-02 16:30:11 +01:00
Koen Vlaswinkel
d1b81b3f86 Skip suggest box tests using Tab 2024-02-02 15:59:43 +01:00
github-actions[bot]
7f975cc696 Bump Node version to v18.17.1 2024-02-02 12:25:12 +00:00
dependabot[bot]
89ce6cfde9 Bump @storybook/react-webpack5 in /extensions/ql-vscode (#3311)
Bumps [@storybook/react-webpack5](https://github.com/storybookjs/storybook/tree/HEAD/code/frameworks/react-webpack5) from 7.6.7 to 7.6.12.
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v7.6.12/code/frameworks/react-webpack5)

---
updated-dependencies:
- dependency-name: "@storybook/react-webpack5"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-01 16:06:42 +00:00
dependabot[bot]
3aea6874b5 Bump mini-css-extract-plugin in /extensions/ql-vscode (#3308)
Bumps [mini-css-extract-plugin](https://github.com/webpack-contrib/mini-css-extract-plugin) from 2.7.6 to 2.7.7.
- [Release notes](https://github.com/webpack-contrib/mini-css-extract-plugin/releases)
- [Changelog](https://github.com/webpack-contrib/mini-css-extract-plugin/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack-contrib/mini-css-extract-plugin/compare/v2.7.6...v2.7.7)

---
updated-dependencies:
- dependency-name: mini-css-extract-plugin
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-01 14:30:43 +00:00
dependabot[bot]
ae173f24f0 Bump @storybook/theming from 7.6.9 to 7.6.12 in /extensions/ql-vscode (#3309)
Bumps [@storybook/theming](https://github.com/storybookjs/storybook/tree/HEAD/code/lib/theming) from 7.6.9 to 7.6.12.
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v7.6.12/code/lib/theming)

---
updated-dependencies:
- dependency-name: "@storybook/theming"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-01 14:15:49 +00:00
dependabot[bot]
ed2698ff01 Bump css-loader from 6.9.0 to 6.10.0 in /extensions/ql-vscode (#3310)
Bumps [css-loader](https://github.com/webpack-contrib/css-loader) from 6.9.0 to 6.10.0.
- [Release notes](https://github.com/webpack-contrib/css-loader/releases)
- [Changelog](https://github.com/webpack-contrib/css-loader/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack-contrib/css-loader/compare/v6.9.0...v6.10.0)

---
updated-dependencies:
- dependency-name: css-loader
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-01 14:15:05 +00:00
dependabot[bot]
7151a498c8 Bump @babel/preset-env from 7.23.7 to 7.23.9 in /extensions/ql-vscode (#3312)
Bumps [@babel/preset-env](https://github.com/babel/babel/tree/HEAD/packages/babel-preset-env) from 7.23.7 to 7.23.9.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.23.9/packages/babel-preset-env)

---
updated-dependencies:
- dependency-name: "@babel/preset-env"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-01 14:14:50 +00:00
Robert
e582e63685 Merge pull request #3299 from github/robertbrignull/releases_tests
Use slightly more realistic tests data for ReleasesApiConsumer
2024-02-01 13:00:28 +00:00
Robert
600a5de0e9 Unexport unused type 2024-02-01 12:41:41 +00:00
Koen Vlaswinkel
f24487833e Merge pull request #3306 from github/koesie10/remove-bundled-ruby-query
Remove bundled Ruby queries
2024-02-01 12:45:18 +01:00
Koen Vlaswinkel
4e967d8111 Fix tests when there are no bundled queries 2024-02-01 12:10:46 +01:00
Koen Vlaswinkel
15c3805ad3 Remove bundled Ruby queries
This removes the bundled Ruby queries since these queries are in a
CodeQL release now, so we should never find that the queries don't
exist.
2024-02-01 12:01:40 +01:00
Shati Patel
cab963cc88 Send access path suggestions to the model editor view (#3304) 2024-02-01 09:49:05 +00:00
Shati Patel
c6c27f4ca3 Add access path suggestions to MaD model for Ruby (#3303) 2024-01-31 16:15:41 +00:00
Koen Vlaswinkel
b7ee9f9dd4 Merge pull request #3297 from github/koesie10/more-consistency-information
Add more information for consistency check errors
2024-01-31 16:26:45 +01:00
Koen Vlaswinkel
b3284d6760 Merge pull request #3298 from github/koesie10/try-fix-flaky-suggestbox-tab
Wait for options to be shown and to be removed when pressing Tab
2024-01-31 16:26:33 +01:00
Koen Vlaswinkel
e9e98403a9 Merge pull request #3301 from github/koesie10/improve-ruby-access-path-parsing
Fix Ruby method parsing for methods containing brackets
2024-01-31 16:26:10 +01:00
Charis Kyriakou
74c101bb51 Improve handling of unknown QL pack roots for multi-query MRVAs (#3289) 2024-01-31 13:53:07 +00:00
github-actions[bot]
ca8c48418f Bump version to v1.12.2 (#3300)
Co-authored-by: github-actions[bot] <github-actions@github.com>
2024-01-31 13:14:58 +00:00
Koen Vlaswinkel
8c72fe0f8d Fix Ruby method parsing for methods containing brackets
This fixes parsing of access paths for Ruby methods that contain square
brackets, such as `Liquid::Context#[]`. The previous implementation
would incorrectly stop capturing at the `]` character, resulting in a
method name of `[` for an access path of `Method[[]].ReturnValue`. This
fixes it by switching to the shared access path parsing code, which
correctly handles square brackets.
2024-01-31 14:07:54 +01:00
Shati Patel
9cd6dafdf4 Functions for running "access path suggestions" queries (#3294) 2024-01-31 13:04:08 +00:00
Koen Vlaswinkel
08dfd1a211 Add more information for consistency check errors 2024-01-31 13:59:32 +01:00
Shati Patel
9b07be00c7 v1.12.1 (#3296) 2024-01-31 12:52:43 +00:00
Koen Vlaswinkel
820989a8c5 Wait for option to not be present 2024-01-31 13:29:28 +01:00
Robert
9401c34509 Convert "gets correct assets for a release" to use the same example response as the other tests 2024-01-31 11:58:35 +00:00
Robert
750c0973a9 Populate name field in test data 2024-01-31 11:55:56 +00:00
Koen Vlaswinkel
6bd8c8ee78 Wait for options to be shown before pressing Tab 2024-01-31 12:36:09 +01:00
Shati Patel
841efbf826 Add AccessPathSuggestions to "models as data" model (#3295) 2024-01-31 10:15:07 +00:00
Shati Patel
8c679ab569 CodeQL model editor: Add functions for parsing complex access path suggestion options (#3292) 2024-01-30 16:17:40 +00:00
Robert
0391f972ad Merge pull request #3287 from github/robertbrignull/move_language_pack
Move language and pack to top level of variant analysis object
2024-01-30 15:22:06 +00:00
Koen Vlaswinkel
e3a9c06e3c Merge pull request #3288 from github/koesie10/suggest-box-tab
Allow using Tab to select the active option in the suggest box
2024-01-30 15:47:56 +01:00
Robert
a76dc8f0de Merge branch 'main' into robertbrignull/move_language_pack 2024-01-30 14:32:53 +00:00
Robert
222d3edaff Merge pull request #3293 from github/robertbrignull/variant-analysis-history-test-dto
Don't compare internal and dto types in variant-analysis-history.test.ts
2024-01-30 14:32:39 +00:00
Robert
31ea6aded7 Change test data so variant analyses have different IDs 2024-01-30 12:39:15 +00:00
Robert
b92e98fce4 Don't compare internal and dto types 2024-01-30 12:13:06 +00:00
Robert
a228dba0ee Merge branch 'main' into robertbrignull/move_language_pack 2024-01-29 16:34:13 +00:00
Robert
5367bdea9c Merge pull request #3290 from github/robertbrignull/history-tests-dtos
Don't accidentally mix DTO and non-DTO types in query-history-store.test.ts
2024-01-29 16:33:37 +00:00
Koen Vlaswinkel
978e48fe2c Merge pull request #3259 from github/koesie10/improve-error-message
Improve CLI error messages
2024-01-29 17:29:51 +01:00
Robert
98764a156a Introduce writeRawQueryHistory to ensure we're always writing Dto types 2024-01-29 15:53:39 +00:00
Robert
a85989e202 Change let to const where possible 2024-01-29 15:52:55 +00:00
Koen Vlaswinkel
8c696e10af Allow using Tab to select the active option 2024-01-29 14:53:36 +01:00
Koen Vlaswinkel
dc8062b784 Merge pull request #3242 from github/koesie10/suggest-box-open-key
Open suggest box with Ctrl + Space
2024-01-29 14:49:23 +01:00
Koen Vlaswinkel
ac5ed7b30c Merge remote-tracking branch 'origin/main' into koesie10/improve-error-message 2024-01-29 14:47:36 +01:00
Koen Vlaswinkel
c5e9ef15f2 Fix order of args and stderr in error message 2024-01-29 14:46:52 +01:00
Robert
e70b083828 Move language and pack to top level of variant analysis object 2024-01-29 12:11:22 +00:00
Charis Kyriakou
1b84906bce Add basic multi-query support to MRVA results view header (#3286) 2024-01-29 12:00:39 +00:00
Nora
1f24cd1a7f Merge pull request #3275 from github/nora/add-eslint-deprecation
Start using eslint-plugin-deprecation to find deprecated code
2024-01-26 11:46:12 +01:00
Nora
e126dfbe36 Remove 0 for parseInt 2024-01-25 16:19:31 +00:00
Charis Kyriakou
0e2c03f572 Rename queryPackDir -> targetPackPath (#3284) 2024-01-25 15:44:25 +00:00
Henry Mercer
95b082d56a Merge pull request #3283 from github/github-action/bump-cli
Bump CLI Version to v2.16.1 for integration tests
2024-01-25 15:28:04 +00:00
github-actions[bot]
56dd102db8 Bump CLI version from v2.16.0 to v2.16.1 for integration tests 2024-01-25 14:06:36 +00:00
dependabot[bot]
f5b6b4a9f2 Bump zip-a-folder from 3.1.5 to 3.1.6 in /extensions/ql-vscode (#3282)
Bumps [zip-a-folder](https://github.com/maugenst/zip-a-folder) from 3.1.5 to 3.1.6.
- [Commits](https://github.com/maugenst/zip-a-folder/commits)

---
updated-dependencies:
- dependency-name: zip-a-folder
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-25 13:35:57 +00:00
dependabot[bot]
5fc88bed32 Bump @types/react-dom from 18.2.17 to 18.2.18 in /extensions/ql-vscode (#3280)
Bumps [@types/react-dom](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react-dom) from 18.2.17 to 18.2.18.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react-dom)

---
updated-dependencies:
- dependency-name: "@types/react-dom"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-25 13:35:24 +00:00
dependabot[bot]
05e5e32854 Bump markdownlint-cli2 from 0.11.0 to 0.12.1 in /extensions/ql-vscode (#3279)
Bumps [markdownlint-cli2](https://github.com/DavidAnson/markdownlint-cli2) from 0.11.0 to 0.12.1.
- [Changelog](https://github.com/DavidAnson/markdownlint-cli2/blob/main/CHANGELOG.md)
- [Commits](https://github.com/DavidAnson/markdownlint-cli2/compare/v0.11.0...v0.12.1)

---
updated-dependencies:
- dependency-name: markdownlint-cli2
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-25 13:35:08 +00:00
dependabot[bot]
554d8854a1 Bump styled-components from 6.1.1 to 6.1.8 in /extensions/ql-vscode (#3281)
Bumps [styled-components](https://github.com/styled-components/styled-components) from 6.1.1 to 6.1.8.
- [Release notes](https://github.com/styled-components/styled-components/releases)
- [Commits](https://github.com/styled-components/styled-components/compare/v6.1.1...v6.1.8)

---
updated-dependencies:
- dependency-name: styled-components
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-25 13:34:25 +00:00
dependabot[bot]
c9cb7eaa38 Bump storybook from 7.6.7 to 7.6.10 in /extensions/ql-vscode (#3278)
Bumps [storybook](https://github.com/storybookjs/storybook/tree/HEAD/code/lib/cli) from 7.6.7 to 7.6.10.
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v7.6.10/code/lib/cli)

---
updated-dependencies:
- dependency-name: storybook
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-25 13:33:34 +00:00
Nora
70461d857c Use nanoid 2024-01-25 13:17:12 +00:00
Charis Kyriakou
e1ff113701 Fix version used in multi-query pack create constraint (#3277) 2024-01-25 12:40:23 +00:00
Charis Kyriakou
2f66be3fcc Tidy up uses of QueryPackDetail object fields (#3276) 2024-01-25 11:01:11 +00:00
Nora
12a3af0a75 Make random number bigger than 1000 2024-01-25 09:47:19 +00:00
Charis Kyriakou
594f422510 Add support for running multiple queries in MRVA (#3274) 2024-01-25 09:12:50 +00:00
Nora
d5932fc1de Use storybook type 2024-01-25 08:25:33 +00:00
Nora
8397f58d0b Disable rule for storybook types 2024-01-24 17:27:52 +00:00
Nora
dd9ca80820 Solution for unique numbers 2024-01-24 17:20:05 +00:00
Nora
deab3e6175 Update simple deprecations 2024-01-24 16:53:47 +00:00
Nora
a3f9518b78 Set up deprecation plugin 2024-01-24 16:45:02 +00:00
Charis Kyriakou
79fd44f696 Add run-remote-query.ts to CLI tests workflow triggers (#3272) 2024-01-24 12:27:25 +00:00
Robert
69ff7cb0e8 Merge pull request #3273 from github/robertbrignull/uri_fspath
Use Uri to convert paths to platform specific fs paths
2024-01-24 12:11:12 +00:00
Nora
3daefcdffc Merge pull request #3215 from github/nora/add-e2e-tests
E2E test prototype
2024-01-24 12:59:50 +01:00
Nora
a6f7ee3df8 Remove scheduled runs 2024-01-24 11:35:12 +00:00
Robert
92c4532cc2 Use Uri to convert paths to platform specific fs paths 2024-01-24 11:23:54 +00:00
Charis Kyriakou
0265befb26 Move query language to the QlPackDetails (#3270) 2024-01-23 16:13:06 +00:00
Charis Kyriakou
aada35187f Move QL pack file path to the QlPackDetails (#3269) 2024-01-23 14:54:42 +00:00
Charis Kyriakou
e612764c59 Move findPackRoot to ql.ts (#3268) 2024-01-23 13:29:46 +00:00
Shati Patel
e834d32a29 Add new feature flag for "access path suggestions" (#3266) 2024-01-23 12:04:22 +00:00
Charis Kyriakou
67e2ff3d4e Move QL pack root path to the QlPackDetails (#3267) 2024-01-23 12:00:09 +00:00
Charis Kyriakou
9285b0272d Push QL pack details creation to commands (#3262) 2024-01-23 10:17:13 +00:00
Dave Bartolomeo
445aa81f5a Merge pull request #3263 from github/dbartol/extensible-failure 2024-01-22 13:29:35 -05:00
Dave Bartolomeo
2cd1a99273 Fix another missing await 2024-01-22 13:08:39 -05:00
Dave Bartolomeo
b6bf683852 Fix PR feedback 2024-01-22 12:50:58 -05:00
Charis Kyriakou
5bb724b5be Rename getQlPackPath to getQlPackFilePath (#3265) 2024-01-22 16:49:42 +00:00
Shati Patel
5664844aba CodeQL model editor: Don't highlight row when clicking inside text box (#3264) 2024-01-22 16:29:24 +00:00
Charis Kyriakou
9644e5daee Stop variant analysis from published pack if no language selected (#3261) 2024-01-22 15:59:50 +00:00
Dave Bartolomeo
d7f01dcb29 Add missing await 2024-01-22 10:37:22 -05:00
Dave Bartolomeo
509e273108 Fix MRVA integration test failure 2024-01-22 10:21:35 -05:00
Nora
5c513bc821 Add note to readme 2024-01-22 14:15:27 +00:00
Nora
342dbfb5a9 Silence output 2024-01-22 14:05:57 +00:00
Charis Kyriakou
28aadb183b Use object for pack generation details (#3260) 2024-01-22 13:59:41 +00:00
Nora
6bf73dc196 Fix typo 2024-01-22 13:07:21 +00:00
Shati Patel
83148f6d57 Add test for "promptForDatabase" (#3248) 2024-01-22 11:09:12 +00:00
Nora
988a113cb3 Shorten playwright config 2024-01-19 17:42:41 +00:00
Nora
5136c95da7 Run E2E every night of the week, on merge to main and push to main 2024-01-19 17:38:18 +00:00
Nora
6741f0c431 Merge branch 'main' into nora/add-e2e-tests 2024-01-19 18:32:37 +01:00
Koen Vlaswinkel
ebf06b9af6 Update CHANGELOG 2024-01-19 12:28:04 +01:00
Koen Vlaswinkel
a85a4b41f5 Improve CLI error messages 2024-01-19 12:07:42 +01:00
Nora
8690f76968 Merge pull request #3255 from github/dependabot/npm_and_yarn/extensions/ql-vscode/prettier-3.2.4
Bump prettier from 3.1.1 to 3.2.4 in /extensions/ql-vscode
2024-01-19 11:40:30 +01:00
Nora
fc41360bad Check in npm run format 2024-01-19 10:15:00 +00:00
dependabot[bot]
a2ebc69d3a Bump prettier from 3.1.1 to 3.2.4 in /extensions/ql-vscode
Bumps [prettier](https://github.com/prettier/prettier) from 3.1.1 to 3.2.4.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/3.1.1...3.2.4)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-18 20:58:32 +00:00
dependabot[bot]
f1a915e46c Bump css-loader from 6.8.1 to 6.9.0 in /extensions/ql-vscode (#3256)
Bumps [css-loader](https://github.com/webpack-contrib/css-loader) from 6.8.1 to 6.9.0.
- [Release notes](https://github.com/webpack-contrib/css-loader/releases)
- [Changelog](https://github.com/webpack-contrib/css-loader/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack-contrib/css-loader/compare/v6.8.1...v6.9.0)

---
updated-dependencies:
- dependency-name: css-loader
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-18 12:56:46 -08:00
Nora
2d1663d046 Merge pull request #3253 from github/dependabot/npm_and_yarn/extensions/ql-vscode/typescript-eslint/eslint-plugin-6.19.0
Bump @typescript-eslint/eslint-plugin from 6.18.0 to 6.19.0 in /extensions/ql-vscode
2024-01-18 16:11:27 +01:00
Nora
66be432610 Merge pull request #3254 from github/dependabot/npm_and_yarn/extensions/ql-vscode/storybook/addon-a11y-7.6.9
Bump @storybook/addon-a11y from 7.6.4 to 7.6.9 in /extensions/ql-vscode
2024-01-18 16:10:52 +01:00
Nora
4ae4745a86 Merge pull request #3257 from github/dependabot/npm_and_yarn/extensions/ql-vscode/storybook/theming-7.6.9
Bump @storybook/theming from 7.6.7 to 7.6.9 in /extensions/ql-vscode
2024-01-18 16:10:14 +01:00
Dave Bartolomeo
fef394b79d Merge pull request #3233 from github/dbartol/mrva-multi-bundle
Use CLI to bundle packs for MRVA
2024-01-18 09:10:21 -05:00
dependabot[bot]
ccfba04d97 Bump @storybook/theming from 7.6.7 to 7.6.9 in /extensions/ql-vscode
Bumps [@storybook/theming](https://github.com/storybookjs/storybook/tree/HEAD/code/lib/theming) from 7.6.7 to 7.6.9.
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v7.6.9/code/lib/theming)

---
updated-dependencies:
- dependency-name: "@storybook/theming"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-18 13:49:17 +00:00
dependabot[bot]
c89382ceb7 Bump @storybook/addon-a11y from 7.6.4 to 7.6.9 in /extensions/ql-vscode
Bumps [@storybook/addon-a11y](https://github.com/storybookjs/storybook/tree/HEAD/code/addons/a11y) from 7.6.4 to 7.6.9.
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v7.6.9/code/addons/a11y)

---
updated-dependencies:
- dependency-name: "@storybook/addon-a11y"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-18 13:48:04 +00:00
dependabot[bot]
8beaa7cbc0 Bump @typescript-eslint/eslint-plugin in /extensions/ql-vscode
Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 6.18.0 to 6.19.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.19.0/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-18 13:47:43 +00:00
Nora
477c6b3819 Merge pull request #3252 from github/dependabot/github_actions/actions/dependency-review-action-4
Bump actions/dependency-review-action from 3 to 4
2024-01-18 14:43:21 +01:00
dependabot[bot]
978e00a252 Bump actions/dependency-review-action from 3 to 4
Bumps [actions/dependency-review-action](https://github.com/actions/dependency-review-action) from 3 to 4.
- [Release notes](https://github.com/actions/dependency-review-action/releases)
- [Commits](https://github.com/actions/dependency-review-action/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/dependency-review-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-18 13:28:48 +00:00
Koen Vlaswinkel
5c132884a4 Merge remote-tracking branch 'origin/main' into koesie10/suggest-box-open-key 2024-01-18 10:25:26 +01:00
Koen Vlaswinkel
8e1fc2ca96 Merge pull request #3247 from github/koesie10/suggest-box-diagnostics
Add diagnostics to suggest box
2024-01-18 10:24:37 +01:00
Koen Vlaswinkel
d6e4b7ef56 Merge remote-tracking branch 'origin/main' into koesie10/suggest-box-diagnostics 2024-01-18 10:04:52 +01:00
Koen Vlaswinkel
4e81d41086 Add comment about Storybook test diagnostics 2024-01-18 10:03:45 +01:00
Koen Vlaswinkel
ac5038cf50 Merge pull request #3244 from github/koesie10/suggest-box-highlight
Add highlighting to items in suggest box
2024-01-18 10:02:17 +01:00
Dave Bartolomeo
d7e5552481 Fix broken test code 2024-01-17 17:48:44 -05:00
Dave Bartolomeo
65fbb6bca8 Fix PR feedback 2024-01-17 14:20:14 -05:00
Dave Bartolomeo
1d275985d0 Fix PR feedback 2024-01-17 12:49:20 -05:00
Dave Bartolomeo
55306c9a93 Fix PR feedback 2024-01-17 12:47:06 -05:00
Robert
ec6a725715 Merge pull request #3251 from github/robertbrignull/test_published_pack
Add an integration test of runVariantAnalysisFromPublishedPack
2024-01-17 16:15:23 +00:00
Robert
6b1a056ae6 Avoid using path separator in test data 2024-01-17 15:51:27 +00:00
Koen Vlaswinkel
75065f3148 Merge pull request #3230 from github/koesie10/suggest-box
Create `SuggestBox` component
2024-01-17 15:56:51 +01:00
Robert
1010239c29 Add a test of runVariantAnalysisFromPublishedPack 2024-01-17 14:31:06 +00:00
Koen Vlaswinkel
2b6ec73147 Merge pull request #3250 from github/koesie10/rename-ide-server
Remove outdated IDE server name in favor of language client
2024-01-17 15:08:25 +01:00
Charis Kyriakou
97980371c8 Skip multi-query MRVAs from query history (#3249) 2024-01-17 13:52:03 +00:00
Koen Vlaswinkel
479aa683ee Rename IDE server to language client 2024-01-17 11:40:00 +01:00
Koen Vlaswinkel
1cb46d2604 Rename ide-server.ts to language-client.ts 2024-01-17 11:37:07 +01:00
Shati Patel
be22964113 Send telemetry for addDatabaseSourceToWorkspace setting (#3238) 2024-01-16 17:05:59 +00:00
Robert
db3550a18c Merge pull request #3245 from github/robertbrignull/multi-query-published-pack
Add prototype implementation for codeQL.runVariantAnalysisPublishedPack
2024-01-16 16:54:04 +00:00
Robert
91a96da2ad Start progress bar earlier 2024-01-16 16:39:30 +00:00
Robert
9dc37ebf33 Return when we detect no queries 2024-01-16 16:33:16 +00:00
Robert
ff8def3e7d Use join instead of slash 2024-01-16 16:32:09 +00:00
Koen Vlaswinkel
39c17291aa Add diagnostics to suggest box
This adds the ability for consumers of the suggest box to add
diagnostics to the suggest box. When a diagnostic is returned for a
value, the input will be shown with a red border.
2024-01-16 16:56:32 +01:00
Nora
a6a7a5c5cb Merge pull request #3246 from github/nora/remove-deprecated-jest-syntax
Remove deprecated jest syntac
2024-01-16 16:44:09 +01:00
Nora
70ce93cbb3 Replace toBeCalledTimes 2024-01-16 15:28:51 +00:00
Nora
abc71b5102 Replace toBeCalledWith 2024-01-16 15:28:07 +00:00
Nora
fed110f65f Replace toBeCalled 2024-01-16 15:26:41 +00:00
Robert
174a38a16a Make placeholder text more general 2024-01-16 15:11:38 +00:00
Robert
b4250218d5 Implement the command to download a published pack 2024-01-16 15:11:38 +00:00
github-actions[bot]
5948008c99 Bump CLI version from v2.15.5 to v2.16.0 for integration tests (#3243)
Co-authored-by: github-actions[bot] <github-actions@github.com>
2024-01-16 15:09:30 +00:00
Koen Vlaswinkel
070f0ca9b7 Add highlighting to items in suggest box
This adds highlighting of the currently typed text into the shown items
of the suggest box.
2024-01-16 16:05:51 +01:00
Charis Kyriakou
318136f5e5 Allow multiple file URIs to be passed into prepareRemoteQueryRun (#3241) 2024-01-16 15:05:24 +00:00
Koen Vlaswinkel
a3ade9984d Make mocking helpers independent of vscode 2024-01-16 15:39:14 +01:00
Koen Vlaswinkel
4429385dfd Open suggest box with Ctrl + Space
This adds a keyboard shortcut to open the suggest box when it's closed.
This matches the behavior in VS Code itself.
2024-01-16 14:24:09 +01:00
Shati Patel
f993258a27 CodeQL model editor: Make Type a selectable model kind for Ruby (#3224) 2024-01-16 13:17:26 +00:00
Shati Patel
c5517e0aea CodeQL model editor: Add support for free text input in type models (#3217) 2024-01-16 13:03:53 +00:00
Charis Kyriakou
8c0a8e07b2 Tidy up variant analysis commands (#3240) 2024-01-16 12:19:37 +00:00
Robert
a1572463a6 Merge pull request #3239 from github/robertbrignull/multi-query-commands
Add stubs of commands for multi-query support
2024-01-16 10:24:29 +00:00
Koen Vlaswinkel
545902843d Merge pull request #3222 from github/koesie10/suggest-box-helper-functions
Add helper functions for suggestion box
2024-01-16 09:35:12 +01:00
Robert
1a7981a22d Add codeQL.runVariantAnalysisPublishedPack command 2024-01-15 17:08:18 +00:00
Robert
1bc560518f Add codeQL.runVariantAnalysisContextExplorer command 2024-01-15 17:07:41 +00:00
Shati Patel
281f8eeb7a CodeQL model editor: support saving single/selected models (#3156) 2024-01-15 16:51:46 +00:00
Dave Bartolomeo
f53826c09d Better dependency version assertions 2024-01-14 10:20:55 -05:00
Dave Bartolomeo
b16aeb3887 Fix property name, and expand another path 2024-01-14 10:17:35 -05:00
Dave Bartolomeo
ee73639720 Expand short paths before calling codeql pack bundle 2024-01-13 14:30:01 -05:00
Dave Bartolomeo
9d2190a88d Add text if pack is empty 2024-01-12 13:03:21 -05:00
Dave Bartolomeo
6d308f8688 Add missing change 2024-01-12 12:44:16 -05:00
Dave Bartolomeo
61933c34d5 Dump pack contents when expected file not found 2024-01-12 12:41:36 -05:00
Dave Bartolomeo
e03c2b132c Custom message for assertions about files existing in packs 2024-01-12 10:42:34 -05:00
Dave Bartolomeo
9c42c6a851 Allow CodeQL checkout to be named ql
This makes it easier for cross-repo development with `semmle-code`, where the `codeql` repo is in a submodule in a directory named `ql`.
2024-01-12 09:30:13 -05:00
Nora
283d0070f7 Ignore playwright config on dead code 2024-01-12 14:05:51 +00:00
Nora
d3c7241854 fix new config location in workflow 2024-01-12 13:52:39 +00:00
Nora
0b9e4e33b2 move config and fix tsconfig error 2024-01-12 13:36:11 +00:00
Nora
b4a66a7690 Update readme 2024-01-12 13:35:51 +00:00
Koen Vlaswinkel
ea1419add2 Merge pull request #3234 from github/koesie10/remove-jest-runner-installed-extensions
Simplify custom Jest test runner
2024-01-12 11:26:18 +01:00
Koen Vlaswinkel
0534cb7514 Simplify custom Jest test runner
The custom Jest test runner was originally written to install the
required extensions for the CLI integration tests. This is no longer
necessary as of https://github.com/github/vscode-codeql/pull/3232, so
we can remove all code that deals with downloading VS Code and
installing extensions. The download of VS Code will now be handled by
the base `VSCodeTestRunner`.
2024-01-12 09:49:20 +01:00
Dave Bartolomeo
2aacea4176 Fix test expectation 2024-01-11 18:58:44 -05:00
Dave Bartolomeo
2ccd99fc5b Don't use ${workspace} in test pack 2024-01-11 18:40:03 -05:00
Dave Bartolomeo
bdc94a3b23 Remove unused export 2024-01-11 18:05:00 -05:00
Dave Bartolomeo
29d8c65b59 Use codeql pack create --mrva if available 2024-01-11 17:43:42 -05:00
Dave Bartolomeo
fb63ec7db0 Consume codeql version JSON output for feature capabilities 2024-01-11 21:59:54 +00:00
Dave Bartolomeo
b67efeeacd Merge pull request #3232 from github/dbartol/new-test-api
Switch to built-in VS Code test UI unconditionally
2024-01-11 16:48:56 -05:00
Dave Bartolomeo
4b3a008a45 Merge branch 'main' into dbartol/new-test-api 2024-01-11 12:22:18 -05:00
Dave Bartolomeo
1186026315 Remove old unit tests 2024-01-11 11:56:51 -05:00
Dave Bartolomeo
2ba23ceead Fold TestManagerBase and related functions into TestManager 2024-01-11 11:48:54 -05:00
dependabot[bot]
c065c44ff3 Bump applicationinsights from 2.9.1 to 2.9.2 in /extensions/ql-vscode (#3228)
Bumps [applicationinsights](https://github.com/microsoft/ApplicationInsights-node.js) from 2.9.1 to 2.9.2.
- [Release notes](https://github.com/microsoft/ApplicationInsights-node.js/releases)
- [Commits](https://github.com/microsoft/ApplicationInsights-node.js/compare/2.9.1...2.9.2)

---
updated-dependencies:
- dependency-name: applicationinsights
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-11 08:44:11 -08:00
dependabot[bot]
0d2b7916ee Bump msw from 2.0.11 to 2.0.13 in /extensions/ql-vscode (#3227)
Bumps [msw](https://github.com/mswjs/msw) from 2.0.11 to 2.0.13.
- [Release notes](https://github.com/mswjs/msw/releases)
- [Changelog](https://github.com/mswjs/msw/blob/main/CHANGELOG.md)
- [Commits](https://github.com/mswjs/msw/compare/v2.0.11...v2.0.13)

---
updated-dependencies:
- dependency-name: msw
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-11 08:43:49 -08:00
dependabot[bot]
766f54b76e Bump @storybook/manager-api from 7.6.6 to 7.6.7 in /extensions/ql-vscode (#3226)
Bumps [@storybook/manager-api](https://github.com/storybookjs/storybook/tree/HEAD/code/lib/manager-api) from 7.6.6 to 7.6.7.
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v7.6.7/code/lib/manager-api)

---
updated-dependencies:
- dependency-name: "@storybook/manager-api"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-11 08:43:22 -08:00
dependabot[bot]
c485e39b07 Bump @testing-library/dom from 9.3.3 to 9.3.4 in /extensions/ql-vscode (#3225)
Bumps [@testing-library/dom](https://github.com/testing-library/dom-testing-library) from 9.3.3 to 9.3.4.
- [Release notes](https://github.com/testing-library/dom-testing-library/releases)
- [Changelog](https://github.com/testing-library/dom-testing-library/blob/main/CHANGELOG.md)
- [Commits](https://github.com/testing-library/dom-testing-library/compare/v9.3.3...v9.3.4)

---
updated-dependencies:
- dependency-name: "@testing-library/dom"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-11 08:42:57 -08:00
Dave Bartolomeo
d8968db1b9 Changelog entry 2024-01-11 11:34:35 -05:00
Charis Kyriakou
40ba2c03d3 Rename variant analysis mapping functions (#3231) 2024-01-11 16:11:01 +00:00
Dave Bartolomeo
ac93074f94 Merge remote-tracking branch 'origin/main' into dbartol/new-test-api 2024-01-11 15:48:17 +00:00
Dave Bartolomeo
1dc6111fba Switch to built-in VS Code test UI unconditionally 2024-01-11 10:47:48 -05:00
Nora
f9166f304b Merge pull request #3229 from github/dependabot/npm_and_yarn/extensions/ql-vscode/eslint-plugin-prettier-5.1.3
Bump eslint-plugin-prettier from 5.0.1 to 5.1.3 in /extensions/ql-vscode
2024-01-11 15:55:26 +01:00
Koen Vlaswinkel
6ec727a8a2 Add tests for SuggestBox component 2024-01-11 15:28:21 +01:00
dependabot[bot]
b4da6c71f3 Bump eslint-plugin-prettier from 5.0.1 to 5.1.3 in /extensions/ql-vscode
Bumps [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier) from 5.0.1 to 5.1.3.
- [Release notes](https://github.com/prettier/eslint-plugin-prettier/releases)
- [Changelog](https://github.com/prettier/eslint-plugin-prettier/blob/master/CHANGELOG.md)
- [Commits](https://github.com/prettier/eslint-plugin-prettier/compare/v5.0.1...v5.1.3)

---
updated-dependencies:
- dependency-name: eslint-plugin-prettier
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-11 13:58:28 +00:00
Nora
f43c5274cf Merge pull request #3223 from github/version/bump-to-v1.12.1
Bump version to v1.12.1
2024-01-11 14:37:52 +01:00
Nora
1a135c501d Move changelog entry to correct section 2024-01-11 13:23:00 +00:00
Koen Vlaswinkel
0df0cca9d8 Create SuggestBox component 2024-01-11 14:13:02 +01:00
Koen Vlaswinkel
519833e7a4 Merge pull request #3218 from github/koesie10/parse-access-paths
Add functions for parsing and validating access paths
2024-01-11 13:34:01 +01:00
github-actions[bot]
d77261aaa5 Bump version to v1.12.1 2024-01-11 12:25:03 +00:00
Nora
24dff5981e Merge pull request #3221 from github/v1.12.0
v1.12.0
2024-01-11 13:23:32 +01:00
Koen Vlaswinkel
7f730d24b0 Add helper functions for suggestion box
This adds some helper functions that will be used for a suggestion box
in the future. There is one helper function for highlighting part of a
text case-insensitively. Another helper function will try to find
followup options based on a list of tokens.

The tests for these functions use access paths as input, but these
functions are not intended to be specific to access paths. They can be
used for any list of options/string.
2024-01-11 12:09:13 +01:00
Nora
8834111f57 Update changelog release date
Some checks failed
Release / Release (push) Has been cancelled
Release / Publish to VS Code Marketplace (push) Has been cancelled
Release / Publish to Open VSX Registry (push) Has been cancelled
2024-01-11 10:08:16 +00:00
Nora
3d5ef60fe0 Update extensions/ql-vscode/CHANGELOG.md
Co-authored-by: Koen Vlaswinkel <koesie10@users.noreply.github.com>
2024-01-11 10:50:11 +01:00
Nora
6ab1f4c7ee v1.12.0 2024-01-11 09:48:17 +00:00
Shati Patel
77f84c6ca9 Improve user experience when no database is selected (#3214) 2024-01-11 09:41:44 +00:00
Koen Vlaswinkel
d0a12753d8 Merge pull request #3216 from github/koesie10/move-ruby-access-paths
Move Ruby access paths functions to separate file
2024-01-11 09:49:48 +01:00
Koen Vlaswinkel
ea6e148df9 Add functions for parsing and validating access paths
This adds functions for parsing and validating access paths to prepare
for future functionality where we're going to be parsing and validating
access paths.
2024-01-10 16:20:13 +01:00
Koen Vlaswinkel
ac745a6955 Move Ruby access paths functions 2024-01-10 15:54:17 +01:00
Nora
d022623a9d fix artifacts path 2024-01-10 10:42:40 +00:00
Nora
c7a1cf7236 Add test, config and action 2024-01-10 10:01:59 +00:00
Shati Patel
1b737678ba Update broken badge in README (#3213) 2024-01-09 14:09:50 +00:00
Koen Vlaswinkel
19b24f87ec Merge pull request #3212 from github/koesie10/eslint-rules
Remove more ESLint rule overrides
2024-01-09 11:31:10 +01:00
Koen Vlaswinkel
38743c6180 wip: move CLI installation 2024-01-09 10:56:22 +01:00
Koen Vlaswinkel
d1a26d3893 wip: add Docker Compose configuration for code server 2024-01-09 10:41:38 +01:00
Koen Vlaswinkel
b2bdcdbcb8 Merge pull request #3210 from github/koesie10/no-cycle
Remove all dependency cycles
2024-01-09 09:31:31 +01:00
dependabot[bot]
37c3b03e9a Bump @typescript-eslint/eslint-plugin in /extensions/ql-vscode (#3209)
Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 6.16.0 to 6.18.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.18.0/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-08 08:49:31 -08:00
Koen Vlaswinkel
c7c79175d2 Remove non-existent filenames/match-regexp ESLint rule 2024-01-08 16:54:07 +01:00
Koen Vlaswinkel
01e7b3fc0e Remove camelcase ESLint rule override 2024-01-08 16:52:03 +01:00
Koen Vlaswinkel
58ea742e85 Enable func-style ESLint rule 2024-01-08 16:47:28 +01:00
Koen Vlaswinkel
188bc53761 Enable no-useless-escape ESLint rule
These fixes maintain the current functionality and do not make any
changes to the matching of the regular expressions.
2024-01-08 16:44:41 +01:00
Koen Vlaswinkel
26e619ba71 Enable no-fallthrough ESLint rule 2024-01-08 16:40:45 +01:00
Koen Vlaswinkel
00707fca4b Merge pull request #3211 from github/koesie10/remove-disabled-eslint-rules
Remove disabled ESLint rules without linting errors
2024-01-08 16:17:30 +01:00
Koen Vlaswinkel
51627ad971 Remove disabled ESLint rules without linting errors
This removes some ESLint rules that do not give any linting errors when
removing the rule overrides from the config file. This could be because
there are no instances of the rule being violated, or because the rule
is already disabled by some other configuration.
2024-01-08 15:04:55 +01:00
Koen Vlaswinkel
f21ee5173c Enable import/no-cycle ESLint rule 2024-01-08 13:49:26 +01:00
Koen Vlaswinkel
397693a2cb Remove import cycle for results view 2024-01-08 13:49:26 +01:00
Koen Vlaswinkel
0648ce8ae6 Remove import cycle for query history dto mappers 2024-01-08 13:49:26 +01:00
Koen Vlaswinkel
183de7b6a1 Remove import cycle for query history domain mappers 2024-01-08 13:49:26 +01:00
Koen Vlaswinkel
b6f32ec5d7 Remove import cycle for model editor queries 2024-01-08 13:49:26 +01:00
Koen Vlaswinkel
70c2beb510 Remove import cycle for distribution manager 2024-01-08 13:49:25 +01:00
Koen Vlaswinkel
31c90a5068 Remove import cycle for CLI server 2024-01-08 13:37:21 +01:00
Koen Vlaswinkel
2ce6fd3bb1 Merge pull request #3203 from github/koesie10/consistent-type-imports
Enforce consistent type imports
2024-01-08 13:27:42 +01:00
Koen Vlaswinkel
da5852cfbb Merge pull request #3185 from github/koesie10/node-version-action
Add GitHub Actions workflow for updating Node version
2024-01-08 13:07:35 +01:00
Koen Vlaswinkel
5c83c94335 Merge pull request #3202 from github/koesie10/missing-promise-await
Fix missing `await` in `prepareModelEditorQueries`
2024-01-08 10:00:02 +01:00
Koen Vlaswinkel
21faed0191 Enforce consistent type specifiers 2024-01-05 17:15:58 +01:00
Koen Vlaswinkel
9d6962ede2 Enforce consistent type imports 2024-01-05 17:13:45 +01:00
Koen Vlaswinkel
d6d5d27d70 Fix missing await in prepareModelEditorQueries
This fixes a missing `await` in `prepareModelEditorQueries` that caused
the function to potentially return before the query files were written.
2024-01-05 16:31:07 +01:00
Koen Vlaswinkel
5c7efe5116 Merge pull request #3200 from github/koesie10/remove-namespace-imports
Remove unnecessary namespace imports
2024-01-05 14:53:29 +01:00
Nora
1d42d4848b Merge pull request #3189 from github/nora/make-model-editor-open-cancellable
CodeQL model editor: user should be able to stop modeling before the main editor view is open
2024-01-05 13:50:08 +01:00
Nora
745544cd9c Use error type and error code 2024-01-05 12:37:44 +00:00
Koen Vlaswinkel
38a3778fe1 Fix Storybook React runtime 2024-01-05 11:09:53 +01:00
Koen Vlaswinkel
50df8cd376 Remove dead code
After removing all namespace imports, the dead code detection is now
more accurate, so we can remove some more dead code.
2024-01-05 10:42:39 +01:00
Koen Vlaswinkel
034bfc230c Remove unnecessary namespace imports
This removes all unnecessary namespace imports. The only namespace
imports that are left are those that are needed for spying on functions
in tests.
2024-01-05 10:42:36 +01:00
Koen Vlaswinkel
d342b060ed Merge pull request #3187 from github/koesie10/update-vscode-version-docs
Update outdated VS Code version docs
2024-01-05 09:49:42 +01:00
Koen Vlaswinkel
45fe4aa1d4 Merge pull request #3186 from github/koesie10/generate-chromium-version
Rename update Chromium version script to generate Chromium version
2024-01-05 09:49:34 +01:00
dependabot[bot]
902074f7a5 Bump msw from 2.0.10 to 2.0.11 in /extensions/ql-vscode (#3198)
Bumps [msw](https://github.com/mswjs/msw) from 2.0.10 to 2.0.11.
- [Release notes](https://github.com/mswjs/msw/releases)
- [Changelog](https://github.com/mswjs/msw/blob/main/CHANGELOG.md)
- [Commits](https://github.com/mswjs/msw/compare/v2.0.10...v2.0.11)

---
updated-dependencies:
- dependency-name: msw
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-04 10:34:59 -08:00
dependabot[bot]
fd8f88890e Bump @babel/preset-env from 7.23.6 to 7.23.7 in /extensions/ql-vscode (#3196)
Bumps [@babel/preset-env](https://github.com/babel/babel/tree/HEAD/packages/babel-preset-env) from 7.23.6 to 7.23.7.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.23.7/packages/babel-preset-env)

---
updated-dependencies:
- dependency-name: "@babel/preset-env"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-04 10:34:14 -08:00
dependabot[bot]
db842dea7c Bump @testing-library/jest-dom in /extensions/ql-vscode (#3195)
Bumps [@testing-library/jest-dom](https://github.com/testing-library/jest-dom) from 6.1.6 to 6.2.0.
- [Release notes](https://github.com/testing-library/jest-dom/releases)
- [Changelog](https://github.com/testing-library/jest-dom/blob/main/CHANGELOG.md)
- [Commits](https://github.com/testing-library/jest-dom/compare/v6.1.6...v6.2.0)

---
updated-dependencies:
- dependency-name: "@testing-library/jest-dom"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-04 10:33:44 -08:00
Nora
eb59ead817 Catch request cancelled error 2024-01-04 15:19:10 +00:00
Nora
d0e81124ac Merge pull request #3199 from github/dependabot/npm_and_yarn/extensions/ql-vscode/types/tmp-0.2.6
Bump @types/tmp from 0.1.0 to 0.2.6 in /extensions/ql-vscode
2024-01-04 15:00:05 +01:00
dependabot[bot]
8697dcc80d Bump @types/tmp from 0.1.0 to 0.2.6 in /extensions/ql-vscode
Bumps [@types/tmp](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/tmp) from 0.1.0 to 0.2.6.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/tmp)

---
updated-dependencies:
- dependency-name: "@types/tmp"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-04 13:45:03 +00:00
Nora
ad8dc1e906 Update Changelog 2024-01-04 10:52:42 +00:00
dependabot[bot]
ceb8b1f9c1 Bump storybook from 7.6.6 to 7.6.7 in /extensions/ql-vscode (#3194)
Bumps [storybook](https://github.com/storybookjs/storybook/tree/HEAD/code/lib/cli) from 7.6.6 to 7.6.7.
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v7.6.7/code/lib/cli)

---
updated-dependencies:
- dependency-name: storybook
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-03 15:44:51 -08:00
dependabot[bot]
b77acc5468 Bump @storybook/theming from 7.6.6 to 7.6.7 in /extensions/ql-vscode (#3193)
Bumps [@storybook/theming](https://github.com/storybookjs/storybook/tree/HEAD/code/lib/theming) from 7.6.6 to 7.6.7.
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v7.6.7/code/lib/theming)

---
updated-dependencies:
- dependency-name: "@storybook/theming"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-03 14:51:53 -08:00
dependabot[bot]
555fa6cf78 Bump @storybook/react-webpack5 in /extensions/ql-vscode (#3192)
Bumps [@storybook/react-webpack5](https://github.com/storybookjs/storybook/tree/HEAD/code/frameworks/react-webpack5) from 7.6.6 to 7.6.7.
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v7.6.7/code/frameworks/react-webpack5)

---
updated-dependencies:
- dependency-name: "@storybook/react-webpack5"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-03 14:38:09 -08:00
dependabot[bot]
f7de8e5d09 Bump @testing-library/user-event in /extensions/ql-vscode (#3191)
Bumps [@testing-library/user-event](https://github.com/testing-library/user-event) from 14.5.1 to 14.5.2.
- [Release notes](https://github.com/testing-library/user-event/releases)
- [Changelog](https://github.com/testing-library/user-event/blob/main/CHANGELOG.md)
- [Commits](https://github.com/testing-library/user-event/compare/v14.5.1...v14.5.2)

---
updated-dependencies:
- dependency-name: "@testing-library/user-event"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-03 14:37:44 -08:00
dependabot[bot]
299280cd08 Bump @storybook/components from 7.6.4 to 7.6.7 in /extensions/ql-vscode (#3190)
Bumps [@storybook/components](https://github.com/storybookjs/storybook/tree/HEAD/code/ui/components) from 7.6.4 to 7.6.7.
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v7.6.7/code/ui/components)

---
updated-dependencies:
- dependency-name: "@storybook/components"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-03 14:37:12 -08:00
Robert
92bebef49d Merge pull request #3188 from github/robertbrignull/releases-refactor
Move ReleasesApiConsumer to a separate file and do simple refactors
2024-01-03 16:24:28 +00:00
Robert
1ce2b365a6 Move files to codeql-cli/distribution directory 2024-01-03 16:10:08 +00:00
Koen Vlaswinkel
47929943ba Merge pull request #3184 from github/koesie10/node-version
Use semver range for `@types/node`
2024-01-03 16:42:50 +01:00
Nora
0b27912314 Make model editor open progress bar cancellable 2024-01-03 15:15:56 +00:00
Nora
6a65094720 Make preparation progress bar cancellable 2024-01-03 15:15:17 +00:00
Robert
6746b07879 Merge ownerName and repositoryName into one field because we no longer need to be able to specify them independently 2024-01-03 11:32:46 +00:00
Koen Vlaswinkel
593c01388b Update outdated VS Code version docs
There were still references to a pinned version of VS Code used in the
integration tests, but this was resolved in https://github.com/github/vscode-codeql/pull/2877.
2024-01-03 12:20:24 +01:00
Koen Vlaswinkel
dbee8dd57a Remove troubleshooting steps for Chromium version
ESBuild doesn't use `browserslist` or `caniuse-lite`, so this step
isn't necessary.
2024-01-03 12:01:12 +01:00
Robert
426ab98623 Move fields to top of class definition 2024-01-03 10:54:17 +00:00
Robert
9fd8c1c3e0 Convert other fields to not use underscore prefix 2024-01-03 10:54:17 +00:00
Robert
b8cbd75737 Use "private readonly" modifier on constructor args 2024-01-03 10:54:17 +00:00
Robert
c575edec71 Move releases-api-consumer.test.ts from no-workspace to unit-tests 2024-01-03 10:54:17 +00:00
Robert
337e5f81ea Adjust comments in releases-api-consumer.ts 2024-01-03 10:46:18 +00:00
Robert
6d1cf0887a Pull out ReleasesApiConsumer to its own file 2024-01-03 10:46:15 +00:00
Robert
bc7c956d6d Pull out GithubApiError and GithubRateLimitedError to a separate file 2024-01-03 10:46:15 +00:00
Robert
90d72cec78 Add more comments to Release and ReleaseAsset 2024-01-03 10:46:15 +00:00
Robert
2f9c8d1bfa Move Release and ReleaseAsset to their own files 2024-01-03 10:46:11 +00:00
Koen Vlaswinkel
4b49a8f9bb Update VS Code version documentation 2024-01-03 11:44:19 +01:00
Koen Vlaswinkel
9718aa5806 Rename update Chromium version to generate
This also adds the script as a script in the `package.json` with the
naming such that `npm generate` will re-generate the Chromium version
file. This will ensure that the CI checks fail when the Chromium version
doesn't match the minimum supported VS Code version.
2024-01-03 11:42:20 +01:00
Koen Vlaswinkel
7444605970 Add GitHub Actions workflow for updating Node version 2024-01-03 11:38:15 +01:00
Koen Vlaswinkel
cce0e146ff Merge pull request #3182 from github/koesie10/vscode-versions
Add scripts for updating the Node and Chromium versions
2024-01-03 11:36:35 +01:00
Koen Vlaswinkel
de24e25486 Use semver range for @types/node
According to the DefinitelyTyped documentation, the patch version of
the type declaration package is unrelated to the library patch version.
Therefore, we should use an X-range for `@types/node` to allow
newer patch versions to be installed automatically.
2024-01-03 11:08:44 +01:00
Nora
8daf3374bf Merge pull request #3181 from github/nora/adjust-log-messages
Remove ambiguity from 'View logs' messages
2024-01-03 10:53:47 +01:00
Robert
b27d8a1000 Merge pull request #3183 from github/robertbrignull/remove_releases_repo_config
Remove ownerName and repositoryName from DistributionConfig
2024-01-03 09:46:45 +00:00
Koen Vlaswinkel
1ad20fa354 Merge pull request #3163 from github/koesie10/queries-panel-no-cli-server
Do not use the CLI server to determine query pack language
2024-01-03 09:36:20 +01:00
Robert
b082455604 Remove ownerName and repositoryName from DistributionConfig 2024-01-02 16:56:20 +00:00
Koen Vlaswinkel
ed4b296e41 Allow empty qlpack files 2024-01-02 16:58:56 +01:00
Koen Vlaswinkel
cf00f8f191 Update Chromium version documentation 2024-01-02 16:28:31 +01:00
Koen Vlaswinkel
dc3e1ce096 Add script for updating Chromium version 2024-01-02 16:28:27 +01:00
Koen Vlaswinkel
e5ffdd0fbc Use correct types for qlpack file
The qlpack file is allowed to have null values for fields, instead of
them being absent. This adds the correct types to the qlpack file
schema.
2024-01-02 16:27:42 +01:00
Koen Vlaswinkel
2c7b67e2a4 Log errors during query pack discovery 2024-01-02 16:27:42 +01:00
Koen Vlaswinkel
4129962fa0 Use generated schema to validate qlpack file 2024-01-02 16:19:11 +01:00
Koen Vlaswinkel
e79f732b84 Update Node version documentation 2024-01-02 16:00:55 +01:00
Koen Vlaswinkel
49deb2e756 Add script for updating Node version 2024-01-02 16:00:55 +01:00
Koen Vlaswinkel
0be60f3e8f Extract functions to separate file 2024-01-02 16:00:55 +01:00
Koen Vlaswinkel
e294dfdf4a Add simple script for finding VS Code versions 2024-01-02 16:00:55 +01:00
Koen Vlaswinkel
870874d7f3 Merge pull request #3174 from github/koesie10/view-esbuild
Switch view to ESBuild and JSX runtime
2024-01-02 16:00:42 +01:00
Robert
856f97f859 Merge pull request #3129 from github/robertbrignull/test-issue
Create issue when CLI tests fail on the default branch
2024-01-02 14:27:44 +00:00
Nora
cfbc44311b Adjust actions log messages 2024-01-02 13:52:08 +00:00
Koen Vlaswinkel
27a326ab3e Add documentation for updating the ESBuild target 2024-01-02 14:33:59 +01:00
Nora
91ab97e923 Adjust extension log messages 2024-01-02 13:23:00 +00:00
Koen Vlaswinkel
fa7ecb782e Merge pull request #3175 from github/koesie10/rename-new-messages
Remove remaining references to new messages/new query server
2024-01-02 13:44:00 +01:00
Robert
f5dbcc8cc1 Merge pull request #3127 from github/robertbrignull/nightly-codeql
Provide option to point ReleasesApiConsumer at nightly builds repo
2024-01-02 12:21:38 +00:00
Robert
c423505c04 Update extensions/ql-vscode/test/vscode-tests/no-workspace/codeql-cli/distribution.test.ts
Co-authored-by: Koen Vlaswinkel <koesie10@users.noreply.github.com>
2024-01-02 12:05:43 +00:00
Koen Vlaswinkel
e7eb33e0cf Enable jsx-runtime configuration for linting 2024-01-02 10:42:06 +01:00
Koen Vlaswinkel
528f8b951b Remove unnecessary React imports from stories 2024-01-02 10:42:06 +01:00
Koen Vlaswinkel
74568b86b1 Remove unnecessary React imports from view code 2024-01-02 10:42:06 +01:00
Koen Vlaswinkel
039077467a Set correct JSX mode in tsconfig.json 2024-01-02 10:42:05 +01:00
Koen Vlaswinkel
ef28154b95 Improve ESBuild globs 2024-01-02 10:42:05 +01:00
Koen Vlaswinkel
47cabbb331 Remove webpack packages 2024-01-02 10:42:05 +01:00
Koen Vlaswinkel
c1a3c2f6e5 Switch view to ESBuild
This switches the view code from Webpack to ESBuild to unify the build
systems for the extension and view code. There are no changes in
behavior, except that some features are now not supported (like dynamic
require/import) and importing the `classnames` package fails. However,
these were really easy to fix and don't hinder the further development
of the view code, so I've just fixed those instances.
2024-01-02 10:42:03 +01:00
dependabot[bot]
c210a7fdf4 Bump @storybook/theming from 7.6.4 to 7.6.6 in /extensions/ql-vscode (#3180)
Bumps [@storybook/theming](https://github.com/storybookjs/storybook/tree/HEAD/code/lib/theming) from 7.6.4 to 7.6.6.
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v7.6.6/code/lib/theming)

---
updated-dependencies:
- dependency-name: "@storybook/theming"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-28 12:43:25 -08:00
dependabot[bot]
184a98531f Bump @typescript-eslint/eslint-plugin in /extensions/ql-vscode (#3179)
Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 6.15.0 to 6.16.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.16.0/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-28 12:43:03 -08:00
dependabot[bot]
9a6d44b86a Bump @storybook/manager-api from 7.6.4 to 7.6.6 in /extensions/ql-vscode (#3178)
Bumps [@storybook/manager-api](https://github.com/storybookjs/storybook/tree/HEAD/code/lib/manager-api) from 7.6.4 to 7.6.6.
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v7.6.6/code/lib/manager-api)

---
updated-dependencies:
- dependency-name: "@storybook/manager-api"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-28 11:37:03 -08:00
dependabot[bot]
d0df81c524 Bump @typescript-eslint/parser in /extensions/ql-vscode (#3177)
Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 6.15.0 to 6.16.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.16.0/packages/parser)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-28 11:36:43 -08:00
dependabot[bot]
ba8788e0a5 Bump @testing-library/jest-dom in /extensions/ql-vscode (#3176)
Bumps [@testing-library/jest-dom](https://github.com/testing-library/jest-dom) from 6.1.5 to 6.1.6.
- [Release notes](https://github.com/testing-library/jest-dom/releases)
- [Changelog](https://github.com/testing-library/jest-dom/blob/main/CHANGELOG.md)
- [Commits](https://github.com/testing-library/jest-dom/compare/v6.1.5...v6.1.6)

---
updated-dependencies:
- dependency-name: "@testing-library/jest-dom"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-28 11:36:21 -08:00
Koen Vlaswinkel
767c3cc35c Remove references to new query server 2023-12-22 16:51:26 +01:00
Koen Vlaswinkel
a6d9b6bbec Rename new-query.test.ts to query-server-client.test.ts 2023-12-22 16:20:21 +01:00
Koen Vlaswinkel
f139f1ebf8 Rename new-messages.ts to messages.ts 2023-12-22 16:18:30 +01:00
Koen Vlaswinkel
d227af4c7b Merge pull request #3172 from github/koesie10/remove-legacy-messages
Remove legacy messages
2023-12-22 16:14:45 +01:00
Koen Vlaswinkel
2b625c85e8 Merge pull request #3173 from github/koesie10/eslint-plugin-import
Add `eslint-plugin-import`
2023-12-22 16:08:46 +01:00
Koen Vlaswinkel
5ea1438036 Merge pull request #3171 from github/koesie10/remove-new-query-runner-abstraction
Remove `QueryRunner` abstraction
2023-12-22 09:44:11 +01:00
Koen Vlaswinkel
7a7092de0d Add eslint-plugin-import
It seems like we had some rules that disabled rules of this plugin, but
we didn't actually have it installed. I've now installed it, used the
recommended configuration, and removed our own disable rules. I've fixed
any errors that this introduced.
2023-12-21 17:02:37 +01:00
Koen Vlaswinkel
2ba39647f2 Remove statusString method 2023-12-21 16:59:39 +01:00
Koen Vlaswinkel
48ff62f474 Make message and succesful required 2023-12-21 16:57:46 +01:00
Koen Vlaswinkel
82c7dd52be Remove legacy messages 2023-12-21 16:19:22 +01:00
Koen Vlaswinkel
d0f122ad87 Remove formatLegacyMessage 2023-12-21 16:11:47 +01:00
Koen Vlaswinkel
ef575acd59 Remove legacy result from query history items
The legacy result was populated based on information that is already
present in `CompletedQueryInfo` anyway. Old history items which only
have the legacy result populated have not been created for at least 30
days now since the legacy query runner hasn't been used for quite a
while now.
2023-12-21 16:08:39 +01:00
Koen Vlaswinkel
785a5fa48a Remove QueryRunner abstraction
Since we're only supporting the new query server, we can remove the
`QueryRunner` abstraction and just use the `NewQueryRunner` as a
concrete `QueryRunner` without an abstract base class. This simplifies
the code of the query server and removes some unnecessary indirection.
2023-12-21 16:03:28 +01:00
Koen Vlaswinkel
43ea7eb41d Merge pull request #3170 from github/dependabot/npm_and_yarn/extensions/ql-vscode/storybook/react-webpack5-7.6.6
Bump @storybook/react-webpack5 from 7.6.4 to 7.6.6 in /extensions/ql-vscode
2023-12-21 15:25:55 +01:00
Koen Vlaswinkel
4b27d0d59c Merge pull request #3169 from github/dependabot/npm_and_yarn/extensions/ql-vscode/typescript-eslint/eslint-plugin-6.15.0
Bump @typescript-eslint/eslint-plugin from 6.13.2 to 6.15.0 in /extensions/ql-vscode
2023-12-21 15:25:39 +01:00
dependabot[bot]
1df2e54074 Bump @storybook/react-webpack5 in /extensions/ql-vscode
Bumps [@storybook/react-webpack5](https://github.com/storybookjs/storybook/tree/HEAD/code/frameworks/react-webpack5) from 7.6.4 to 7.6.6.
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v7.6.6/code/frameworks/react-webpack5)

---
updated-dependencies:
- dependency-name: "@storybook/react-webpack5"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-21 14:13:27 +00:00
dependabot[bot]
b7eba71ab6 Bump @typescript-eslint/eslint-plugin in /extensions/ql-vscode
Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 6.13.2 to 6.15.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.15.0/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-21 14:12:54 +00:00
Koen Vlaswinkel
7375fce82d Merge pull request #3167 from github/dependabot/npm_and_yarn/extensions/ql-vscode/storybook-7.6.6
Bump storybook from 7.6.4 to 7.6.6 in /extensions/ql-vscode
2023-12-21 15:11:58 +01:00
Koen Vlaswinkel
eac3836535 Merge pull request #3168 from github/dependabot/npm_and_yarn/extensions/ql-vscode/eslint-8.56.0
Bump eslint from 8.55.0 to 8.56.0 in /extensions/ql-vscode
2023-12-21 15:11:36 +01:00
Koen Vlaswinkel
e8f750776b Merge pull request #3166 from github/dependabot/npm_and_yarn/extensions/ql-vscode/typescript-eslint/parser-6.15.0
Bump @typescript-eslint/parser from 6.14.0 to 6.15.0 in /extensions/ql-vscode
2023-12-21 15:11:05 +01:00
Koen Vlaswinkel
91a542dce6 Merge pull request #3165 from github/dependabot/github_actions/actions/download-artifact-4
Bump actions/download-artifact from 3 to 4
2023-12-21 15:01:44 +01:00
Koen Vlaswinkel
b902bfd71d Merge pull request #3164 from github/dependabot/github_actions/actions/upload-artifact-4
Bump actions/upload-artifact from 3 to 4
2023-12-21 15:01:27 +01:00
dependabot[bot]
6dd6460b33 Bump eslint from 8.55.0 to 8.56.0 in /extensions/ql-vscode
Bumps [eslint](https://github.com/eslint/eslint) from 8.55.0 to 8.56.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v8.55.0...v8.56.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-21 13:59:34 +00:00
dependabot[bot]
36d23e7eec Bump storybook from 7.6.4 to 7.6.6 in /extensions/ql-vscode
Bumps [storybook](https://github.com/storybookjs/storybook/tree/HEAD/code/lib/cli) from 7.6.4 to 7.6.6.
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v7.6.6/code/lib/cli)

---
updated-dependencies:
- dependency-name: storybook
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-21 13:59:09 +00:00
dependabot[bot]
b65f0490f2 Bump @typescript-eslint/parser in /extensions/ql-vscode
Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 6.14.0 to 6.15.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.15.0/packages/parser)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-21 13:58:37 +00:00
Koen Vlaswinkel
a8dd368578 Merge pull request #3157 from github/koesie10/yauzl-progress
Add progress reporting for unzipping files
2023-12-21 14:40:53 +01:00
dependabot[bot]
4d130bc2fa Bump actions/download-artifact from 3 to 4
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 3 to 4.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-21 13:02:31 +00:00
dependabot[bot]
1b526783e2 Bump actions/upload-artifact from 3 to 4
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3 to 4.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-21 13:02:28 +00:00
Koen Vlaswinkel
4e4345f0c2 Merge remote-tracking branch 'origin/main' into koesie10/yauzl-progress 2023-12-21 13:41:43 +01:00
Koen Vlaswinkel
b2df8b6971 Move readableBytesMb to common/bytes 2023-12-21 13:41:22 +01:00
Koen Vlaswinkel
91ea2f089e Extract calculateTotalUncompressedByteSize function 2023-12-21 13:39:09 +01:00
Koen Vlaswinkel
fbaf3d1cdf Merge pull request #3162 from github/koesie10/yauzl-changelog
Add CHANGELOG entry for `yauzl` migration
2023-12-21 12:34:07 +01:00
Koen Vlaswinkel
7bcf62c6fe Merge pull request #3161 from github/koesie10/github-databases-package-json
Remove missed feature flag reference from package.json
2023-12-21 12:33:59 +01:00
Koen Vlaswinkel
f7c0d4dc91 Merge pull request #3160 from github/koesie10/github-databases-tests
Add tests and test plan for GitHub database download
2023-12-21 12:33:51 +01:00
Koen Vlaswinkel
e81f1a1fde Extract getQlPackLanguage function 2023-12-21 12:30:26 +01:00
Koen Vlaswinkel
c14fa63321 Remove resolveLibraryPath method 2023-12-21 12:20:44 +01:00
Koen Vlaswinkel
7554c415af Do not use the CLI server to determine query pack language
This removes the use of the CLI `codeql resolve library-path` command to
detect the language of a query pack. Instead, it uses the `qlpack.yml`
file to determine the language. This is slightly less correct since it
only works for `codeql/${language}-all` dependencies, but it is much
faster and more reliable. It also doesn't result in the CLI server
restarting for invalid query packs (such as in the `github/codeql`
repository or in any workspaces containing it).
2023-12-21 12:20:12 +01:00
Koen Vlaswinkel
bbdad0fe2c Add CHANGELOG entry for yauzl migration 2023-12-21 11:30:11 +01:00
Koen Vlaswinkel
b3da120d70 Add GitHub database download to test plan 2023-12-21 11:23:15 +01:00
Koen Vlaswinkel
3689f84612 Remove missed feature flag reference from package.json 2023-12-21 11:06:50 +01:00
Koen Vlaswinkel
f99432153b Add tests for promptGitHubRepositoryDownload 2023-12-21 10:56:34 +01:00
Koen Vlaswinkel
704895ba6c Merge pull request #3159 from github/github-action/bump-cli
Bump CLI Version to v2.15.5 for integration tests
2023-12-21 09:54:15 +01:00
Koen Vlaswinkel
f3780c6305 Merge pull request #3158 from github/koesie10/fix-qltest-discovery-watcher
Do not reregister watchers on every file change for qltests
2023-12-21 09:49:58 +01:00
github-actions[bot]
bb3ec207e3 Bump CLI version from v2.15.4 to v2.15.5 for integration tests 2023-12-20 19:08:03 +00:00
Robert
e56503249d Add tests that cover the new semver options 2023-12-20 16:25:57 +00:00
Robert
37b2e422cd Use stable instead of released 2023-12-20 16:25:57 +00:00
Robert
4140303b5c Fix arguemnts to calls to getLatestRelease 2023-12-20 16:25:54 +00:00
Koen Vlaswinkel
218be87e88 Do not reregister watchers on every file change for qltests
During the qltest discovery, we were recreating the watchers for qltests
on every file change. This was causing the watchers to be recreated
on each change, while there were no functional changes to the watchers
themselves.

This commit moves the creation of the watchers to the constructor of
the QLTestDiscovery class, and removes the creation of the watchers
from the discover() method. The behavior should be the same.
2023-12-20 13:29:40 +01:00
Robert
c7e2d69daa Define nightly by whether the value matches the default 2023-12-20 11:38:58 +00:00
Robert
ba2f44b8ae Change to using getter for no-args methods 2023-12-20 11:37:11 +00:00
Koen Vlaswinkel
2267e9d4db Add tests for unzip progress reporting 2023-12-20 10:30:59 +01:00
Koen Vlaswinkel
6f85894a11 Report progress while extracting CodeQL CLI distribution 2023-12-20 10:24:07 +01:00
Koen Vlaswinkel
8cbd77cf65 Report progress while extracting CodeQL CLI distribution in tests 2023-12-20 10:24:07 +01:00
Koen Vlaswinkel
641f714fa4 Extract downloadWithProgress function in ensureCli 2023-12-20 10:24:07 +01:00
Koen Vlaswinkel
216f10d327 Add progress reporting for intermediate bytes extracted 2023-12-20 10:24:07 +01:00
Koen Vlaswinkel
5045b2df60 Add progress reporting for bytes extracted 2023-12-20 10:24:07 +01:00
Koen Vlaswinkel
857a997037 Add progress reporting for extracted files 2023-12-20 10:24:07 +01:00
Koen Vlaswinkel
262744e6e5 Merge pull request #3155 from github/koesie10/yauzl-concurrent
Add concurrency to unzipping using `yauzl`
2023-12-20 10:23:55 +01:00
Koen Vlaswinkel
4444951093 Merge remote-tracking branch 'origin/main' into koesie10/yauzl-concurrent 2023-12-20 10:10:47 +01:00
Koen Vlaswinkel
e824fda9e7 Merge pull request #3153 from github/koesie10/yauzl-unzip-tests
Add simple tests for `yauzl`-based unzip functions
2023-12-20 10:01:45 +01:00
Koen Vlaswinkel
ef8bf9fd1b Merge pull request #3154 from github/koesie10/source-map-fix
Switch to `yauzl` for source map script
2023-12-20 09:56:23 +01:00
Robert
69dea08c47 Don't check semver for nightly releases 2023-12-19 18:47:43 +00:00
Robert
0360bf294f Merge branch 'main' into robertbrignull/nightly-codeql 2023-12-19 17:39:29 +00:00
Robert
996e8036c1 Merge branch 'main' into robertbrignull/test-issue 2023-12-19 16:20:14 +00:00
Robert
2e51c1a657 Fix workflow after testing it 2023-12-19 16:19:59 +00:00
Koen Vlaswinkel
f1fe4a20f2 chmod tmp dir before cleanup
This should fix any permissions errors we get due to the ZIP file
containing files with different permissions.
2023-12-19 15:27:07 +01:00
Koen Vlaswinkel
be4059864e Do not test file modes on Windows 2023-12-19 15:18:35 +01:00
Koen Vlaswinkel
a80098d7df Fix race condition in unzip tests 2023-12-19 15:17:57 +01:00
Koen Vlaswinkel
f45b790591 Fix file path in tests on Windows 2023-12-19 15:14:13 +01:00
Koen Vlaswinkel
7a1f157225 Extract common functionality between unzip implementations 2023-12-19 15:00:13 +01:00
Koen Vlaswinkel
ba9b284606 Add tests for unzipToDirectory 2023-12-19 14:58:16 +01:00
Koen Vlaswinkel
1055515d59 Use different ZIP file for unzip tests 2023-12-19 14:43:49 +01:00
Koen Vlaswinkel
4eee14be61 Merge remote-tracking branch 'origin/main' into koesie10/yauzl-unzip-tests 2023-12-19 14:37:03 +01:00
Koen Vlaswinkel
7c00768c90 Extract unzipFile function 2023-12-19 14:27:51 +01:00
Koen Vlaswinkel
9038586aab Rename unzipToDirectory to unzipToDirectorySequentially 2023-12-19 14:26:03 +01:00
Koen Vlaswinkel
800890443e Add concurrent unzip implementation 2023-12-19 14:25:44 +01:00
Koen Vlaswinkel
0dcc814953 Remove unzipper 2023-12-19 14:20:42 +01:00
Koen Vlaswinkel
64ad40e369 Switch to yauzl for the source map script 2023-12-19 14:20:17 +01:00
Koen Vlaswinkel
f736adc4f1 Merge pull request #3152 from github/koesie10/distribution-yauzl
Switch to `yauzl` for CodeQL CLI
2023-12-19 14:18:59 +01:00
Koen Vlaswinkel
e89a04d442 Merge pull request #3151 from github/koesie10/variant-analysis-yauzl
Switch to `yauzl` for variant analysis results
2023-12-19 14:18:49 +01:00
Koen Vlaswinkel
2e6eb1c7bc Add simple tests for yauzl-based unzip functions 2023-12-19 13:19:48 +01:00
Koen Vlaswinkel
fdc36ad36b Switch to yauzl for CodeQL CLI
This switches the CodeQL CLI download to `yauzl` instead of `unzipper`.
There should be no changes in behavior. I tested this manually on
Insiders by removing the distribution directory and this successfully
downloaded and extracted the CLI.
2023-12-19 13:07:31 +01:00
Koen Vlaswinkel
3f6c1055e4 Merge remote-tracking branch 'origin/main' into koesie10/variant-analysis-yauzl 2023-12-19 13:03:54 +01:00
Koen Vlaswinkel
b833591d1e Merge pull request #3150 from github/koesie10/archive-filesystem-yauzl
Switch to `yauzl` in the archive filesystem provider
2023-12-19 12:14:31 +01:00
Koen Vlaswinkel
82f17c4e53 Merge pull request #3148 from github/koesie10/model-editor-capitalization
Fix incorrect model files on case-insensitive file systems
2023-12-18 16:34:12 +01:00
Koen Vlaswinkel
790503bd60 Merge pull request #3149 from github/koesie10/database-unbundle
Remove fallback behavior for database unbundle
2023-12-18 15:13:55 +01:00
Koen Vlaswinkel
770834756a Switch to yauzl for variant analysis results 2023-12-18 15:10:36 +01:00
Koen Vlaswinkel
bc0506d058 Switch to yauzl in the archive filesystem provider 2023-12-18 14:22:22 +01:00
Koen Vlaswinkel
14b2282015 Remove fallback behavior for database unbundle
The CodeQL CLI always supports the `database unbundle` command since
140d369098
so we can remove the fallback behavior.

There were some places which were not passing in the CodeQL CLI server,
but these always have access to the CLI server, so this just passes them
in.

The only change in behavior (in terms of the fallback behavior) is in
the `new-query.test.ts` test.
2023-12-18 14:19:59 +01:00
Koen Vlaswinkel
12ea1b9598 Remove unnecessary check 2023-12-18 13:49:04 +01:00
Koen Vlaswinkel
6cfa0a93c9 Merge pull request #3141 from github/koesie10/model-editor-consistency-check
Add a consistency check for the model editor
2023-12-15 15:11:04 +01:00
Koen Vlaswinkel
ef2f9d9c90 Fix incorrect model files on case-insensitive file systems
This fixes some incorrect model files on case-insensitive file systems
when the package names are the same but the capitalization is different.

For example, when there are two packages `Volo.Abp.TestApp.MongoDb` and
`Volo.Abp.TestApp.MongoDB`, there would be 1 model file for each
package. However, on case-insensitive file systems, the second file
would overwrite the first file. This results in missing models. This
fixes it by canonicalizing the filenames to lowercase and writing all
files with the same package name to the same file.
2023-12-15 15:06:22 +01:00
Koen Vlaswinkel
1891763d64 Remove enableConsistencyCheck feature flag 2023-12-15 14:48:35 +01:00
Koen Vlaswinkel
0b4fc76fdb Update inconsistent support message 2023-12-15 14:47:11 +01:00
Koen Vlaswinkel
d036e8144d Do not expect type models to be supported 2023-12-15 14:43:55 +01:00
Koen Vlaswinkel
4f2d768e07 Update message to mention model editor 2023-12-15 14:43:08 +01:00
Koen Vlaswinkel
60d777abf1 Merge pull request #3113 from github/koesie10/compare-interpreted
Add SARIF result comparison to compare view
2023-12-15 10:56:04 +01:00
Koen Vlaswinkel
34bd7c21a6 Merge pull request #3147 from github/koesie10/remove-immutable
Remove immutable package
2023-12-15 09:49:03 +01:00
Koen Vlaswinkel
6cf8d0be4f Merge pull request #3145 from github/dependabot/npm_and_yarn/extensions/ql-vscode/tmp-0.2.1
Bump tmp from 0.1.0 to 0.2.1 in /extensions/ql-vscode
2023-12-14 16:28:02 +01:00
Koen Vlaswinkel
b340b1a740 Merge branch 'main' into dependabot/npm_and_yarn/extensions/ql-vscode/tmp-0.2.1 2023-12-14 16:13:18 +01:00
Koen Vlaswinkel
ce83d1df23 Replace tmp package for modeled-method-fs.test.ts 2023-12-14 16:09:30 +01:00
Koen Vlaswinkel
d63b756520 Set unsafeCleanup for all test tmp directories
We want to remove the tmp directories after tests, even if they are not
empty.
2023-12-14 15:08:45 +01:00
Koen Vlaswinkel
47fbf3428f Remove immutable package 2023-12-14 15:03:34 +01:00
dependabot[bot]
889055ee19 Bump tmp from 0.1.0 to 0.2.1 in /extensions/ql-vscode
Bumps [tmp](https://github.com/raszi/node-tmp) from 0.1.0 to 0.2.1.
- [Changelog](https://github.com/raszi/node-tmp/blob/master/CHANGELOG.md)
- [Commits](https://github.com/raszi/node-tmp/compare/v0.1.0...v0.2.1)

---
updated-dependencies:
- dependency-name: tmp
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-14 13:44:44 +00:00
Koen Vlaswinkel
c7f08e328d Merge pull request #3144 from github/dependabot/npm_and_yarn/extensions/ql-vscode/p-queue-8.0.1
Bump p-queue from 7.4.1 to 8.0.1 in /extensions/ql-vscode
2023-12-14 14:44:39 +01:00
Koen Vlaswinkel
0273be9710 Merge pull request #3143 from github/dependabot/npm_and_yarn/extensions/ql-vscode/vscode/codicons-0.0.35
Bump @vscode/codicons from 0.0.31 to 0.0.35 in /extensions/ql-vscode
2023-12-14 14:44:12 +01:00
Koen Vlaswinkel
e94da0e765 Merge pull request #3142 from github/dependabot/npm_and_yarn/extensions/ql-vscode/gulp-esbuild-0.12.0
Bump gulp-esbuild from 0.10.8 to 0.12.0 in /extensions/ql-vscode
2023-12-14 14:43:10 +01:00
Koen Vlaswinkel
cb15c8dbeb Remove direct esbuild dependency
ESBuild is a dependency of `gulp-esbuild`, so we don't need the direct
dependency.
2023-12-14 14:29:56 +01:00
dependabot[bot]
c7173e86a2 Bump p-queue from 7.4.1 to 8.0.1 in /extensions/ql-vscode
Bumps [p-queue](https://github.com/sindresorhus/p-queue) from 7.4.1 to 8.0.1.
- [Release notes](https://github.com/sindresorhus/p-queue/releases)
- [Commits](https://github.com/sindresorhus/p-queue/compare/v7.4.1...v8.0.1)

---
updated-dependencies:
- dependency-name: p-queue
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-14 13:19:19 +00:00
dependabot[bot]
b3c8c25572 Bump @vscode/codicons from 0.0.31 to 0.0.35 in /extensions/ql-vscode
Bumps [@vscode/codicons](https://github.com/microsoft/vscode-codicons) from 0.0.31 to 0.0.35.
- [Release notes](https://github.com/microsoft/vscode-codicons/releases)
- [Commits](https://github.com/microsoft/vscode-codicons/compare/0.0.31...0.0.35)

---
updated-dependencies:
- dependency-name: "@vscode/codicons"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-14 13:18:45 +00:00
dependabot[bot]
2bad58be71 Bump gulp-esbuild from 0.10.8 to 0.12.0 in /extensions/ql-vscode
Bumps [gulp-esbuild](https://github.com/ym-project/gulp-esbuild) from 0.10.8 to 0.12.0.
- [Release notes](https://github.com/ym-project/gulp-esbuild/releases)
- [Commits](https://github.com/ym-project/gulp-esbuild/compare/v0.10.8...v0.12.0)

---
updated-dependencies:
- dependency-name: gulp-esbuild
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-14 13:18:21 +00:00
Koen Vlaswinkel
fe4116fe05 Merge pull request #3140 from github/koesie10/remove-bundled-queries
Remove bundled Java and C# model editor queries
2023-12-14 13:19:37 +01:00
Koen Vlaswinkel
b9b16a8beb Add a consistency check for the model editor 2023-12-14 12:07:59 +01:00
Koen Vlaswinkel
c3b30a30e8 Merge pull request #3139 from github/koesie10/upgrade-markdownlint
Upgrade Markdownlint packages
2023-12-14 11:50:04 +01:00
Koen Vlaswinkel
04e4efb26b Remove bundled Java and C# model editor queries 2023-12-14 11:38:04 +01:00
Koen Vlaswinkel
8d1c8bc725 Add alt text to Overview.stories.mdx 2023-12-14 10:50:16 +01:00
Koen Vlaswinkel
eb1bf8fd69 Merge pull request #3138 from github/koesie10/remove-github-databases-enable-ff
Remove GitHub database download feature flag
2023-12-14 10:48:56 +01:00
Koen Vlaswinkel
9a77748a59 Fix auto-fixable markdownlint violations
This fixes all violations that can be fixed by using
`npm run lint:markdown -- --fix`.

This also updates the markdownlint configuration to require dashes in
unstyled lists. This results in the least amount of changes to Markdown
files. The default setting results in rewriting the complete CHANGELOG
file.
2023-12-14 10:47:39 +01:00
Koen Vlaswinkel
d77a08fc37 Upgrade markdownlint packages 2023-12-14 10:42:05 +01:00
Koen Vlaswinkel
cb2e5026a1 Update CHANGELOG 2023-12-14 10:27:54 +01:00
Koen Vlaswinkel
d4a4536d40 Improve performance of compare view using Promise.all 2023-12-14 10:22:10 +01:00
Koen Vlaswinkel
ab1966abf1 Add comparison of SARIF results in compare view
This wires up the comparison of SARIF results in the compare view. It
uses the same diffing algorithm as the raw results, but it uses the
SARIF results instead of the raw results.
2023-12-14 10:22:10 +01:00
Koen Vlaswinkel
6de954143c Read raw result sets in compareResults
This moves reading of the result sets to the `compareResults` method
since raw result sets don't need to be read for interpreted results and
the `findResultSetsToCompare` method is shared between the two types
of results.
2023-12-14 10:22:10 +01:00
Koen Vlaswinkel
109766d411 Add alerts table to compare view if available
This adds the `alerts` result set to the compare view if an interpreted
result is available. This assumes that the user has opened the query
in the results view before opening the compare view. It will not
interpret the results if the interpreted results are not available.
2023-12-14 10:22:09 +01:00
Koen Vlaswinkel
4bd1981a34 Update CHANGELOG 2023-12-14 10:10:14 +01:00
Koen Vlaswinkel
0415ac539c Merge pull request #3112 from github/koesie10/compare-sarif-view
Add interpreted results table to compare view
2023-12-14 10:10:07 +01:00
Koen Vlaswinkel
cf50a71a16 Remove GitHub database download feature flag
This removes the `codeQL.githubDatabase.enable` setting and always
enables the GitHub database download feature.
2023-12-14 10:08:14 +01:00
Charis Kyriakou
598f2eb3f2 Allow the CodeQL CLI path to be set from an environment variable (#3118) 2023-12-14 09:03:25 +00:00
Koen Vlaswinkel
480f90ac2f Merge remote-tracking branch 'origin/main' into koesie10/compare-sarif-view 2023-12-14 09:54:50 +01:00
Andrew Eisenberg
e15f15358b Merge pull request #3125 from github/aeisenberg/no-multi-token
Avoid creating a multitoken when finding definitions
2023-12-13 15:07:52 -08:00
Andrew Eisenberg
8516940e64 Add changelog note 2023-12-13 22:52:19 +00:00
Andrew Eisenberg
ef69a51741 Avoid creating a multitoken when finding definitions
This will avoid showing a query-server popup on hovers. When someone
does CTRL+hover on source code in a database archive, the definitions
provider is triggered. The first time this is run, there will be a query that
is invoked in order to find definitions. This can be a long process.

Previously, this query brought up a popup window that could be cancelled.
However, this is confusing users since the query is automatically cancelled
when the mouse hovers away from the element.

The downside of this PR is that even when find definitions is explicitly invoked,
(using F12), there will still be no hover.

I think this is an improvement, but I am happy to discuss if others disagree.
2023-12-13 22:50:37 +00:00
Koen Vlaswinkel
9594a5e951 Merge pull request #3136 from github/dependabot/npm_and_yarn/extensions/ql-vscode/types/tar-stream-3.1.3
Bump @types/tar-stream from 2.2.3 to 3.1.3 in /extensions/ql-vscode
2023-12-13 16:55:25 +01:00
Koen Vlaswinkel
7b9c7f4e21 Merge pull request #3135 from github/dependabot/npm_and_yarn/extensions/ql-vscode/markdownlint-cli2-formatter-pretty-0.0.5
Bump markdownlint-cli2-formatter-pretty from 0.0.4 to 0.0.5 in /extensions/ql-vscode
2023-12-13 16:07:39 +01:00
Koen Vlaswinkel
25ff95a2f3 Merge pull request #3134 from github/dependabot/npm_and_yarn/extensions/ql-vscode/typescript-eslint/parser-6.14.0
Bump @typescript-eslint/parser from 6.13.2 to 6.14.0 in /extensions/ql-vscode
2023-12-13 16:07:31 +01:00
dependabot[bot]
25779b4db1 Bump @types/tar-stream from 2.2.3 to 3.1.3 in /extensions/ql-vscode
Bumps [@types/tar-stream](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/tar-stream) from 2.2.3 to 3.1.3.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/tar-stream)

---
updated-dependencies:
- dependency-name: "@types/tar-stream"
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-13 14:53:46 +00:00
dependabot[bot]
611f55b9cd Bump markdownlint-cli2-formatter-pretty in /extensions/ql-vscode
Bumps [markdownlint-cli2-formatter-pretty](https://github.com/DavidAnson/markdownlint-cli2) from 0.0.4 to 0.0.5.
- [Changelog](https://github.com/DavidAnson/markdownlint-cli2/blob/main/CHANGELOG.md)
- [Commits](https://github.com/DavidAnson/markdownlint-cli2/compare/v0.0.4...v0.0.5)

---
updated-dependencies:
- dependency-name: markdownlint-cli2-formatter-pretty
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-13 14:53:27 +00:00
dependabot[bot]
b8558a67a3 Bump @typescript-eslint/parser in /extensions/ql-vscode
Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 6.13.2 to 6.14.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.14.0/packages/parser)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-13 14:53:12 +00:00
Koen Vlaswinkel
3d65ecaac9 Merge pull request #3126 from github/koesie10/remove-types-classnames
Remove `@types/classnames` package
2023-12-13 15:51:39 +01:00
Koen Vlaswinkel
61c9503d52 Merge pull request #3132 from github/koesie10/dependabot-all
Do not ignore patch/minor updates in Dependabot configuration
2023-12-13 15:51:26 +01:00
Koen Vlaswinkel
01f5a65f7d Remove @types/classnames package
`classnames` provides its own type definitions, so we do not need to
have this installed.
2023-12-13 15:33:17 +01:00
Koen Vlaswinkel
612499916d Do not ignore patch/minor updates in Dependabot configuration 2023-12-13 15:03:10 +01:00
Koen Vlaswinkel
a2294bb5cc Merge pull request #3122 from github/koesie10/npm-upgrade
Run `npm upgrade`
2023-12-13 14:57:29 +01:00
Koen Vlaswinkel
0b7b6f1b13 Merge remote-tracking branch 'origin/main' into koesie10/npm-upgrade 2023-12-13 14:40:30 +01:00
Koen Vlaswinkel
8b2fd1a630 Merge pull request #3131 from github/version/bump-to-v1.11.1
Bump version to v1.11.1
2023-12-13 14:39:00 +01:00
Koen Vlaswinkel
4bb25a7d69 Merge pull request #3093 from github/koesie10/separate-bqrs-types
Create separate types for raw results sets
2023-12-13 14:27:45 +01:00
github-actions[bot]
83bdb54047 Bump version to v1.11.1 2023-12-13 13:17:03 +00:00
Koen Vlaswinkel
0d380736b3 Merge pull request #3130 from github/v1.11.0
v1.11.0
2023-12-13 14:15:23 +01:00
Koen Vlaswinkel
0655e10db5 Remove canary requirement for CodeQL Methods Usage panel
Some checks failed
Release / Release (push) Has been cancelled
Release / Publish to VS Code Marketplace (push) Has been cancelled
Release / Publish to Open VSX Registry (push) Has been cancelled
2023-12-13 12:10:34 +01:00
Koen Vlaswinkel
fb713f733d Upgrade @vscode/test-electron
This upgrades this package to fix tests on Windows. It seems like the
extraction of the VS Code archive is failing, which is fixed in the
newest version.
2023-12-13 10:16:26 +01:00
Koen Vlaswinkel
15cc559792 v1.11.0 2023-12-13 09:48:49 +01:00
Koen Vlaswinkel
a2f3f5fbe3 Merge pull request #3128 from github/koesie10/feature-flags-1.11.0
Remove feature flags for release v1.11.0
2023-12-13 09:39:27 +01:00
Robert
54a03c8839 Create issue when CLI tests fail on the default branch 2023-12-12 16:43:03 +00:00
Koen Vlaswinkel
ce84fed6ab Update CHANGELOG 2023-12-12 14:57:01 +01:00
Koen Vlaswinkel
6ecad9db03 Remove modeled-methods-legacy file 2023-12-12 14:51:38 +01:00
Koen Vlaswinkel
9543d14840 Remove unnecessary ModeledMethodsPanel 2023-12-12 14:49:19 +01:00
Koen Vlaswinkel
6eee7983b0 Remove showMultipleModels props 2023-12-12 14:48:45 +01:00
Koen Vlaswinkel
6ec0f51a54 Remove showMultipleModels from view states 2023-12-12 14:43:42 +01:00
Koen Vlaswinkel
5a29d35c98 Remove showMultipleModels config 2023-12-12 14:35:15 +01:00
Koen Vlaswinkel
16ebac12a1 Move showMultipleModels out of canary 2023-12-12 14:33:57 +01:00
Koen Vlaswinkel
2b6fe94cd3 Move codeQLMethodModeling out of canary 2023-12-12 14:33:38 +01:00
Koen Vlaswinkel
bc1c08c653 Merge remote-tracking branch 'origin/main' into koesie10/separate-bqrs-types 2023-12-12 14:15:24 +01:00
Robert
66c0714606 Point ReleasesApiConsumer at nightly repo if config value is set 2023-12-12 10:43:03 +00:00
Shati Patel
9cb4d233d9 CodeQL model editor: Make "add" and "delete" buttons more intuitive (#3123) 2023-12-12 10:42:32 +00:00
Koen Vlaswinkel
8fac9b1413 Merge pull request #3124 from github/github-action/bump-cli
Bump CLI Version to v2.15.4 for integration tests
2023-12-12 10:23:57 +01:00
Nora
6c76218b21 Merge pull request #3106 from github/nora/remove-local-db-code
Delete local db functionality
2023-12-12 09:38:16 +01:00
github-actions[bot]
d4a4cbb4f1 Bump CLI version from v2.15.3 to v2.15.4 for integration tests 2023-12-11 16:54:11 +00:00
Koen Vlaswinkel
3a8beb9ab9 Suppress github/a11y-no-title-attribute violation
This requires more work, but for now we just suppress the violation.
2023-12-11 17:05:39 +01:00
Koen Vlaswinkel
afdd20a957 Fix github/a11y-svg-has-accessible-name violation 2023-12-11 17:03:21 +01:00
Koen Vlaswinkel
bf5398bfc9 Fix import/no-named-as-default violations 2023-12-11 17:02:20 +01:00
Koen Vlaswinkel
01085e75ba Automatically fix ESLint violations 2023-12-11 17:00:16 +01:00
Koen Vlaswinkel
7f332e3374 Add retryCount to mocked Octokit responses 2023-12-11 16:41:15 +01:00
Koen Vlaswinkel
39229c26d4 Run npm upgrade 2023-12-11 16:41:15 +01:00
Kasper Svendsen
0f437f7a92 Merge pull request #3121 from github/kaspersv/port-dca-ra-parser-updates
Port DCA join-order badness RA parser changes
2023-12-11 15:40:08 +01:00
Kasper Svendsen
0df9a54d89 Port DCA join-order badness RA parser changes 2023-12-11 09:50:09 +01:00
Nora
4f85ac11a9 Merge pull request #3120 from github/nora/make-top-banner-sticky
Make model editor top banner sticky
2023-12-08 16:24:31 +01:00
Nora
118ad9d530 Fix background color 2023-12-08 15:09:36 +00:00
Nora
2a44bf78c8 Update Changelog 2023-12-08 14:13:05 +00:00
Nora
cf301aa338 Make header sticky 2023-12-08 14:10:09 +00:00
Nora
0e96941c89 Move save-refresh buttons to Header 2023-12-08 14:09:50 +00:00
Koen Vlaswinkel
f596f7ee74 Merge pull request #3117 from github/koesie10/fix-ruby-modules
Add support for models on types for Ruby
2023-12-08 14:42:23 +01:00
Koen Vlaswinkel
87e42b499d Merge pull request #3119 from github/koesie10/update-ruby-query
Update model editor Ruby queries
2023-12-08 14:00:07 +01:00
Nora
8acff5ce72 Remove from other files 2023-12-08 12:42:27 +00:00
Koen Vlaswinkel
47797eb7e6 Update model editor Ruby queries 2023-12-08 11:47:52 +01:00
Koen Vlaswinkel
0a4d28e9f0 Fix empty method names in output for Ruby
This fixes the output of the Ruby MaD models when the method name is
empty which can happen when the model applies to a type rather than to
a method.
2023-12-07 16:51:58 +01:00
Koen Vlaswinkel
01956072b3 Fix rendering of method names
This fixes the rendering of method names when either the type or method
name is empty. This can happen when the method is a not in a class or
when the method is a synthetic method and the properties actually apply
to the type.
2023-12-07 16:51:58 +01:00
Koen Vlaswinkel
49114cc143 Add interpreted results table to compare view 2023-12-07 10:56:51 +01:00
Koen Vlaswinkel
789719a26c Merge pull request #3115 from github/koesie10/compare-messages
Split compare view messages
2023-12-07 10:54:23 +01:00
Koen Vlaswinkel
8d711624bb Merge remote-tracking branch 'origin/main' into koesie10/compare-messages 2023-12-07 10:39:28 +01:00
Koen Vlaswinkel
7b6b303040 Merge pull request #3111 from github/koesie10/compare-raw
Add interpreted results type to compare view
2023-12-07 10:35:41 +01:00
Koen Vlaswinkel
86aa4ffb6f Merge pull request #3114 from github/koesie10/compare-default
Change compare view default selected result set
2023-12-07 10:21:24 +01:00
Koen Vlaswinkel
1235172147 Rename type to kind 2023-12-07 10:20:00 +01:00
Koen Vlaswinkel
4873d7eb12 Fix postMessage beint sent before webview is loaded 2023-12-06 16:21:16 +01:00
Koen Vlaswinkel
27418898b0 Cache common result set names
This caches the common result set names and moves the common result set
names from the `SetComparisonsMessage` to the
`SetComparisonQueryInfoMessage`.
2023-12-06 16:08:25 +01:00
Koen Vlaswinkel
3554bceac0 Split compare view messages
This splits the compare view messages into two different messages. One
contains the metadata that doesn't change when the user selects a
different result set, and the other contains the actual results.
2023-12-06 16:07:26 +01:00
Koen Vlaswinkel
71d4fd7b0a Change compare view default result set name
This changes the default result set that is selected in the compare view
to the same as the default result set in the results view. This will
select `#select` by default for most queries, rather than the first
result set, which could be `edges` or `nodes` for some queries.
2023-12-06 15:10:49 +01:00
Koen Vlaswinkel
151c031732 Merge pull request #3110 from github/koesie10/result-styled
Switch to styled-components for some components in the results view
2023-12-06 14:35:20 +01:00
Koen Vlaswinkel
af68d99509 Add interpreted results type to compare view 2023-12-06 12:33:18 +01:00
Koen Vlaswinkel
3f2114a7f0 Extract octicons to components 2023-12-06 11:59:01 +01:00
Koen Vlaswinkel
4f14592dd7 Extract vscode-codeql__vertical-rule class to component 2023-12-06 11:58:32 +01:00
Koen Vlaswinkel
acca6b34f8 Remove vscode-codeql__title class 2023-12-06 11:58:32 +01:00
Koen Vlaswinkel
f847c36fb7 Remove vscode-codeql__result-table-location-link class
This seems to be unused.
2023-12-06 11:58:31 +01:00
Koen Vlaswinkel
1ed72c6bbe Switch to styled-components for EmptyQueryResultsMessage 2023-12-06 11:58:20 +01:00
Koen Vlaswinkel
d72f3f40d2 Merge pull request #3108 from github/koesie10/compare-styled
Switch to styled-components for compare components
2023-12-06 11:57:27 +01:00
Koen Vlaswinkel
4a46873dd3 Merge remote-tracking branch 'origin/main' into koesie10/compare-styled 2023-12-06 11:42:29 +01:00
Nora
acbd973bd2 db-manager: remove tests and functionality 2023-12-06 10:36:50 +00:00
Koen Vlaswinkel
4a321708db Merge pull request #3107 from github/koesie10/fix-compare-loading-message
Fix loading message for compare view
2023-12-06 11:33:52 +01:00
Charis Kyriakou
3f07082e55 Add note in Model with AI test case in test plan (#3109) 2023-12-06 10:23:33 +00:00
Koen Vlaswinkel
80081af377 Merge pull request #3105 from github/koesie10/create-raw-compare-result-table
Extract `RawCompareResultTable` component
2023-12-06 11:21:19 +01:00
Koen Vlaswinkel
a42e9ebbf1 Update CHANGELOG 2023-12-06 11:19:04 +01:00
Nora
9f667ef2d2 db-panel: remove tests and functionality 2023-12-06 10:18:35 +00:00
Koen Vlaswinkel
b421a1916c Switch to styled-components for compare components 2023-12-06 11:04:45 +01:00
Koen Vlaswinkel
ddf4407c8c Fix loading message for compare view 2023-12-06 10:59:30 +01:00
Koen Vlaswinkel
aa9cb89369 Extract RawCompareResultTable component 2023-12-06 10:51:03 +01:00
Koen Vlaswinkel
cce858561f Merge pull request #3103 from github/koesie10/compare-view-results
Move columns in compare view to result
2023-12-06 09:57:30 +01:00
Koen Vlaswinkel
f4cc9f9fbb Move columns in compare view to result
The columns are part of the result, so they should be moved there. This
is in preparation of showing SARIF results in the same view, which don't
have columns.
2023-12-05 16:55:54 +01:00
Koen Vlaswinkel
9c200e036a Merge pull request #3102 from github/koesie10/refactor-compare-view
Refactor compare view
2023-12-05 16:49:45 +01:00
Koen Vlaswinkel
3020bf711b Merge pull request #3094 from github/koesie10/remove-legacy-query-server
Remove the legacy query server
2023-12-05 12:08:54 +01:00
Koen Vlaswinkel
b1289a4598 Rename findCommonResultSetNames to findResultSetsToCompare 2023-12-05 11:02:27 +01:00
Koen Vlaswinkel
da8d32c4bc Return object from findCommonResultSetNames 2023-12-05 11:02:27 +01:00
Koen Vlaswinkel
f3a0ad2e18 Use BQRS types for compare view 2023-12-05 11:02:27 +01:00
Koen Vlaswinkel
331d39afcf Cache BQRS schemas in compare view 2023-12-05 10:26:24 +01:00
Koen Vlaswinkel
b6ba0bbcb9 Create showResultsInternal method 2023-12-05 10:24:15 +01:00
Koen Vlaswinkel
496d05c900 Create findResultSetNames function 2023-12-05 10:21:57 +01:00
Koen Vlaswinkel
76534bccd7 Add comment to formatLegacyMessage 2023-12-04 10:58:57 +01:00
dependabot[bot]
d28cc6e3f2 Bump @adobe/css-tools from 4.3.1 to 4.3.2 in /extensions/ql-vscode (#3098)
Bumps [@adobe/css-tools](https://github.com/adobe/css-tools) from 4.3.1 to 4.3.2.
- [Changelog](https://github.com/adobe/css-tools/blob/main/History.md)
- [Commits](https://github.com/adobe/css-tools/commits)

---
updated-dependencies:
- dependency-name: "@adobe/css-tools"
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-01 09:45:35 -08:00
dependabot[bot]
a6703e11e3 Bump cosmiconfig from 8.2.0 to 9.0.0 in /extensions/ql-vscode (#3095)
Bumps [cosmiconfig](https://github.com/cosmiconfig/cosmiconfig) from 8.2.0 to 9.0.0.
- [Release notes](https://github.com/cosmiconfig/cosmiconfig/releases)
- [Changelog](https://github.com/cosmiconfig/cosmiconfig/blob/main/CHANGELOG.md)
- [Commits](https://github.com/cosmiconfig/cosmiconfig/compare/v8.2.0...v9.0.0)

---
updated-dependencies:
- dependency-name: cosmiconfig
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-30 10:00:28 -08:00
Koen Vlaswinkel
cf6abc43b1 Remove unused legacy messages 2023-11-28 16:35:30 +01:00
Koen Vlaswinkel
ce20c7f6a4 Remove legacy query server 2023-11-28 16:11:26 +01:00
Koen Vlaswinkel
b8ec847253 Add tests for bqrsToResultSet 2023-11-27 14:25:59 +01:00
Koen Vlaswinkel
a0c85b78c5 Rename bqrs-result to bqrs-raw-results-mapper 2023-11-27 14:14:55 +01:00
Koen Vlaswinkel
f0a354917e Fix tests 2023-11-27 14:14:04 +01:00
Koen Vlaswinkel
082c5e4a31 Prefix BQRS types with Bqrs 2023-11-27 13:38:04 +01:00
Koen Vlaswinkel
439cfcc023 Remove getResultSetSchema function 2023-11-27 13:38:04 +01:00
Koen Vlaswinkel
297f5a9f67 Remove schema from interpreted results type 2023-11-27 13:38:04 +01:00
Koen Vlaswinkel
e7c79f04c6 Remove dead code 2023-11-27 13:38:04 +01:00
Koen Vlaswinkel
76529572f5 Switch AST viewer to use new result types 2023-11-27 13:38:04 +01:00
Koen Vlaswinkel
63d6793795 Remove some unused BQRS methods/argument type unions 2023-11-27 13:38:04 +01:00
Koen Vlaswinkel
fc2e6d0432 Use new raw result types in result and compare views 2023-11-27 13:38:04 +01:00
Koen Vlaswinkel
cb707aea50 Use new raw result types for variant analyses 2023-11-27 13:38:04 +01:00
Koen Vlaswinkel
cd26f27e6e Introduce raw result types 2023-11-27 13:38:04 +01:00
Robert
3c98f94d3e Merge pull request #3091 from MathiasVP/autocomplete-to-new-dataflow-and-taint-tracking
Change dataflow and taint-tracking snippets to match the module-based API
2023-11-27 11:55:45 +00:00
Mathias Vorreiter Pedersen
558f7f6dbf No need for a whitespace on a blank line. 2023-11-27 10:55:32 +00:00
Mathias Vorreiter Pedersen
0d4dbb059b Update change log. 2023-11-24 18:02:40 +00:00
Mathias Vorreiter Pedersen
291bdbec8d Change dataflow and taint-tracking snippets to match the module-based API. 2023-11-24 17:51:56 +00:00
Koen Vlaswinkel
98b30af0a0 Merge pull request #3090 from github/koesie10/silent-resolve-tests
Silence `resolve tests` command
2023-11-24 16:56:56 +01:00
Koen Vlaswinkel
992079d99f Merge pull request #3089 from github/koesie10/eslint-curly
Enable ESLint `curly` rule
2023-11-24 16:08:22 +01:00
Koen Vlaswinkel
d5e7e54293 Merge pull request #3086 from github/koesie10/fix-cli-tests
Fix tests with `workspaceContains:.git` activation event
2023-11-24 15:57:23 +01:00
Koen Vlaswinkel
d0d12b78b2 Merge pull request #3081 from github/koesie10/github-databases-directory
Move GitHub databases files to separate directory
2023-11-24 15:44:56 +01:00
Koen Vlaswinkel
2e06fa3f5f Remove ensureDir call 2023-11-24 15:38:22 +01:00
Koen Vlaswinkel
cab510f2dd Introduce forceUpdateConfiguration method 2023-11-24 15:36:27 +01:00
Koen Vlaswinkel
5e6b7d846e Rename GitHubDatabaseModule to GitHubDatabasesModule 2023-11-24 15:31:33 +01:00
Koen Vlaswinkel
85d7b9b2fe Merge pull request #3088 from github/koesie10/locations-preserve-focus
Preserve focus on results viewer when showing location
2023-11-24 15:04:27 +01:00
Koen Vlaswinkel
08721179dc Silence resolve tests command
This hides that the `resolve tests` command is run from the user, as it
is run as part of a background process and spams the log.
2023-11-24 14:46:12 +01:00
Koen Vlaswinkel
918661e5ce Enable ESLint curly rule
This enables [the ESLint `curly` rule](https://eslint.org/docs/latest/rules/curly)
with its options set to `all`. This enforces curly braces around all
blocks, even single-line ones.

I've used `npm run lint -- --fix` to fix all occurences.
2023-11-24 14:38:32 +01:00
Koen Vlaswinkel
6324a19729 Update CHANGELOG 2023-11-24 14:21:03 +01:00
Koen Vlaswinkel
bbc77c0519 Preserve focus on results viewer when showing location
This preserves the focus on the results viewer when showing a location
to ensure that the user can navigate to the next result without having
to click or change the focus to the results viewer first. This allows
the user to quickly navigate through the results.
2023-11-24 14:19:20 +01:00
Koen Vlaswinkel
54be065f3e Fix tests with workspaceContains:.git activation event
It seems like changes to the CLI path setting are not picked up by the
extension when it is already activated. This is probably because the
`workspace.onDidChangeConfiguration` event is not fired when the update
is made programmatically.

This fixes it by manually firing the event so that all listeners (CLI
server, query server, IDE server) can pick up the change.
2023-11-24 11:15:54 +01:00
Koen Vlaswinkel
829607f044 Move GitHub databases files to separate directory 2023-11-24 10:34:49 +01:00
Koen Vlaswinkel
c3425b5146 Merge pull request #3087 from github/koesie10/drop-support-cli
Drop support for CLI versions < v2.11.6
2023-11-24 10:32:12 +01:00
Koen Vlaswinkel
ec192affdc Update CHANGELOG 2023-11-23 14:04:50 +01:00
Koen Vlaswinkel
66ae46f67c Drop support for CLI versions < v2.11.6 2023-11-23 14:04:50 +01:00
Shati Patel
424e8d3145 Discourage use of "Quick query" in single-folder workspaces (#3082) 2023-11-23 11:22:44 +00:00
Koen Vlaswinkel
208efb57d3 Merge pull request #3079 from github/koesie10/update-github-databases
Add prompt for updating GitHub databases
2023-11-23 12:16:58 +01:00
Koen Vlaswinkel
4f988de36d Update tests for isNewerDatabaseAvailable 2023-11-23 10:27:28 +01:00
Koen Vlaswinkel
e66d76aca8 Consider created_at for database updates 2023-11-23 10:17:07 +01:00
Koen Vlaswinkel
5d1b2926cc Add comment about update check 2023-11-23 10:14:04 +01:00
Koen Vlaswinkel
7b3a55e2bf Refactor handling of updateStatus 2023-11-23 10:11:36 +01:00
Koen Vlaswinkel
560008c55e Merge pull request #3085 from github/koesie10/remove-activation-event
Remove workspaceContains:.git activation event
2023-11-23 09:51:04 +01:00
Koen Vlaswinkel
b81061a8a1 Remove workspaceContains:.git activation event 2023-11-23 09:37:09 +01:00
Florin Coada
c09c26d2b3 Update CHANGELOG.md (#3084)
Updated documentation link. Original was not working.
2023-11-22 15:24:55 +00:00
github-actions[bot]
7970b09134 Bump CLI version from v2.15.2 to v2.15.3 for integration tests (#3083) 2023-11-22 14:59:42 +00:00
Koen Vlaswinkel
0523d2a63d Merge pull request #3073 from github/koesie10/download-multiple-github-databases
Allow downloading multiple databases from GitHub
2023-11-21 11:42:06 +01:00
Nora
8aae7d30d3 Merge pull request #3078 from github/dependabot/npm_and_yarn/extensions/ql-vscode/adobe/css-tools-4.3.1
Bump @adobe/css-tools from 4.0.1 to 4.3.1 in /extensions/ql-vscode
2023-11-20 16:29:45 +01:00
Koen Vlaswinkel
a0295d62f8 Add prompt for updating GitHub databases 2023-11-20 14:52:47 +01:00
Koen Vlaswinkel
4f51445609 Merge remote-tracking branch 'origin/main' into koesie10/download-multiple-github-databases 2023-11-20 14:47:18 +01:00
Koen Vlaswinkel
01d24e06f3 Merge pull request #3072 from github/koesie10/download-github-database-authentication
Use credentials for database download in non-canary mode
2023-11-20 14:40:06 +01:00
Koen Vlaswinkel
b83ef4ed68 Split up listing of databases to separate function 2023-11-20 14:20:48 +01:00
Koen Vlaswinkel
9dd061b2c8 Rename github-database-prompt to github-database-download 2023-11-20 13:37:05 +01:00
Koen Vlaswinkel
feca898c85 Merge remote-tracking branch 'origin/main' into koesie10/download-github-database-authentication 2023-11-20 11:14:13 +01:00
Koen Vlaswinkel
422f0eb7e4 Merge pull request #3071 from github/koesie10/download-github-database
Prompt user for database download on startup
2023-11-20 11:08:32 +01:00
Koen Vlaswinkel
5c03f5b43e Do not split up message 2023-11-20 10:27:18 +01:00
Koen Vlaswinkel
9ca138dc8e Rename function to promptAndDownloadGitHubDatabase 2023-11-20 10:23:16 +01:00
dependabot[bot]
40b1755868 Bump @adobe/css-tools from 4.0.1 to 4.3.1 in /extensions/ql-vscode
Bumps [@adobe/css-tools](https://github.com/adobe/css-tools) from 4.0.1 to 4.3.1.
- [Changelog](https://github.com/adobe/css-tools/blob/main/History.md)
- [Commits](https://github.com/adobe/css-tools/commits)

---
updated-dependencies:
- dependency-name: "@adobe/css-tools"
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-20 08:40:18 +00:00
Koen Vlaswinkel
d0488ddda9 Allow downloading multiple databases from GitHub
This adds the option to download multiple databases from GitHub in the
initial GitHub database download prompt. The databases will be
downloaded concurrently.

Unfortunately it doesn't seem possible to change the "OK" text in the
quick pick to "Download", so I've left it as "OK" for now.
2023-11-17 14:50:59 +01:00
Koen Vlaswinkel
5d42cbc1c8 Also use credentials in non-canary mode
We want users to be able to download databases from private/internal
repositories without using canary mode. This will change the prompt to
ask for credentials in non-canary mode as well.
2023-11-17 14:47:43 +01:00
Koen Vlaswinkel
636f8f1b5f Prompt user for database download on startup 2023-11-17 14:45:35 +01:00
Koen Vlaswinkel
c0db180200 Merge pull request #3068 from github/koesie10/find-github-repository
Add finding of GitHub repositories in workspace
2023-11-17 14:37:53 +01:00
github-actions[bot]
383a1215b4 Bump version to v1.10.1 (#3077) 2023-11-16 18:20:26 +00:00
Shati Patel
0994c3e95f Merge pull request #3076 from github/v1.10.0
v1.10.0
2023-11-16 15:51:25 +00:00
Koen Vlaswinkel
fe0c10aa89 Merge remote-tracking branch 'origin/main' into koesie10/find-github-repository 2023-11-16 16:49:35 +01:00
Koen Vlaswinkel
5db1f76c55 Add tests for more Git state scenarios 2023-11-16 16:49:02 +01:00
Koen Vlaswinkel
779faa324c Improve heuristic and comments 2023-11-16 16:42:09 +01:00
Koen Vlaswinkel
f23bc81712 Add comment about initialize method 2023-11-16 16:37:25 +01:00
Koen Vlaswinkel
704894471b Fix error when Git extension is disabled 2023-11-16 16:37:25 +01:00
Koen Vlaswinkel
a04f70e162 Fix error logging 2023-11-16 16:37:25 +01:00
Koen Vlaswinkel
a150643cdf Change log message when repository is not found 2023-11-16 16:37:24 +01:00
Koen Vlaswinkel
0323325015 Improve comments on findRemote 2023-11-16 13:37:01 +01:00
Koen Vlaswinkel
019195b38c Add finding of GitHub repositories in workspace 2023-11-13 17:04:08 +01:00
781 changed files with 35154 additions and 50260 deletions

View File

@@ -8,8 +8,11 @@ updates:
labels:
- "Update dependencies"
ignore:
- dependency-name: "*"
update-types: ["version-update:semver-minor", "version-update:semver-patch"]
# @types/node is related to the version of VS Code we're supporting and should
# not be updated to a newer version of Node automatically. However, patch versions
# are unrelated to the Node version, so we allow those.
- dependency-name: "@types/node"
update-types: ["version-update:semver-major", "version-update:semver-minor"]
- package-ecosystem: "github-actions"
directory: "/"
schedule:
@@ -17,6 +20,3 @@ updates:
day: "thursday" # Thursday is arbitrary
labels:
- "Update dependencies"
ignore:
- dependency-name: "*"
update-types: ["version-update:semver-minor", "version-update:semver-patch"]

View File

@@ -11,6 +11,7 @@ on:
- extensions/ql-vscode/src/language-support/**
- extensions/ql-vscode/src/query-server/**
- extensions/ql-vscode/supported_cli_versions.json
- extensions/ql-vscode/src/variant-analysis/run-remote-query.ts
jobs:
find-nightly:
@@ -109,3 +110,43 @@ jobs:
if: matrix.os == 'windows-latest'
run: |
npm run test:cli-integration
report-failure:
name: Report failure on the default branch
runs-on: ubuntu-latest
needs: [cli-test]
if: failure() && github.ref == 'refs/heads/main'
permissions:
contents: read
issues: write
env:
GH_TOKEN: ${{ github.token }}
steps:
- name: Create GitHub issue
run: |
# Set -eu so that we fail if the gh command fails.
set -eu
# Try to find an existing open issue if there is one
ISSUE="$(gh issue list --repo "$GITHUB_REPOSITORY" --label "cli-test-failure" --state "open" --limit 1 --json number -q '.[0].number')"
if [[ -n "$ISSUE" ]]; then
echo "Found open issue number $ISSUE ($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/issues/$ISSUE)"
else
echo "Did not find an open tracking issue. Creating one."
ISSUE_BODY="issue-body.md"
printf "CLI tests have failed on the default branch.\n\n@github/code-scanning-secexp-reviewers" > "$ISSUE_BODY"
ISSUE="$(gh issue create --repo "$GITHUB_REPOSITORY" --label "cli-test-failure" --title "CLI test failure" --body-file "$ISSUE_BODY")"
# `gh issue create` returns the full issue URL, not just the number.
echo "Created issue with URL $ISSUE"
fi
COMMENT_FILE="comment.md"
RUN_URL=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID
printf 'CLI test [%s](%s) failed on ref `%s`' "$GITHUB_RUN_ID" "$RUN_URL" "$GITHUB_REF" > "$COMMENT_FILE"
# `gh issue create` returns an issue URL, and `gh issue list | cut -f 1` returns an issue number.
# Both are accepted here.
gh issue comment "$ISSUE" --repo "$GITHUB_REPOSITORY" --body-file "$COMMENT_FILE"

View File

@@ -13,4 +13,4 @@ jobs:
- name: 'Checkout Repository'
uses: actions/checkout@v4
- name: 'Dependency Review'
uses: actions/dependency-review-action@v3
uses: actions/dependency-review-action@v4

46
.github/workflows/e2e-tests.yml vendored Normal file
View File

@@ -0,0 +1,46 @@
name: Run E2E Playwright tests
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
e2e-test:
name: E2E Test
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: extensions/ql-vscode/.nvmrc
cache: 'npm'
cache-dependency-path: extensions/ql-vscode/package-lock.json
- name: Install dependencies
working-directory: extensions/ql-vscode
run: npm ci
- name: Start containers
working-directory: extensions/ql-vscode/test/e2e
run: docker-compose -f "docker-compose.yml" up -d --build
- name: Install Playwright Browsers
working-directory: extensions/ql-vscode
run: npx playwright install --with-deps
- name: Run Playwright tests
working-directory: extensions/ql-vscode/test/e2e
run: npx playwright test
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: extensions/ql-vscode/playwright-report/
retention-days: 30
- name: Stop containers
working-directory: extensions/ql-vscode/test/e2e
if: always()
run: docker-compose -f "docker-compose.yml" down -v

View File

@@ -47,7 +47,7 @@ jobs:
cp dist/*.vsix artifacts
- name: Upload artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: matrix.os == 'ubuntu-latest'
with:
name: vscode-codeql-extension

View File

@@ -54,13 +54,13 @@ jobs:
echo "ref_name=$REF_NAME" >> "$GITHUB_OUTPUT"
- name: Upload artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: vscode-codeql-extension
path: artifacts
- name: Upload source maps
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: vscode-codeql-sourcemaps
path: dist/vscode-codeql/out/*.map
@@ -128,7 +128,7 @@ jobs:
VSCE_TOKEN: ${{ secrets.VSCE_TOKEN }}
steps:
- name: Download artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: vscode-codeql-extension
@@ -145,7 +145,7 @@ jobs:
OPEN_VSX_TOKEN: ${{ secrets.OPEN_VSX_TOKEN }}
steps:
- name: Download artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: vscode-codeql-extension

View File

@@ -0,0 +1,58 @@
name: Update Node version
on:
workflow_dispatch:
schedule:
- cron: '15 12 * * *' # At 12:15 PM UTC every day
permissions:
contents: write
pull-requests: write
jobs:
create-pr:
name: Create PR
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: extensions/ql-vscode/.nvmrc
cache: 'npm'
cache-dependency-path: extensions/ql-vscode/package-lock.json
- name: Install dependencies
working-directory: extensions/ql-vscode
run: |
npm ci
shell: bash
- name: Get current Node version
working-directory: extensions/ql-vscode
id: get-current-node-version
run: |
echo "version=$(cat .nvmrc)" >> $GITHUB_OUTPUT
shell: bash
- name: Update Node version
working-directory: extensions/ql-vscode
run: |
npx ts-node scripts/update-node-version.ts
shell: bash
- name: Get current Node version
working-directory: extensions/ql-vscode
id: get-new-node-version
run: |
echo "version=$(cat .nvmrc)" >> $GITHUB_OUTPUT
shell: bash
- name: Commit, Push and Open a PR
uses: ./.github/actions/create-pr
with:
token: ${{ secrets.GITHUB_TOKEN }}
base-branch: main
head-branch: github-action/bump-node-version
commit-message: Bump Node version to ${{ steps.get-new-node-version.outputs.version }}
title: Bump Node version to ${{ steps.get-new-node-version.outputs.version }}
body: >
The Node version used in the latest version of VS Code has been updated. This PR updates the Node version
used for integration tests to match.
The previous Node version was ${{ steps.get-current-node-version.outputs.version }}. This PR updates the
Node version to ${{ steps.get-new-node-version.outputs.version }}.

4
.gitignore vendored
View File

@@ -19,3 +19,7 @@ artifacts/
# CodeQL metadata
.cache/
.codeql/
# E2E Reports
**/playwright-report/**
**/test-results/**

View File

@@ -1,4 +1,7 @@
{
"ul-style": {
"style": "dash"
},
"MD013": false,
"MD041": false
}

View File

@@ -14,21 +14,21 @@ appearance, race, religion, or sexual identity and orientation.
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
- The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
- Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
@@ -55,7 +55,7 @@ a project may be further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at opensource@github.com. All
reported by contacting the project team at <opensource@github.com>. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.

View File

@@ -22,12 +22,12 @@ Please note that this project is released with a [Contributor Code of Conduct][c
Here are a few things you can do that will increase the likelihood of your pull request being accepted:
* Follow the [style guide][style].
* 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).
* 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](https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
- Follow the [style guide][style].
- 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).
- 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](https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
## Setting up a local build
@@ -99,6 +99,6 @@ More information about Storybook can be found inside the **Overview** page once
## Resources
* [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/)
* [Using Pull Requests](https://help.github.com/articles/about-pull-requests/)
* [GitHub Help](https://help.github.com)
- [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/)
- [Using Pull Requests](https://help.github.com/articles/about-pull-requests/)
- [GitHub Help](https://help.github.com)

View File

@@ -6,28 +6,21 @@ The extension is released. You can download it from the [Visual Studio Marketpla
To see what has changed in the last few versions of the extension, see the [Changelog](https://github.com/github/vscode-codeql/blob/main/extensions/ql-vscode/CHANGELOG.md).
[![CI status badge](https://github.com/github/vscode-codeql/workflows/Build%20Extension/badge.svg)](https://github.com/github/vscode-codeql/actions?query=workflow%3A%22Build+Extension%22+branch%3Amaster)
[![CI status badge](https://github.com/github/vscode-codeql/workflows/Build%20Extension/badge.svg)](https://github.com/github/vscode-codeql/actions?query=workflow%3A%22Build+Extension%22+branch%3Amain)
[![VS Marketplace badge](https://vsmarketplacebadges.dev/version/github.vscode-codeql.svg)](https://marketplace.visualstudio.com/items?itemName=github.vscode-codeql)
## Features
* Enables you to use CodeQL to query databases and discover problems in codebases.
* Shows the flow of data through the results of path queries, which is essential for triaging security results.
* Provides an easy way to run queries from the large, open source repository of [CodeQL security queries](https://github.com/github/codeql).
* Adds IntelliSense to support you writing and editing your own CodeQL query and library files.
* Supports you running CodeQL queries against thousands of repositories on GitHub using multi-repository variant analysis.
- Enables you to use CodeQL to query databases and discover problems in codebases.
- Shows the flow of data through the results of path queries, which is essential for triaging security results.
- Provides an easy way to run queries from the large, open source repository of [CodeQL security queries](https://github.com/github/codeql).
- Adds IntelliSense to support you writing and editing your own CodeQL query and library files.
- Supports you running CodeQL queries against thousands of repositories on GitHub using multi-repository variant analysis.
## Project goals and scope
This project will track new feature development in CodeQL and, whenever appropriate, bring that functionality to the Visual Studio Code experience.
## Dependencies
This extension depends on the following two extensions for required functionality. They will be installed automatically when you install VS Code CodeQL.
* [Test Adapter Converter](https://marketplace.visualstudio.com/items?itemName=ms-vscode.test-adapter-converter)
* [Test Explorer UI](https://marketplace.visualstudio.com/items?itemName=hbenl.vscode-test-explorer)
## Contributing
This project welcomes contributions. See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to build, install, and contribute.

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@@ -7,24 +7,20 @@ We should make sure the CodeQL for VS Code extension works with the Node.js vers
## Checking the version of Node.js supplied by VS Code
You can find this info by seleting "About Visual Studio Code" from the top menu.
You can find this info by selecting "About Visual Studio Code" from the top menu.
![about-vscode](images/about-vscode.png)
## Updating the Node.js version
The following files will need to be updated:
To update the Node.js version, run:
- `extensions/ql-vscode/.nvmrc` - this will enable nvm to automatically switch to the correct Node
version when you're in the project folder. It will also change the Node version the GitHub Actions
workflows use.
- `extensions/ql-vscode/package.json` - the "engines.node: '[VERSION]'" setting
- `extensions/ql-vscode/package.json` - the "@types/node: '[VERSION]'" dependency
Then run `npm install` to update the `extensions/ql-vscode/package-lock.json` file.
```bash
npx ts-node scripts/update-node-version.ts
```
## Node.js version used in tests
Unit tests will use whatever version of Node.js is installed locally. In CI this will be the version specified in the workflow.
Integration tests download a copy of VS Code and then will use whatever version of Node.js is provided by VS Code. Our integration tests are currently pinned to an older version of VS Code. See [VS Code version used in tests](./vscode-version.md#vs-code-version-used-in-tests) for more information.
Integration tests download a copy of VS Code and then will use whatever version of Node.js is provided by VS Code. See [VS Code version used in tests](./vscode-version.md#vs-code-version-used-in-tests) for more information.

View File

@@ -1,33 +1,33 @@
# Releasing (write access required)
1. Determine the new version number. We default to increasing the patch version number, but make our own judgement about whether a change is big enough to warrant a minor version bump. Common reasons for a minor bump could include:
* Making substantial new features available to all users. This can include lifting a feature flag.
* Breakage in compatibility with recent versions of the CLI.
* Minimum required version of VS Code is increased.
* New telemetry events are added.
* Deprecation or removal of commands.
* Accumulation of many changes, none of which are individually big enough to warrant a minor bump, but which together are. This does not include changes which are purely internal to the extension, such as refactoring, or which are only available behind a feature flag.
- Making substantial new features available to all users. This can include lifting a feature flag.
- Breakage in compatibility with recent versions of the CLI.
- Minimum required version of VS Code is increased.
- New telemetry events are added.
- Deprecation or removal of commands.
- Accumulation of many changes, none of which are individually big enough to warrant a minor bump, but which together are. This does not include changes which are purely internal to the extension, such as refactoring, or which are only available behind a feature flag.
1. Create a release branch named after the new version (e.g. `v1.3.6`):
* For a regular scheduled release this branch will be based on latest `main`.
* Make sure your local copy of `main` is up to date so you are including all changes.
* To do a minimal bug-fix release, base the release branch on the tag from the most recent release and then add only the changes you want to release.
* Choose this option if you want to release a specific set of changes (e.g. a bug fix) and don't want to incur extra risk by including other changes that have been merged to the `main` branch.
- For a regular scheduled release this branch will be based on latest `main`.
- Make sure your local copy of `main` is up to date so you are including all changes.
- To do a minimal bug-fix release, base the release branch on the tag from the most recent release and then add only the changes you want to release.
- Choose this option if you want to release a specific set of changes (e.g. a bug fix) and don't want to incur extra risk by including other changes that have been merged to the `main` branch.
```bash
git checkout -b <new_release_branch> <previous_release_tag>
```
1. Run the ["Run CLI tests" workflow](https://github.com/github/vscode-codeql/actions/workflows/cli-test.yml) and make sure the tests are green.
* You can skip this step if you are releasing from `main` and there were no merges since the most recent daily scheduled run of this workflow.
- You can skip this step if you are releasing from `main` and there were no merges since the most recent daily scheduled run of this workflow.
1. Double-check the `CHANGELOG.md` contains all desired change comments and has the version to be released with date at the top.
* Go through PRs that have been merged since the previous release and make sure they are properly accounted for.
* Make sure all changelog entries have links back to their PR(s) if appropriate.
- Go through PRs that have been merged since the previous release and make sure they are properly accounted for.
- Make sure all changelog entries have links back to their PR(s) if appropriate.
1. Double-check that the extension `package.json` and `package-lock.json` have 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.
1. Commit any changes made during steps 4 and 5 with a commit message the same as the branch name (e.g. `v1.3.6`).
1. Open a PR for this release.
* The PR diff should contain:
* Any missing bits from steps 4 and 5. Most of the time, this will just be updating `CHANGELOG.md` with today's date.
* If releasing from a branch other than `main`, this PR will also contain the extension changes being released.
- The PR diff should contain:
- Any missing bits from steps 4 and 5. Most of the time, this will just be updating `CHANGELOG.md` with today's date.
- If releasing from a branch other than `main`, this PR will also contain the extension changes being released.
1. Build the extension using `npm run build` and install it on your VS Code using "Install from VSIX".
1. Go through [our test plan](./test-plan.md) to ensure that the extension is working as expected.
1. Create a new tag on the release branch with your new version (named after the release), e.g.
@@ -37,8 +37,8 @@
```
1. Merge the release PR into `main`.
* If there are conflicts in the changelog, make sure to place any new changelog entries at the top, above the section for the current release, as these new entries are not part of the current release and should be placed in the "unreleased" section.
* The release PR must be merged before pushing the tag to ensure that we always release a commit that is present on the `main` branch. It's not required that the commit is the head of the `main` branch, but there should be no chance of a future release accidentally not including changes from this release.
- If there are conflicts in the changelog, make sure to place any new changelog entries at the top, above the section for the current release, as these new entries are not part of the current release and should be placed in the "unreleased" section.
- The release PR must be merged before pushing the tag to ensure that we always release a commit that is present on the `main` branch. It's not required that the commit is the head of the `main` branch, but there should be no chance of a future release accidentally not including changes from this release.
1. Push the new tag up:
```bash
@@ -46,13 +46,13 @@
```
1. Find the [Release](https://github.com/github/vscode-codeql/actions?query=workflow%3ARelease) workflow run that was just triggered by pushing the tag, and monitor the status of the release build.
* DO NOT approve the "publish" stages of the workflow yet.
- DO NOT approve the "publish" stages of the workflow yet.
1. Download the VSIX from the draft GitHub release at the top of [the releases page](https://github.com/github/vscode-codeql/releases) that is created when the release build finishes.
1. 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.
1. Install the `.vsix` file into your vscode IDE and ensure the extension can load properly. Run a single command (like run query, or add database).
1. Approve the deployments of the [Release](https://github.com/github/vscode-codeql/actions?query=workflow%3ARelease) workflow run. This will automatically publish to Open VSX and VS Code Marketplace.
* If there is an authentication failure when publishing, be sure to check that the authentication keys haven't expired. See below.
- If there is an authentication failure when publishing, be sure to check that the authentication keys haven't expired. See below.
1. Go to the draft GitHub release in [the releases page](https://github.com/github/vscode-codeql/releases), click 'Edit', add some summary description, and publish it.
1. Confirm the new release is marked as the latest release.
1. If documentation changes need to be published, notify documentation team that release has been made.

View File

@@ -57,14 +57,16 @@ choose to go through some of the Optional Test Cases.
2. Select the `google/brotli` database (or download it if you don't have one already)
3. Run a local query.
4. Once the query completes:
- Chose the `#select` result set from the drop-down
- Check that the results table is rendered
- Check that result locations can be clicked on
#### Test case 4: Can use AST viewer
1. Click on any code location from a previous query to open a source file from a database
2. Open the AST viewing panel and click "View AST"
3. Once the AST is computed:
2. Select the highlighted code in the source file
3. Open the AST viewing panel and click "View AST"
4. Once the AST is computed:
- Check that it can be navigated
### MRVA
@@ -143,6 +145,48 @@ Run one of the above MRVAs, but cancel it from within VS Code:
- Check that the workflow run is also canceled.
- Check that any available results are visible in VS Code.
#### Test Case 6: Using model packs in MRVA
1. Create a model pack with mock data
1. Create a new directory `test-model-pack`
2. Create a `qlpack.yml` file in that directory with the following contents:
```yaml
name: github/test-model-pack
version: 0.0.0
library: true
extensionTargets:
codeql/python-all: '*'
dataExtensions:
- extension.yml
```
3. Create an `extension.yml` in the same directory with the following contents:
```yaml
extensions:
- addsTo:
pack: codeql/python-all
extensible: sinkModel
data:
- ["vscode-codeql","Member[initialize].Argument[0]","code-injection"]
```
2. In a Python query pack, create the following query (e.g. `sinks.ql`):
```ql
import python
import semmle.python.frameworks.data.internal.ApiGraphModelsExtensions
from string path, string kind
where sinkModel("vscode-codeql", path, kind)
select path, kind
```
3. Run a MRVA against a Python repository (e.g. `psf/requests`) with this query.
4. Check that the results view contains 1 result with the values corresponding to the `extension.yml` file:
![Model packs results table for `psf/requests`](images/model-pack-results-table.png)
### CodeQL Model Editor
#### Test Case 1: Opening the model editor
@@ -151,7 +195,7 @@ Run one of the above MRVAs, but cancel it from within VS Code:
2. Open the Model Editor with the "CodeQL: Open CodeQL Model Editor" command from the command palette.
- Check that the editor loads and shows methods to model.
- Check that methods are grouped per library (e.g. `rocksdbjni@7.7.3` or `asm@6.0`)
- Check that the "Open source" link works.
- Check that the "Open source" link works (if you have the database source).
- Check that the 'View' button works and the Method Usage panel highlight the correct method and usage
- Check that the Method Modeling panel shows the correct method and modeling state
@@ -170,6 +214,8 @@ Run one of the above MRVAs, but cancel it from within VS Code:
Note that this test requires the feature flag: `codeQL.model.llmGeneration`
A package that the AI normally gives models for is `javax.servlet-api` from the `jhy/jsoup` repository.
1. Click "Model with AI".
- Check that rows change to "Thinking".
- Check that results come back and rows get filled out.
@@ -183,6 +229,24 @@ Note that this test requires the feature flag: `codeQL.model.flowGeneration`
2. Click "Generate".
- Check that rows are filled out.
### GitHub database download
#### Test case 1: Download a database
Open a clone of the [`github/codeql`](https://github.com/github/codeql) repository as a folder.
1. Wait a few seconds until the CodeQL extension is fully initialized.
- Check that the following prompt appears:
![database-download-prompt](images/github-database-download-prompt.png)
- If the prompt does not appear, ensure that the `codeQL.githubDatabase.download` setting is not set in workspace or user settings.
2. Click "Download".
3. Select the "C#" and "JavaScript" databases.
- Check that there are separate notifications for both downloads.
- Check that both databases are added when the downloads are complete.
### General
#### Test case 1: Change to a different colour theme

View File

@@ -2,14 +2,14 @@
We have several types of tests:
* Unit tests: these live in the `tests/unit-tests/` directory
* View tests: these live in `src/view/variant-analysis/__tests__/`
* VSCode integration tests:
* `test/vscode-tests/activated-extension` tests: These are intended to cover functionality that require the full extension to be activated but don't require the CLI. This suite is not run against multiple versions of the CLI in CI.
* `test/vscode-tests/no-workspace` tests: These are intended to cover functionality around not having a workspace. The extension is not activated in these tests.
* `test/vscode-tests/minimal-workspace` tests: These are intended to cover functionality that need a workspace but don't require the full extension to be activated.
* CLI integration tests: these live in `test/vscode-tests/cli-integration`
* These tests are intended to cover functionality that is related to the integration between the CodeQL CLI and the extension. These tests are run against each supported versions of the CLI in CI.
- Unit tests: these live in the `tests/unit-tests/` directory
- View tests: these live in `src/view/variant-analysis/__tests__/`
- VSCode integration tests:
- `test/vscode-tests/activated-extension` tests: These are intended to cover functionality that require the full extension to be activated but don't require the CLI. This suite is not run against multiple versions of the CLI in CI.
- `test/vscode-tests/no-workspace` tests: These are intended to cover functionality around not having a workspace. The extension is not activated in these tests.
- `test/vscode-tests/minimal-workspace` tests: These are intended to cover functionality that need a workspace but don't require the full extension to be activated.
- CLI integration tests: these live in `test/vscode-tests/cli-integration`
- These tests are intended to cover functionality that is related to the integration between the CodeQL CLI and the extension. These tests are run against each supported versions of the CLI in CI.
The CLI integration tests require an instance of the CodeQL CLI to run so they will require some extra setup steps. When adding new tests to our test suite, please be mindful of whether they need to be in the cli-integration folder. If the tests don't depend on the CLI, they are better suited to being a VSCode integration test.
@@ -26,9 +26,9 @@ Pre-requisites:
Then, from the `extensions/ql-vscode` directory, use the appropriate command to run the tests:
* Unit tests: `npm run test:unit`
* View Tests: `npm run test:view`
* VSCode integration tests: `npm run test:vscode-integration`
- Unit tests: `npm run test:unit`
- View Tests: `npm run test:view`
- VSCode integration tests: `npm run test:vscode-integration`
#### Running CLI integration tests from the terminal
@@ -48,9 +48,9 @@ Alternatively, you can run the tests inside of VSCode. There are several VSCode
You will need to run tests using a task from inside of VS Code, under the "Run and Debug" view:
* Unit tests: run the _Launch Unit Tests_ task
* View Tests: run the _Launch Unit Tests - React_ task
* VSCode integration tests: run the _Launch Unit Tests - No Workspace_ and _Launch Unit Tests - Minimal Workspace_ tasks
- Unit tests: run the _Launch Unit Tests_ task
- View Tests: run the _Launch Unit Tests - React_ task
- VSCode integration tests: run the _Launch Unit Tests - No Workspace_ and _Launch Unit Tests - Minimal Workspace_ tasks
#### Running CLI integration tests from VSCode

View File

@@ -24,10 +24,18 @@ Also consider what percentage of our users are using each VS Code version. This
## How to update the VS Code version
To provide a good experience to users, it is recommented to update the `MIN_VERSION` in `extension.ts` first and release, and then update the `vscode` version in `package.json` and release again. By stagging this update across two releases it gives users on older VS Code versions a chance to upgrade before it silently refuses to upgrade them.
To provide a good experience to users, it is recommented to update the `MIN_VERSION` in `extension.ts` first and release, and then update the `vscode` version in `package.json` and release again.
By staggering this update across two releases it gives users on older VS Code versions a chance to upgrade before it silently refuses to upgrade them.
After updating the minimum version in `package.json`, make sure to also run the following command to update any generated
files dependent on this version:
```bash
npm run generate
```
## VS Code version used in tests
Our integration tests are currently pinned to use an older version of VS Code due to <https://github.com/github/vscode-codeql/issues/2402>.
This version is specified in [`jest-runner-vscode.config.base.js`](https://github.com/github/vscode-codeql/blob/d93f2b67c84e79737b0ce4bb74e31558b5f5166e/extensions/ql-vscode/test/vscode-tests/jest-runner-vscode.config.base.js#L17).
Until this is resolved this will limit us updating our minimum supported version of VS Code.
The integration tests use the latest stable version of VS Code. This is specified in
the [`test/vscode-tests/jest-runner-vscode.config.base.js`](https://github.com/github/vscode-codeql/blob/main/extensions/ql-vscode/test/vscode-tests/jest-runner-vscode.config.base.js#L15)
file. This shouldn't need to be updated unless there is a breaking change in VS Code that prevents the tests from running.

View File

@@ -21,16 +21,17 @@ const baseConfig = {
},
extends: [
"eslint:recommended",
"plugin:github/react",
"plugin:github/recommended",
"plugin:github/typescript",
"plugin:jest-dom/recommended",
"plugin:prettier/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:import/recommended",
"plugin:import/typescript",
"plugin:deprecation/recommended",
],
rules: {
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/no-use-before-define": 0,
"@typescript-eslint/no-unused-vars": [
"warn",
{
@@ -39,39 +40,37 @@ const baseConfig = {
ignoreRestSiblings: false,
},
],
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-floating-promises": ["error", { ignoreVoid: true }],
"@typescript-eslint/no-invalid-this": "off",
"@typescript-eslint/no-shadow": "off",
"prefer-const": ["warn", { destructuring: "all" }],
"@typescript-eslint/no-throw-literal": "error",
"no-useless-escape": 0,
camelcase: "off",
"@typescript-eslint/consistent-type-imports": "error",
"import/consistent-type-specifier-style": ["error", "prefer-top-level"],
curly: ["error", "all"],
"escompat/no-regexp-lookbehind": "off",
"etc/no-implicit-any-catch": "error",
"filenames/match-regex": "off",
"filenames/match-regexp": "off",
"func-style": "off",
"i18n-text/no-en": "off",
"import/named": "off",
"import/no-dynamic-require": "off",
"import/no-dynamic-required": "off",
"import/no-anonymous-default-export": "off",
"import/no-commonjs": "off",
"import/no-mutable-exports": "off",
"import/no-namespace": "off",
"import/no-unresolved": "off",
"import/no-webpack-loader-syntax": "off",
"no-invalid-this": "off",
"no-fallthrough": "off",
"no-console": "off",
"no-shadow": "off",
"github/array-foreach": "off",
"github/no-then": "off",
"react/jsx-key": ["error", { checkFragmentShorthand: true }],
"import/no-cycle": "error",
// Never allow extensions in import paths, except for JSON files where they are required.
"import/extensions": ["error", "never", { json: "always" }],
},
settings: {
"import/resolver": {
typescript: true,
node: true,
},
"import/extensions": [".js", ".jsx", ".ts", ".tsx", ".json"],
// vscode and sarif don't exist on-disk, but only provide types.
"import/core-modules": ["vscode", "sarif"],
},
};
@@ -87,8 +86,10 @@ module.exports = {
extends: [
...baseConfig.extends,
"plugin:react/recommended",
"plugin:react/jsx-runtime",
"plugin:react-hooks/recommended",
"plugin:storybook/recommended",
"plugin:github/react",
],
rules: {
...baseConfig.rules,
@@ -107,7 +108,9 @@ module.exports = {
extends: [
...baseConfig.extends,
"plugin:react/recommended",
"plugin:react/jsx-runtime",
"plugin:react-hooks/recommended",
"plugin:github/react",
],
rules: {
...baseConfig.rules,
@@ -118,15 +121,6 @@ module.exports = {
},
},
},
{
files: ["test/**/*"],
parserOptions: {
project: resolve(__dirname, "test/tsconfig.json"),
},
env: {
jest: true,
},
},
{
files: ["test/vscode-tests/**/*"],
parserOptions: {
@@ -137,6 +131,8 @@ module.exports = {
},
rules: {
...baseConfig.rules,
// We want to allow mocking of functions in modules, so we need to allow namespace imports.
"import/no-namespace": "off",
"@typescript-eslint/ban-types": [
"error",
{
@@ -151,6 +147,18 @@ module.exports = {
],
},
},
{
files: ["test/**/*"],
parserOptions: {
project: resolve(__dirname, "test/tsconfig.json"),
},
env: {
jest: true,
},
rules: {
"@typescript-eslint/no-explicit-any": "off",
},
},
{
files: [
".eslintrc.js",
@@ -171,5 +179,17 @@ module.exports = {
"@typescript-eslint/no-var-requires": "off",
},
},
{
files: [".storybook/**/*.tsx"],
parserOptions: {
project: resolve(__dirname, ".storybook/tsconfig.json"),
},
rules: {
...baseConfig.rules,
// Storybook doesn't use the automatic JSX runtime in the addon yet, so we need to allow
// `React` to be imported.
"import/no-namespace": ["error", { ignore: ["react"] }],
},
},
],
};

View File

@@ -1 +1 @@
v18.15.0
v18.17.1

View File

@@ -1,4 +1,4 @@
import { Preview } from "@storybook/react";
import type { Preview } from "@storybook/react";
import { themes } from "@storybook/theming";
import { action } from "@storybook/addon-actions";

View File

@@ -1,5 +1,6 @@
import * as React from "react";
import { FunctionComponent, useCallback } from "react";
import type { FunctionComponent } from "react";
import { useCallback } from "react";
import { useGlobals } from "@storybook/manager-api";
import {

View File

@@ -1,5 +1,6 @@
import * as React from "react";
import { addons, types } from "@storybook/manager-api";
import { addons } from "@storybook/manager-api";
import { Addon_TypesEnum } from "@storybook/types";
import { ThemeSelector } from "./ThemeSelector";
const ADDON_ID = "vscode-theme-addon";
@@ -7,7 +8,7 @@ const ADDON_ID = "vscode-theme-addon";
addons.register(ADDON_ID, () => {
addons.add(ADDON_ID, {
title: "VSCode Themes",
type: types.TOOL,
type: Addon_TypesEnum.TOOL,
match: ({ viewMode }) => !!(viewMode && viewMode.match(/^(story|docs)$/)),
render: () => <ThemeSelector />,
});

View File

@@ -8,27 +8,27 @@ import { VSCodeTheme } from "./theme";
const themeFiles: { [key in VSCodeTheme]: string } = {
[VSCodeTheme.Dark]:
// eslint-disable-next-line @typescript-eslint/no-var-requires
// eslint-disable-next-line @typescript-eslint/no-var-requires,import/no-commonjs,import/no-webpack-loader-syntax
require("!file-loader?modules!../../src/stories/vscode-theme-dark.css")
.default,
[VSCodeTheme.Light]:
// eslint-disable-next-line @typescript-eslint/no-var-requires
// eslint-disable-next-line @typescript-eslint/no-var-requires,import/no-commonjs,import/no-webpack-loader-syntax
require("!file-loader?modules!../../src/stories/vscode-theme-light.css")
.default,
[VSCodeTheme.LightHighContrast]:
// eslint-disable-next-line @typescript-eslint/no-var-requires
// eslint-disable-next-line @typescript-eslint/no-var-requires,import/no-commonjs,import/no-webpack-loader-syntax
require("!file-loader?modules!../../src/stories/vscode-theme-light-high-contrast.css")
.default,
[VSCodeTheme.DarkHighContrast]:
// eslint-disable-next-line @typescript-eslint/no-var-requires
// eslint-disable-next-line @typescript-eslint/no-var-requires,import/no-commonjs,import/no-webpack-loader-syntax
require("!file-loader?modules!../../src/stories/vscode-theme-dark-high-contrast.css")
.default,
[VSCodeTheme.GitHubLightDefault]:
// eslint-disable-next-line @typescript-eslint/no-var-requires
// eslint-disable-next-line @typescript-eslint/no-var-requires,import/no-commonjs,import/no-webpack-loader-syntax
require("!file-loader?modules!../../src/stories/vscode-theme-github-light-default.css")
.default,
[VSCodeTheme.GitHubDarkDefault]:
// eslint-disable-next-line @typescript-eslint/no-var-requires
// eslint-disable-next-line @typescript-eslint/no-var-requires,import/no-commonjs,import/no-webpack-loader-syntax
require("!file-loader?modules!../../src/stories/vscode-theme-github-dark-default.css")
.default,
};

View File

@@ -1,11 +1,52 @@
# CodeQL for Visual Studio Code: Changelog
## 1.12.3 - 29 February 2024
- Update variant analysis view to show when cancelation is in progress. [#3405](https://github.com/github/vscode-codeql/pull/3405)
- Remove support for CodeQL CLI versions older than 2.13.5. [#3371](https://github.com/github/vscode-codeql/pull/3371)
- Add a timeout to downloading databases and the CodeQL CLI. These can be changed using the `codeQL.addingDatabases.downloadTimeout` and `codeQL.cli.downloadTimeout` settings respectively. [#3373](https://github.com/github/vscode-codeql/pull/3373)
## 1.12.2 - 14 February 2024
- Stop allowing running variant analyses with a query outside of the workspace. [#3302](https://github.com/github/vscode-codeql/pull/3302)
## 1.12.1 - 31 January 2024
- Enable collection of telemetry for the `codeQL.addingDatabases.addDatabaseSourceToWorkspace` setting. [#3238](https://github.com/github/vscode-codeql/pull/3238)
- In the CodeQL model editor, you can now select individual method rows and save changes to only the selected rows, instead of having to save the entire library model. [#3156](https://github.com/github/vscode-codeql/pull/3156)
- If you run a query without having selected a database, we show a more intuitive prompt to help you select a database. [#3214](https://github.com/github/vscode-codeql/pull/3214)
- Error messages returned from the CodeQL CLI are now less verbose and more user-friendly. [#3259](https://github.com/github/vscode-codeql/pull/3259)
- The UI for browsing and running CodeQL tests has moved to use VS Code's built-in test UI. This makes the CodeQL test UI more consistent with the test UIs for other languages.
This change means that this extension no longer depends on the "Test Explorer UI" and "Test Adapter Converter" extensions. You can uninstall those two extensions if they are
not being used by any other extensions you may have installed. [#3232](https://github.com/github/vscode-codeql/pull/3232)
## 1.12.0 - 11 January 2024
- Add a prompt for downloading a GitHub database when opening a GitHub repository. [#3138](https://github.com/github/vscode-codeql/pull/3138)
- Avoid showing a popup when hovering over source elements in database source files. [#3125](https://github.com/github/vscode-codeql/pull/3125)
- Add comparison of alerts when comparing query results. This allows viewing path explanations for differences in alerts. [#3113](https://github.com/github/vscode-codeql/pull/3113)
- Fix a bug where the CodeQL CLI and variant analysis results were corrupted after extraction in VS Code Insiders. [#3151](https://github.com/github/vscode-codeql/pull/3151) & [#3152](https://github.com/github/vscode-codeql/pull/3152)
- Show progress when extracting the CodeQL CLI distribution during installation. [#3157](https://github.com/github/vscode-codeql/pull/3157)
- Add option to cancel opening the model editor. [#3189](https://github.com/github/vscode-codeql/pull/3189)
## 1.11.0 - 13 December 2023
- Add a new method modeling panel to classify methods as sources/sinks/summaries while in the context of the source code. [#3128](https://github.com/github/vscode-codeql/pull/3128)
- Adds the ability to add multiple classifications per method in the CodeQL Model Editor. [#3128](https://github.com/github/vscode-codeql/pull/3128)
- Switch add and delete button positions in the CodeQL Model Editor. [#3123](https://github.com/github/vscode-codeql/pull/3123)
- Add a prompt to the "Quick query" command to encourage users in single-folder workspaces to use "Create query" instead. [#3082](https://github.com/github/vscode-codeql/pull/3082)
- Remove support for CodeQL CLI versions older than 2.11.6. [#3087](https://github.com/github/vscode-codeql/pull/3087)
- Preserve focus on results viewer when showing a location in a file. [#3088](https://github.com/github/vscode-codeql/pull/3088)
- The `dataflowtracking` and `tainttracking` snippets expand to the new module-based interface. [#3091](https://github.com/github/vscode-codeql/pull/3091)
- The compare view will now show a loading message while the results are loading. [#3107](https://github.com/github/vscode-codeql/pull/3107)
- Make top-banner of the model editor sticky [#3120](https://github.com/github/vscode-codeql/pull/3120)
## 1.10.0 - 16 November 2023
- Add new CodeQL views for managing databases and queries:
1. A queries panel that shows all queries in your workspace. It allows you to view, create, and run queries in one place.
2. A language selector, which allows you to quickly filter databases and queries by language.
For more information, see the [documentation](https://codeql.github.com/docs/codeql-for-visual-studio-code/analyzing-your-projects/#filtering-databases-and-queries-by-language).
- When adding a CodeQL database, we no longer add the database source folder to the workspace by default (since this caused bugs in single-folder workspaces). [#3047](https://github.com/github/vscode-codeql/pull/3047)
- You can manually add individual database source folders to the workspace with the "Add Database Source to Workspace" right-click command in the databases view.
@@ -47,7 +88,7 @@ No user facing changes.
## 1.9.0 - 19 September 2023
- Release the [CodeQL model editor](https://codeql.github.com/docs/codeql/codeql-for-visual-studio-code/using-the-codeql-model-editor) to create CodeQL model packs for Java frameworks. Open the editor using the "CodeQL: Open CodeQL Model Editor (Beta)" command. [#2823](https://github.com/github/vscode-codeql/pull/2823)
- Release the [CodeQL model editor](https://codeql.github.com/docs/codeql-for-visual-studio-code/using-the-codeql-model-editor/) to create CodeQL model packs for Java frameworks. Open the editor using the "CodeQL: Open CodeQL Model Editor (Beta)" command. [#2823](https://github.com/github/vscode-codeql/pull/2823)
## 1.8.12 - 11 September 2023

View File

@@ -17,8 +17,6 @@ For information about other configurations, see the separate [CodeQL help](https
### Quick start: Installing and configuring the extension
1. [Install the extension](#installing-the-extension).
*Note: vscode-codeql installs the following dependencies for required functionality: [Test Adapter Converter](https://marketplace.visualstudio.com/items?itemName=ms-vscode.test-adapter-converter), [Test Explorer UI](https://marketplace.visualstudio.com/items?itemName=hbenl.vscode-test-explorer).*
1. [Check access to the CodeQL CLI](#checking-access-to-the-codeql-cli).
1. [Clone the CodeQL starter workspace](#cloning-the-codeql-starter-workspace).

View File

@@ -1,5 +1,5 @@
import { src, dest } from "gulp";
// eslint-disable-next-line @typescript-eslint/no-var-requires
// eslint-disable-next-line @typescript-eslint/no-var-requires,import/no-commonjs
const replace = require("gulp-replace");
/** Inject the application insights key into the telemetry file */

View File

@@ -0,0 +1,4 @@
{
"chromiumVersion": "114",
"electronVersion": "25.8.0"
}

View File

@@ -9,7 +9,7 @@ import {
} from "fs-extra";
import { resolve, join } from "path";
import { isDevBuild } from "./dev";
import type * as packageJsonType from "../package.json";
import type packageJsonType from "../package.json";
export interface DeployedPackage {
distPath: string;

View File

@@ -8,9 +8,14 @@ import {
copyWasmFiles,
} from "./typescript";
import { compileTextMateGrammar } from "./textmate";
import { compileView, watchView } from "./webpack";
import { packageExtension } from "./package";
import { injectAppInsightsKey } from "./appInsights";
import {
checkViewTypeScript,
compileViewEsbuild,
watchViewCheckTypeScript,
watchViewEsbuild,
} from "./view";
export const buildWithoutPackage = series(
cleanOutput,
@@ -19,23 +24,33 @@ export const buildWithoutPackage = series(
copyWasmFiles,
checkTypeScript,
compileTextMateGrammar,
compileView,
compileViewEsbuild,
checkViewTypeScript,
),
);
export const watch = parallel(watchEsbuild, watchCheckTypeScript, watchView);
export const watch = parallel(
// Always build first, so that we don't have to run build manually
compileEsbuild,
compileViewEsbuild,
watchEsbuild,
watchCheckTypeScript,
watchViewEsbuild,
watchViewCheckTypeScript,
);
export {
cleanOutput,
compileTextMateGrammar,
watchEsbuild,
watchCheckTypeScript,
watchView,
watchViewEsbuild,
compileEsbuild,
copyWasmFiles,
checkTypeScript,
injectAppInsightsKey,
compileView,
compileViewEsbuild,
checkViewTypeScript,
};
export default series(
buildWithoutPackage,

View File

@@ -0,0 +1,91 @@
/**
* A subset of the standard TextMate grammar that is used by our transformation
* step. For a full JSON schema, see:
* https://github.com/martinring/tmlanguage/blob/478ad124a21933cd4b0b65f1ee7ee18ee1f87473/tmlanguage.json
*/
export interface TextmateGrammar {
patterns: Pattern[];
repository?: Record<string, Pattern>;
}
/**
* The extended TextMate grammar as used by our transformation step. This is a superset of the
* standard TextMate grammar, and includes additional fields that are used by our transformation
* step.
*
* Any comment of the form `(?#ref-id)` in a `match`, `begin`, or `end` property will be replaced
* with the match text of the rule named "ref-id". If the rule named "ref-id" consists of just a
* `patterns` property with a list of `include` directives, the replacement pattern is the
* disjunction of the match patterns of all of the included rules.
*/
export interface ExtendedTextmateGrammar<MatchType = string> {
/**
* This represents the set of regular expression options to apply to all regular
* expressions throughout the file.
*/
regexOptions?: string;
/**
* This element defines a map of macro names to replacement text. When a `match`, `begin`, or
* `end` property has a value that is a single-key map, the value is replaced with the value of the
* macro named by the key, with any use of `(?#)` in the macro text replaced with the text of the
* value of the key, surrounded by a non-capturing group (`(?:)`). For example:
*
* The `beginPattern` and `endPattern` Properties
* A rule can have a `beginPattern` or `endPattern` property whose value is a reference to another
* rule (e.g. `#other-rule`). The `beginPattern` property is replaced as follows:
*
* my-rule:
* beginPattern: '#other-rule'
*
* would be transformed to
*
* my-rule:
* begin: '(?#other-rule)'
* beginCaptures:
* '0':
* patterns:
* - include: '#other-rule'
*
* An `endPattern` property is transformed similary.
*
* macros:
* repeat: '(?#)*'
* repository:
* multi-letter:
* match:
* repeat: '[A-Za-z]'
* name: scope.multi-letter
*
* would be transformed to
*
* repository:
* multi-letter:
* match: '(?:[A-Za-z])*'
* name: scope.multi-letter
*/
macros?: Record<string, string>;
patterns: Array<Pattern<MatchType>>;
repository?: Record<string, Pattern<MatchType>>;
}
export interface Pattern<MatchType = string> {
include?: string;
match?: MatchType;
begin?: MatchType;
end?: MatchType;
while?: MatchType;
captures?: Record<string, PatternCapture>;
beginCaptures?: Record<string, PatternCapture>;
endCaptures?: Record<string, PatternCapture>;
patterns?: Array<Pattern<MatchType>>;
beginPattern?: string;
endPattern?: string;
}
export interface PatternCapture {
name?: string;
patterns?: Pattern[];
}
export type ExtendedMatchType = string | Record<string, string>;

View File

@@ -2,7 +2,13 @@ import { dest, src } from "gulp";
import { load } from "js-yaml";
import { obj } from "through2";
import PluginError from "plugin-error";
import * as Vinyl from "vinyl";
import type Vinyl from "vinyl";
import type {
ExtendedMatchType,
ExtendedTextmateGrammar,
Pattern,
TextmateGrammar,
} from "./textmate-grammar";
/**
* Replaces all rule references with the match pattern of the referenced rule.
@@ -34,7 +40,9 @@ function replaceReferencesWithStrings(
* @param yaml The root of the YAML document.
* @returns A map from macro name to replacement text.
*/
function gatherMacros(yaml: any): Map<string, string> {
function gatherMacros<T>(
yaml: ExtendedTextmateGrammar<T>,
): Map<string, string> {
const macros = new Map<string, string>();
for (const key in yaml.macros) {
macros.set(key, yaml.macros[key]);
@@ -51,7 +59,7 @@ function gatherMacros(yaml: any): Map<string, string> {
* @returns The match text for the rule. This is either the value of the rule's `match` property,
* or the disjunction of the match text of all of the other rules `include`d by this rule.
*/
function getNodeMatchText(rule: any): string {
function getNodeMatchText(rule: Pattern): string {
if (rule.match !== undefined) {
// For a match string, just use that string as the replacement.
return rule.match;
@@ -78,7 +86,7 @@ function getNodeMatchText(rule: any): string {
* @returns A map whose keys are the names of rules, and whose values are the corresponding match
* text of each rule.
*/
function gatherMatchTextForRules(yaml: any): Map<string, string> {
function gatherMatchTextForRules(yaml: TextmateGrammar): Map<string, string> {
const replacements = new Map<string, string>();
for (const key in yaml.repository) {
const node = yaml.repository[key];
@@ -94,9 +102,14 @@ function gatherMatchTextForRules(yaml: any): Map<string, string> {
* @param yaml The root of the YAML document.
* @param action Callback to invoke on each rule.
*/
function visitAllRulesInFile(yaml: any, action: (rule: any) => void) {
function visitAllRulesInFile<T>(
yaml: ExtendedTextmateGrammar<T>,
action: (rule: Pattern<T>) => void,
) {
visitAllRulesInRuleMap(yaml.patterns, action);
visitAllRulesInRuleMap(yaml.repository, action);
if (yaml.repository) {
visitAllRulesInRuleMap(Object.values(yaml.repository), action);
}
}
/**
@@ -107,9 +120,11 @@ function visitAllRulesInFile(yaml: any, action: (rule: any) => void) {
* @param ruleMap The map or array of rules to visit.
* @param action Callback to invoke on each rule.
*/
function visitAllRulesInRuleMap(ruleMap: any, action: (rule: any) => void) {
for (const key in ruleMap) {
const rule = ruleMap[key];
function visitAllRulesInRuleMap<T>(
ruleMap: Array<Pattern<T>>,
action: (rule: Pattern<T>) => void,
) {
for (const rule of ruleMap) {
if (typeof rule === "object") {
action(rule);
if (rule.patterns !== undefined) {
@@ -125,16 +140,22 @@ function visitAllRulesInRuleMap(ruleMap: any, action: (rule: any) => void) {
* @param rule The rule whose matches are to be transformed.
* @param action The transformation to make on each match pattern.
*/
function visitAllMatchesInRule(rule: any, action: (match: any) => any) {
function visitAllMatchesInRule<T>(rule: Pattern<T>, action: (match: T) => T) {
for (const key in rule) {
switch (key) {
case "begin":
case "end":
case "match":
case "while":
rule[key] = action(rule[key]);
break;
case "while": {
const ruleElement = rule[key];
if (!ruleElement) {
continue;
}
rule[key] = action(ruleElement);
break;
}
default:
break;
}
@@ -148,14 +169,17 @@ function visitAllMatchesInRule(rule: any, action: (match: any) => any) {
* @param rule Rule to be transformed.
* @param key Base key of the property to be transformed.
*/
function expandPatternMatchProperties(rule: any, key: "begin" | "end") {
const patternKey = `${key}Pattern`;
const capturesKey = `${key}Captures`;
function expandPatternMatchProperties<T>(
rule: Pattern<T>,
key: "begin" | "end",
) {
const patternKey = `${key}Pattern` as const;
const capturesKey = `${key}Captures` as const;
const pattern = rule[patternKey];
if (pattern !== undefined) {
const patterns: string[] = Array.isArray(pattern) ? pattern : [pattern];
rule[key] = patterns.map((p) => `((?${p}))`).join("|");
const captures: { [index: string]: any } = {};
rule[key] = patterns.map((p) => `((?${p}))`).join("|") as T;
const captures: Pattern["captures"] = {};
for (const patternIndex in patterns) {
captures[(Number(patternIndex) + 1).toString()] = {
patterns: [
@@ -175,7 +199,7 @@ function expandPatternMatchProperties(rule: any, key: "begin" | "end") {
*
* @param yaml The root of the YAML document.
*/
function transformFile(yaml: any) {
function transformFile(yaml: ExtendedTextmateGrammar<ExtendedMatchType>) {
const macros = gatherMacros(yaml);
visitAllRulesInFile(yaml, (rule) => {
expandPatternMatchProperties(rule, "begin");
@@ -198,24 +222,29 @@ function transformFile(yaml: any) {
yaml.macros = undefined;
const replacements = gatherMatchTextForRules(yaml);
// We have removed all object match properties, so we don't have an extended match type anymore.
const macrolessYaml = yaml as ExtendedTextmateGrammar;
const replacements = gatherMatchTextForRules(macrolessYaml);
// Expand references in matches.
visitAllRulesInFile(yaml, (rule) => {
visitAllRulesInFile(macrolessYaml, (rule) => {
visitAllMatchesInRule(rule, (match) => {
return replaceReferencesWithStrings(match, replacements);
});
});
if (yaml.regexOptions !== undefined) {
const regexOptions = `(?${yaml.regexOptions})`;
visitAllRulesInFile(yaml, (rule) => {
if (macrolessYaml.regexOptions !== undefined) {
const regexOptions = `(?${macrolessYaml.regexOptions})`;
visitAllRulesInFile(macrolessYaml, (rule) => {
visitAllMatchesInRule(rule, (match) => {
return regexOptions + match;
});
});
yaml.regexOptions = undefined;
macrolessYaml.regexOptions = undefined;
}
return macrolessYaml;
}
export function transpileTextMateGrammar() {
@@ -230,8 +259,8 @@ export function transpileTextMateGrammar() {
} else if (file.isBuffer()) {
const buf: Buffer = file.contents;
const yamlText: string = buf.toString("utf8");
const jsonData: any = load(yamlText);
transformFile(jsonData);
const yamlData = load(yamlText) as TextmateGrammar;
const jsonData = transformFile(yamlData);
file.contents = Buffer.from(JSON.stringify(jsonData, null, 2), "utf8");
file.extname = ".json";

View File

@@ -1,10 +1,11 @@
import { gray, red } from "ansi-colors";
import { dest, src, watch } from "gulp";
import esbuild from "gulp-esbuild";
import ts from "gulp-typescript";
import type { reporter } from "gulp-typescript";
import { createProject } from "gulp-typescript";
import del from "del";
function goodReporter(): ts.reporter.Reporter {
export function goodReporter(): reporter.Reporter {
return {
error: (error, typescript) => {
if (error.tsFile) {
@@ -27,7 +28,7 @@ function goodReporter(): ts.reporter.Reporter {
};
}
const tsProject = ts.createProject("tsconfig.json");
const tsProject = createProject("tsconfig.json");
export function cleanOutput() {
return tsProject.projectDirectory
@@ -56,7 +57,7 @@ export function compileEsbuild() {
}
export function watchEsbuild() {
watch("src/**/*.ts", compileEsbuild);
watch(["src/**/*.ts", "!src/view/**/*.ts"], compileEsbuild);
}
export function checkTypeScript() {
@@ -66,7 +67,7 @@ export function checkTypeScript() {
}
export function watchCheckTypeScript() {
watch("src/**/*.ts", checkTypeScript);
watch(["src/**/*.ts", "!src/view/**/*.ts"], checkTypeScript);
}
export function copyWasmFiles() {

View File

@@ -0,0 +1,42 @@
import { dest, src, watch } from "gulp";
import esbuild from "gulp-esbuild";
import { createProject } from "gulp-typescript";
import { goodReporter } from "./typescript";
import chromiumVersion from "./chromium-version.json";
const tsProject = createProject("src/view/tsconfig.json");
export function compileViewEsbuild() {
return src("./src/view/webview.tsx")
.pipe(
esbuild({
outfile: "webview.js",
bundle: true,
format: "iife",
platform: "browser",
target: `chrome${chromiumVersion.chromiumVersion}`,
jsx: "automatic",
sourcemap: "linked",
sourceRoot: "..",
loader: {
".ttf": "file",
},
}),
)
.pipe(dest("out"));
}
export function watchViewEsbuild() {
watch(["src/**/*.{ts,tsx}"], compileViewEsbuild);
}
export function checkViewTypeScript() {
// This doesn't actually output the TypeScript files, it just
// runs the TypeScript compiler and reports any errors.
return tsProject.src().pipe(tsProject(goodReporter()));
}
export function watchViewCheckTypeScript() {
watch(["src/**/*.{ts,tsx}"], checkViewTypeScript);
}

View File

@@ -1,73 +0,0 @@
import { resolve } from "path";
import * as webpack from "webpack";
import MiniCssExtractPlugin from "mini-css-extract-plugin";
import { isDevBuild } from "./dev";
export const config: webpack.Configuration = {
mode: isDevBuild ? "development" : "production",
entry: {
webview: "./src/view/webview.tsx",
},
output: {
path: resolve(__dirname, "..", "out"),
filename: "[name].js",
},
devtool: isDevBuild ? "inline-source-map" : "source-map",
resolve: {
extensions: [".js", ".ts", ".tsx", ".json"],
},
module: {
rules: [
{
test: /\.(ts|tsx)$/,
loader: "ts-loader",
options: {
configFile: "src/view/tsconfig.json",
},
},
{
test: /\.less$/,
use: [
MiniCssExtractPlugin.loader,
{
loader: "css-loader",
options: {
importLoaders: 1,
sourceMap: true,
},
},
{
loader: "less-loader",
options: {
javascriptEnabled: true,
sourceMap: true,
},
},
],
},
{
test: /\.css$/,
use: [
MiniCssExtractPlugin.loader,
{
loader: "css-loader",
options: {
sourceMap: true,
},
},
],
},
{
test: /\.(woff(2)?|ttf|eot)$/,
type: "asset/resource",
generator: {
filename: "fonts/[hash][ext][query]",
},
},
],
},
performance: {
hints: false,
},
plugins: [new MiniCssExtractPlugin()],
};

View File

@@ -1,57 +0,0 @@
import webpack from "webpack";
import { config } from "./webpack.config";
export function compileView(cb: (err?: Error) => void) {
doWebpack(config, true, cb);
}
export function watchView(cb: (err?: Error) => void) {
const watchConfig = {
...config,
watch: true,
watchOptions: {
aggregateTimeout: 200,
poll: 1000,
},
};
doWebpack(watchConfig, false, cb);
}
function doWebpack(
internalConfig: webpack.Configuration,
failOnError: boolean,
cb: (err?: Error) => void,
) {
const resultCb = (error: Error | undefined, stats?: webpack.Stats) => {
if (error) {
cb(error);
}
if (stats) {
console.log(
stats.toString({
errorDetails: true,
colors: true,
assets: false,
builtAt: false,
version: false,
hash: false,
entrypoints: false,
timings: false,
modules: false,
errors: true,
}),
);
if (stats.hasErrors()) {
if (failOnError) {
cb(new Error("Compilation errors detected."));
return;
} else {
console.error("Compilation errors detected.");
}
}
cb();
}
};
webpack(internalConfig, resultCb);
}

View File

@@ -4,6 +4,7 @@
*/
/** @type {import('@jest/types').Config.InitialOptions} */
// eslint-disable-next-line import/no-commonjs
module.exports = {
projects: [
"<rootDir>/src/view",

File diff suppressed because it is too large Load Diff

View File

@@ -4,7 +4,7 @@
"description": "CodeQL for Visual Studio Code",
"author": "GitHub",
"private": true,
"version": "1.10.0",
"version": "1.12.3",
"publisher": "GitHub",
"license": "MIT",
"icon": "media/VS-marketplace-CodeQL-icon.png",
@@ -14,14 +14,14 @@
},
"engines": {
"vscode": "^1.82.0",
"node": "^18.15.0",
"node": "^18.17.1",
"npm": ">=7.20.6"
},
"categories": [
"Programming Languages"
],
"extensionDependencies": [
"hbenl.vscode-test-explorer"
"vscode.git"
],
"capabilities": {
"untrustedWorkspaces": {
@@ -38,7 +38,8 @@
"onWebviewPanel:resultsView",
"onWebviewPanel:codeQL.variantAnalysis",
"onWebviewPanel:codeQL.dataFlowPaths",
"onFileSystem:codeql-zip-archive"
"onFileSystem:codeql-zip-archive",
"workspaceContains:.git"
],
"main": "./out/extension",
"files": [
@@ -177,6 +178,11 @@
"type": "string",
"default": "",
"markdownDescription": "Path to the CodeQL executable that should be used by the CodeQL extension. The executable is named `codeql` on Linux/Mac and `codeql.exe` on Windows. If empty, the extension will look for a CodeQL executable on your shell PATH, or if CodeQL is not on your PATH, download and manage its own CodeQL executable (note: if you later introduce CodeQL on your PATH, the extension will prefer a CodeQL executable it has downloaded itself)."
},
"codeQL.cli.downloadTimeout": {
"type": "integer",
"default": 10,
"description": "Download timeout in seconds for downloading the CLI distribution."
}
}
},
@@ -375,6 +381,11 @@
"title": "Adding databases",
"order": 6,
"properties": {
"codeQL.addingDatabases.downloadTimeout": {
"type": "integer",
"default": 10,
"description": "Download timeout in seconds for adding a CodeQL database."
},
"codeQL.addingDatabases.allowHttp": {
"type": "boolean",
"default": false,
@@ -419,8 +430,41 @@
},
{
"type": "object",
"title": "Log insights",
"title": "GitHub Databases",
"order": 8,
"properties": {
"codeQL.githubDatabase.download": {
"type": "string",
"default": "ask",
"enum": [
"ask",
"never"
],
"enumDescriptions": [
"Ask to download a GitHub database when a workspace is opened.",
"Never download a GitHub databases when a workspace is opened."
],
"description": "Ask to download a GitHub database when a workspace is opened."
},
"codeQL.githubDatabase.update": {
"type": "string",
"default": "ask",
"enum": [
"ask",
"never"
],
"enumDescriptions": [
"Ask to download an updated GitHub database when a new version is available.",
"Never download an updated GitHub database when a new version is available."
],
"description": "Ask to download an updated GitHub database when a new version is available."
}
}
},
{
"type": "object",
"title": "Log insights",
"order": 9,
"properties": {
"codeQL.logInsights.joinOrderWarningThreshold": {
"type": "number",
@@ -434,7 +478,7 @@
{
"type": "object",
"title": "Telemetry",
"order": 9,
"order": 10,
"properties": {
"codeQL.telemetry.enableTelemetry": {
"type": "boolean",
@@ -511,6 +555,14 @@
"command": "codeQL.runVariantAnalysisContextEditor",
"title": "CodeQL: Run Variant Analysis"
},
{
"command": "codeQL.runVariantAnalysisContextExplorer",
"title": "CodeQL: Run Variant Analysis"
},
{
"command": "codeQL.runVariantAnalysisPublishedPack",
"title": "CodeQL: Run Variant Analysis against published pack"
},
{
"command": "codeQL.exportSelectedVariantAnalysisResults",
"title": "CodeQL: Export Variant Analysis Results"
@@ -1287,6 +1339,11 @@
"group": "9_qlCommands",
"when": "resourceScheme != codeql-zip-archive"
},
{
"command": "codeQL.runVariantAnalysisContextExplorer",
"group": "9_qlCommands",
"when": "resourceExtname == .ql && config.codeQL.canary && config.codeQL.variantAnalysis.multiQuery"
},
{
"command": "codeQL.openReferencedFileContextExplorer",
"group": "9_qlCommands",
@@ -1363,6 +1420,14 @@
"command": "codeQL.runVariantAnalysis",
"when": "editorLangId == ql && resourceExtname == .ql"
},
{
"command": "codeQL.runVariantAnalysisContextExplorer",
"when": "false"
},
{
"command": "codeQL.runVariantAnalysisPublishedPack",
"when": "config.codeQL.canary && config.codeQL.variantAnalysis.multiQuery"
},
{
"command": "codeQL.runVariantAnalysisContextEditor",
"when": "false"
@@ -1377,7 +1442,7 @@
},
{
"command": "codeQL.quickEvalCount",
"when": "editorLangId == ql && codeql.supportsQuickEvalCount"
"when": "editorLangId == ql"
},
{
"command": "codeQL.quickEvalContextEditor",
@@ -1800,15 +1865,14 @@
{
"id": "codeQLMethodModeling",
"type": "webview",
"name": "CodeQL Method Modeling",
"when": "config.codeQL.canary"
"name": "CodeQL Method Modeling"
}
],
"codeql-methods-usage": [
{
"id": "codeQLMethodsUsage",
"name": "CodeQL Methods Usage",
"when": "config.codeQL.canary && codeql.modelEditorOpen"
"when": "codeql.modelEditorOpen"
}
]
},
@@ -1868,74 +1932,72 @@
"lint:scenarios": "ts-node scripts/lint-scenarios.ts",
"generate": "npm-run-all -p generate:*",
"generate:schemas": "ts-node scripts/generate-schemas.ts",
"generate:chromium-version": "ts-node scripts/generate-chromium-version.ts",
"check-types": "find . -type f -name \"tsconfig.json\" -not -path \"./node_modules/*\" | sed -r 's|/[^/]+$||' | sort | uniq | xargs -I {} sh -c \"echo Checking types in {} && cd {} && npx tsc --noEmit\"",
"postinstall": "patch-package",
"prepare": "cd ../.. && husky install"
},
"dependencies": {
"@floating-ui/react": "^0.26.9",
"@octokit/plugin-retry": "^6.0.1",
"@octokit/rest": "^20.0.2",
"@vscode/codicons": "^0.0.31",
"@vscode/codicons": "^0.0.35",
"@vscode/debugadapter": "^1.59.0",
"@vscode/debugprotocol": "^1.59.0",
"@vscode/webview-ui-toolkit": "^1.0.1",
"ajv": "^8.11.0",
"child-process-promise": "^2.2.1",
"chokidar": "^3.5.3",
"classnames": "^2.2.6",
"chokidar": "^3.6.0",
"d3": "^7.6.1",
"d3-graphviz": "^5.0.2",
"fs-extra": "^11.1.1",
"immutable": "^4.0.0",
"js-yaml": "^4.1.0",
"msw": "^2.0.0",
"msw": "^2.0.13",
"nanoid": "^5.0.1",
"node-fetch": "^2.6.7",
"p-queue": "^7.4.1",
"p-queue": "^8.0.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"semver": "^7.5.2",
"semver": "^7.6.0",
"source-map": "^0.7.4",
"source-map-support": "^0.5.21",
"stream-json": "^1.7.3",
"styled-components": "^6.0.2",
"tmp": "^0.1.0",
"styled-components": "^6.1.8",
"tmp": "^0.2.1",
"tmp-promise": "^3.0.2",
"tree-kill": "^1.2.2",
"unzipper": "^0.10.5",
"vscode-extension-telemetry": "^0.1.6",
"vscode-jsonrpc": "^8.0.2",
"vscode-languageclient": "^8.0.2",
"vscode-test-adapter-api": "^1.7.0",
"vscode-test-adapter-util": "^0.7.0",
"zip-a-folder": "^3.1.3"
"yauzl": "^2.10.0",
"zip-a-folder": "^3.1.6"
},
"devDependencies": {
"@babel/core": "^7.18.13",
"@babel/plugin-transform-modules-commonjs": "^7.18.6",
"@babel/preset-env": "^7.21.4",
"@babel/preset-env": "^7.23.9",
"@babel/preset-react": "^7.18.6",
"@babel/preset-typescript": "^7.21.4",
"@faker-js/faker": "^8.0.2",
"@github/markdownlint-github": "^0.3.0",
"@faker-js/faker": "^8.4.1",
"@github/markdownlint-github": "^0.6.0",
"@octokit/plugin-throttling": "^8.0.0",
"@storybook/addon-a11y": "^7.4.6",
"@playwright/test": "^1.40.1",
"@storybook/addon-a11y": "^7.6.15",
"@storybook/addon-actions": "^7.1.0",
"@storybook/addon-essentials": "^7.1.0",
"@storybook/addon-interactions": "^7.1.0",
"@storybook/addon-links": "^7.1.0",
"@storybook/components": "^7.1.0",
"@storybook/components": "^7.6.17",
"@storybook/csf": "^0.1.1",
"@storybook/manager-api": "^7.1.0",
"@storybook/manager-api": "^7.6.7",
"@storybook/react": "^7.1.0",
"@storybook/react-webpack5": "^7.1.0",
"@storybook/theming": "^7.1.0",
"@testing-library/dom": "^9.3.0",
"@testing-library/jest-dom": "^6.0.0",
"@testing-library/react": "^14.0.0",
"@testing-library/user-event": "^14.4.3",
"@storybook/react-webpack5": "^7.6.12",
"@storybook/theming": "^7.6.12",
"@testing-library/dom": "^9.3.4",
"@testing-library/jest-dom": "^6.4.2",
"@testing-library/react": "^14.2.1",
"@testing-library/user-event": "^14.5.2",
"@types/child-process-promise": "^2.2.1",
"@types/classnames": "^2.2.9",
"@types/d3": "^7.4.0",
"@types/d3-graphviz": "^2.6.6",
"@types/del": "^4.0.0",
@@ -1945,45 +2007,46 @@
"@types/jest": "^29.0.2",
"@types/js-yaml": "^4.0.6",
"@types/nanoid": "^3.0.0",
"@types/node": "18.15.0",
"@types/node": "18.17.*",
"@types/node-fetch": "^2.5.2",
"@types/react": "^18.0.28",
"@types/react-dom": "^18.0.11",
"@types/react-dom": "^18.2.18",
"@types/sarif": "^2.1.2",
"@types/semver": "^7.2.0",
"@types/stream-json": "^1.7.1",
"@types/styled-components": "^5.1.11",
"@types/tar-stream": "^2.2.2",
"@types/tar-stream": "^3.1.3",
"@types/through2": "^2.0.36",
"@types/tmp": "^0.1.0",
"@types/tmp": "^0.2.6",
"@types/unzipper": "^0.10.1",
"@types/vscode": "^1.82.0",
"@types/webpack": "^5.28.0",
"@types/webpack-env": "^1.18.0",
"@typescript-eslint/eslint-plugin": "^6.2.1",
"@typescript-eslint/parser": "^6.2.1",
"@types/yauzl": "^2.10.3",
"@typescript-eslint/eslint-plugin": "^6.19.0",
"@typescript-eslint/parser": "^6.21.0",
"@vscode/test-electron": "^2.2.0",
"@vscode/vsce": "^2.19.0",
"ansi-colors": "^4.1.1",
"applicationinsights": "^2.3.5",
"cosmiconfig": "^8.2.0",
"applicationinsights": "^2.9.2",
"cosmiconfig": "^9.0.0",
"cross-env": "^7.0.3",
"css-loader": "^6.8.1",
"css-loader": "^6.10.0",
"del": "^6.0.0",
"esbuild": "^0.15.15",
"eslint": "^8.23.1",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.0.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-deprecation": "^2.0.0",
"eslint-plugin-etc": "^2.0.2",
"eslint-plugin-github": "^4.4.1",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jest-dom": "^5.0.1",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-react": "^7.31.8",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-storybook": "^0.6.4",
"file-loader": "^6.2.0",
"glob": "^10.0.0",
"gulp": "^4.0.2",
"gulp-esbuild": "^0.10.5",
"gulp-esbuild": "^0.12.0",
"gulp-replace": "^1.1.3",
"gulp-typescript": "^5.0.1",
"husky": "^8.0.0",
@@ -1991,13 +2054,13 @@
"jest-environment-jsdom": "^29.0.3",
"jest-runner-vscode": "^3.0.1",
"lint-staged": "^15.0.2",
"markdownlint-cli2": "^0.6.0",
"markdownlint-cli2-formatter-pretty": "^0.0.4",
"mini-css-extract-plugin": "^2.6.1",
"markdownlint-cli2": "^0.12.1",
"markdownlint-cli2-formatter-pretty": "^0.0.5",
"mini-css-extract-plugin": "^2.8.0",
"npm-run-all": "^4.1.5",
"patch-package": "^8.0.0",
"prettier": "^3.0.0",
"storybook": "^7.1.0",
"prettier": "^3.2.5",
"storybook": "^7.6.15",
"tar-stream": "^3.0.0",
"through2": "^4.0.2",
"ts-jest": "^29.0.1",
@@ -2005,9 +2068,7 @@
"ts-loader": "^9.4.2",
"ts-node": "^10.7.0",
"ts-unused-exports": "^10.0.0",
"typescript": "^5.0.2",
"webpack": "^5.76.0",
"webpack-cli": "^5.0.1"
"typescript": "^5.0.2"
},
"lint-staged": {
"./**/*.{json,css,scss}": [

View File

@@ -14,15 +14,16 @@
import { pathExists, readJson, writeJson } from "fs-extra";
import { resolve, relative } from "path";
import { Octokit } from "@octokit/core";
import { type RestEndpointMethodTypes } from "@octokit/rest";
import type { Octokit } from "@octokit/core";
import type { EndpointDefaults } from "@octokit/types";
import type { RestEndpointMethodTypes } from "@octokit/rest";
import { throttling } from "@octokit/plugin-throttling";
import { getFiles } from "./util/files";
import type { GitHubApiRequest } from "../src/common/mock-gh-api/gh-api-request";
import { isGetVariantAnalysisRequest } from "../src/common/mock-gh-api/gh-api-request";
import { VariantAnalysis } from "../src/variant-analysis/gh-api/variant-analysis";
import { RepositoryWithMetadata } from "../src/variant-analysis/gh-api/repository";
import type { VariantAnalysis } from "../src/variant-analysis/gh-api/variant-analysis";
import type { RepositoryWithMetadata } from "../src/variant-analysis/gh-api/repository";
import { AppOctokit } from "../src/common/octokit";
const extensionDirectory = resolve(__dirname, "..");
@@ -42,7 +43,7 @@ const octokit = new MyOctokit({
throttle: {
onRateLimit: (
retryAfter: number,
options: any,
options: EndpointDefaults,
octokit: Octokit,
): boolean => {
octokit.log.warn(
@@ -53,7 +54,7 @@ const octokit = new MyOctokit({
},
onSecondaryRateLimit: (
_retryAfter: number,
options: any,
options: EndpointDefaults,
octokit: Octokit,
): void => {
octokit.log.warn(

View File

@@ -9,12 +9,13 @@ function ignoreFile(file: string): boolean {
containsPath(".storybook", file) ||
containsPath(join("src", "stories"), file) ||
pathsEqual(
join("test", "vscode-tests", "jest-runner-installed-extensions.ts"),
join("test", "vscode-tests", "jest-runner-vscode-codeql-cli.ts"),
file,
) ||
basename(file) === "jest.config.ts" ||
basename(file) === "index.tsx" ||
basename(file) === "index.ts"
basename(file) === "index.ts" ||
basename(file) === "playwright.config.ts"
);
}

View File

@@ -0,0 +1,42 @@
import { join, resolve } from "path";
import { outputFile, readJSON } from "fs-extra";
import { minVersion } from "semver";
import { getVersionInformation } from "./util/vscode-versions";
const extensionDirectory = resolve(__dirname, "..");
async function generateChromiumVersion() {
const packageJson = await readJSON(
resolve(extensionDirectory, "package.json"),
);
const minimumVsCodeVersion = minVersion(packageJson.engines.vscode)?.version;
if (!minimumVsCodeVersion) {
throw new Error("Could not find minimum VS Code version");
}
const versionInformation = await getVersionInformation(minimumVsCodeVersion);
const chromiumMajorVersion = versionInformation.chromiumVersion.split(".")[0];
console.log(
`VS Code ${minimumVsCodeVersion} uses Chromium ${chromiumMajorVersion}`,
);
await outputFile(
join(extensionDirectory, "gulpfile.ts", "chromium-version.json"),
`${JSON.stringify(
{
chromiumVersion: chromiumMajorVersion,
electronVersion: versionInformation.electronVersion,
},
null,
2,
)}\n`,
);
}
generateChromiumVersion().catch((e: unknown) => {
console.error(e);
process.exit(2);
});

View File

@@ -6,6 +6,16 @@ import { format, resolveConfig } from "prettier";
const extensionDirectory = resolve(__dirname, "..");
const schemas = [
{
path: join(extensionDirectory, "src", "packaging", "qlpack-file.ts"),
type: "QlPackFile",
schemaPath: join(
extensionDirectory,
"src",
"packaging",
"qlpack-file.schema.json",
),
},
{
path: join(
extensionDirectory,

View File

@@ -19,8 +19,9 @@
import { spawnSync } from "child_process";
import { basename, resolve } from "path";
import { pathExists, readJSON } from "fs-extra";
import { RawSourceMap, SourceMapConsumer } from "source-map";
import { Open } from "unzipper";
import type { RawSourceMap } from "source-map";
import { SourceMapConsumer } from "source-map";
import { unzipToDirectorySequentially } from "../src/common/unzip";
if (process.argv.length !== 4) {
console.error(
@@ -78,10 +79,10 @@ async function extractSourceMap() {
releaseAssetsDirectory,
]);
const file = await Open.file(
await unzipToDirectorySequentially(
resolve(releaseAssetsDirectory, sourcemapAsset.name),
sourceMapsDirectory,
);
await file.extract({ path: sourceMapsDirectory });
} else {
const workflowRuns = runGhJSON<WorkflowRunListItem[]>([
"run",
@@ -242,7 +243,7 @@ type WorkflowRunListItem = {
async function replaceAsync(
str: string,
regex: RegExp,
replacer: (substring: string, ...args: any[]) => Promise<string>,
replacer: (substring: string, ...args: string[]) => Promise<string>,
) {
const promises: Array<Promise<string>> = [];
str.replace(regex, (match, ...args) => {

View File

@@ -0,0 +1,87 @@
import { join, resolve } from "path";
import { execSync } from "child_process";
import { outputFile, readFile, readJSON } from "fs-extra";
import { getVersionInformation } from "./util/vscode-versions";
import { fetchJson } from "./util/fetch";
const extensionDirectory = resolve(__dirname, "..");
interface Release {
tag_name: string;
}
async function updateNodeVersion() {
const latestVsCodeRelease = await fetchJson<Release>(
"https://api.github.com/repos/microsoft/vscode/releases/latest",
);
const latestVsCodeVersion = latestVsCodeRelease.tag_name;
console.log(`Latest VS Code version is ${latestVsCodeVersion}`);
const versionInformation = await getVersionInformation(latestVsCodeVersion);
console.log(
`VS Code ${versionInformation.vscodeVersion} uses Electron ${versionInformation.electronVersion} and Node ${versionInformation.nodeVersion}`,
);
let currentNodeVersion = (
await readFile(join(extensionDirectory, ".nvmrc"), "utf8")
).trim();
if (currentNodeVersion.startsWith("v")) {
currentNodeVersion = currentNodeVersion.slice(1);
}
if (currentNodeVersion === versionInformation.nodeVersion) {
console.log("Node version is already up to date");
return;
}
console.log("Node version needs to be updated, updating now");
await outputFile(
join(extensionDirectory, ".nvmrc"),
`v${versionInformation.nodeVersion}\n`,
);
console.log("Updated .nvmrc");
const packageJson = await readJSON(
join(extensionDirectory, "package.json"),
"utf8",
);
// The @types/node version needs to match the first two parts of the Node
// version, e.g. if the Node version is 18.17.3, the @types/node version
// should be 18.17.*. This corresponds with the documentation at
// https://github.com/definitelytyped/definitelytyped#how-do-definitely-typed-package-versions-relate-to-versions-of-the-corresponding-library
// "The patch version of the type declaration package is unrelated to the library patch version. This allows
// Definitely Typed to safely update type declarations for the same major/minor version of a library."
// 18.17.* is equivalent to >=18.17.0 <18.18.0
const typesNodeVersion = versionInformation.nodeVersion
.split(".")
.slice(0, 2)
.join(".");
packageJson.engines.node = `^${versionInformation.nodeVersion}`;
packageJson.devDependencies["@types/node"] = `${typesNodeVersion}.*`;
await outputFile(
join(extensionDirectory, "package.json"),
`${JSON.stringify(packageJson, null, 2)}\n`,
);
console.log("Updated package.json, now running npm install");
execSync("npm install", { cwd: extensionDirectory, stdio: "inherit" });
// Always use the latest patch version of @types/node
execSync("npm upgrade @types/node", {
cwd: extensionDirectory,
stdio: "inherit",
});
console.log("Node version updated successfully");
}
updateNodeVersion().catch((e: unknown) => {
console.error(e);
process.exit(2);
});

View File

@@ -0,0 +1,10 @@
export async function fetchJson<T>(url: string): Promise<T> {
const response = await fetch(url);
if (!response.ok) {
throw new Error(
`Could not fetch ${url}: ${response.status} ${response.statusText}`,
);
}
return (await response.json()) as T;
}

View File

@@ -0,0 +1,70 @@
import { minVersion } from "semver";
import { fetchJson } from "./fetch";
type VsCodePackageJson = {
devDependencies: {
electron: string;
};
};
async function getVsCodePackageJson(
version: string,
): Promise<VsCodePackageJson> {
return await fetchJson(
`https://raw.githubusercontent.com/microsoft/vscode/${version}/package.json`,
);
}
interface ElectronVersion {
version: string;
date: string;
node: string;
v8: string;
uv: string;
zlib: string;
openssl: string;
modules: string;
chrome: string;
files: string[];
body?: string;
apm?: string;
}
async function getElectronReleases(): Promise<ElectronVersion[]> {
return await fetchJson("https://releases.electronjs.org/releases.json");
}
type VersionInformation = {
vscodeVersion: string;
electronVersion: string;
nodeVersion: string;
chromiumVersion: string;
};
export async function getVersionInformation(
vscodeVersion: string,
): Promise<VersionInformation> {
const vsCodePackageJson = await getVsCodePackageJson(vscodeVersion);
const electronVersion = minVersion(
vsCodePackageJson.devDependencies.electron,
)?.version;
if (!electronVersion) {
throw new Error("Could not find Electron version");
}
const electronReleases = await getElectronReleases();
const electronRelease = electronReleases.find(
(release) => release.version === electronVersion,
);
if (!electronRelease) {
throw new Error(`Could not find Electron release ${electronVersion}`);
}
return {
vscodeVersion,
electronVersion,
nodeVersion: electronRelease.node,
chromiumVersion: electronRelease.chrome,
};
}

View File

@@ -30,34 +30,34 @@
"Dataflow Tracking Class": {
"prefix": "dataflowtracking",
"body": [
"class $1 extends DataFlow::Configuration {",
"\t$1() { this = \"$1\" }",
"\t",
"\toverride predicate isSource(DataFlow::Node node) {",
"module $1 implements DataFlow::ConfigSig {",
"\tpredicate isSource(DataFlow::Node node) {",
"\t\t${2:none()}",
"\t}",
"\t",
"\toverride predicate isSink(DataFlow::Node node) {",
"",
"\tpredicate isSink(DataFlow::Node node) {",
"\t\t${3:none()}",
"\t}",
"}"
"}",
"",
"module ${4:Flow} = DataFlow::Global<$1>;"
],
"description": "Boilerplate for a dataflow tracking class"
},
"Taint Tracking Class": {
"prefix": "tainttracking",
"body": [
"class $1 extends TaintTracking::Configuration {",
"\t$1() { this = \"$1\" }",
"\t",
"\toverride predicate isSource(DataFlow::Node node) {",
"module $1 implements DataFlow::ConfigSig {",
"\tpredicate isSource(DataFlow::Node node) {",
"\t\t${2:none()}",
"\t}",
"\t",
"\toverride predicate isSink(DataFlow::Node node) {",
"",
"\tpredicate isSink(DataFlow::Node node) {",
"\t\t${3:none()}",
"\t}",
"}"
"}",
"",
"module ${4:Flow} = TaintTracking::Global<$1>;"
],
"description": "Boilerplate for a taint tracking class"
},

View File

@@ -1,15 +0,0 @@
/**
* The d3 library is designed to work in both the browser and
* node. Consequently their typings files refer to both node
* types like `Buffer` (which don't exist in the browser), and browser
* types like `Blob` (which don't exist in node). Instead of sticking
* all of `dom` in `compilerOptions.lib`, it suffices just to put in a
* stub definition of the affected types so that compilation
* succeeds.
*/
declare type RequestInit = Record<string, unknown>;
declare type ElementTagNameMap = any;
declare type NodeListOf<T> = Record<string, T>;
declare type Node = Record<string, unknown>;
declare type XMLDocument = Record<string, unknown>;

View File

@@ -1,4 +1,4 @@
import { AppCommandManager } from "../common/commands";
import type { AppCommandManager } from "../common/commands";
import { Uri, workspace } from "vscode";
import { join } from "path";
import { pathExists } from "fs-extra";

View File

@@ -0,0 +1,62 @@
import { execFile } from "child_process";
import { promisify } from "util";
import type { BaseLogger } from "../common/logging";
import type { ProgressReporter } from "../common/logging/vscode";
import {
getChildProcessErrorMessage,
getErrorMessage,
} from "../common/helpers-pure";
/**
* Flags to pass to all cli commands.
*/
export const LOGGING_FLAGS = ["-v", "--log-to-stderr"];
/**
* Runs a CodeQL CLI command without invoking the CLI server, deserializing the output as JSON.
* @param codeQlPath The path to the CLI.
* @param command The `codeql` command to be run, provided as an array of command/subcommand names.
* @param commandArgs The arguments to pass to the `codeql` command.
* @param description Description of the action being run, to be shown in log and error messages.
* @param logger Logger to write command log messages, e.g. to an output channel.
* @param progressReporter Used to output progress messages, e.g. to the status bar.
* @returns A JSON object parsed from the contents of the command's stdout, if the command succeeded.
*/
export async function runJsonCodeQlCliCommand<OutputType>(
codeQlPath: string,
command: string[],
commandArgs: string[],
description: string,
logger: BaseLogger,
progressReporter?: ProgressReporter,
): Promise<OutputType> {
// Add logging arguments first, in case commandArgs contains positional parameters.
const args = command.concat(LOGGING_FLAGS).concat(commandArgs);
const argsString = args.join(" ");
let stdout: string;
try {
if (progressReporter !== undefined) {
progressReporter.report({ message: description });
}
void logger.log(
`${description} using CodeQL CLI: ${codeQlPath} ${argsString}...`,
);
const result = await promisify(execFile)(codeQlPath, args);
void logger.log(result.stderr);
void logger.log("CLI command succeeded.");
stdout = result.stdout;
} catch (err) {
throw new Error(
`${description} failed: ${getChildProcessErrorMessage(err)}`,
);
}
try {
return JSON.parse(stdout) as OutputType;
} catch (err) {
throw new Error(
`Parsing output of ${description} failed: ${getErrorMessage(err)}`,
);
}
}

View File

@@ -0,0 +1,102 @@
import { asError, getErrorMessage } from "../common/helpers-pure";
// https://docs.github.com/en/code-security/codeql-cli/using-the-advanced-functionality-of-the-codeql-cli/exit-codes
const EXIT_CODE_USER_ERROR = 2;
const EXIT_CODE_CANCELLED = 98;
export class ExitCodeError extends Error {
constructor(public readonly exitCode: number | null) {
super(`Process exited with code ${exitCode}`);
}
}
export class CliError extends Error {
constructor(
message: string,
public readonly stderr: string | undefined,
public readonly cause: Error,
public readonly commandDescription: string,
public readonly commandArgs: string[],
) {
super(message);
}
}
export function getCliError(
e: unknown,
stderr: string | undefined,
commandDescription: string,
commandArgs: string[],
): CliError {
const error = asError(e);
if (!(error instanceof ExitCodeError) || !stderr) {
return formatCliErrorFallback(
error,
stderr,
commandDescription,
commandArgs,
);
}
switch (error.exitCode) {
case EXIT_CODE_USER_ERROR: {
// This is an error that we should try to format nicely
const fatalErrorIndex = stderr.lastIndexOf("A fatal error occurred: ");
if (fatalErrorIndex !== -1) {
return new CliError(
stderr.slice(fatalErrorIndex),
stderr,
error,
commandDescription,
commandArgs,
);
}
break;
}
case EXIT_CODE_CANCELLED: {
const cancellationIndex = stderr.lastIndexOf(
"Computation was cancelled: ",
);
if (cancellationIndex !== -1) {
return new CliError(
stderr.slice(cancellationIndex),
stderr,
error,
commandDescription,
commandArgs,
);
}
break;
}
}
return formatCliErrorFallback(error, stderr, commandDescription, commandArgs);
}
function formatCliErrorFallback(
error: Error,
stderr: string | undefined,
commandDescription: string,
commandArgs: string[],
): CliError {
if (stderr) {
return new CliError(
stderr,
undefined,
error,
commandDescription,
commandArgs,
);
}
return new CliError(
getErrorMessage(error),
undefined,
error,
commandDescription,
commandArgs,
);
}

View File

@@ -1,24 +1,49 @@
import * as semver from "semver";
import { runCodeQlCliCommand } from "./cli";
import { Logger } from "../common/logging";
import type { SemVer } from "semver";
import { parse } from "semver";
import { runJsonCodeQlCliCommand } from "./cli-command";
import type { Logger } from "../common/logging";
import { getErrorMessage } from "../common/helpers-pure";
interface VersionResult {
version: string;
features: CliFeatures | undefined;
}
export interface CliFeatures {
featuresInVersionResult?: boolean;
mrvaPackCreate?: boolean;
}
export interface VersionAndFeatures {
version: SemVer;
features: CliFeatures;
}
/**
* Get the version of a CodeQL CLI.
*/
export async function getCodeQlCliVersion(
codeQlPath: string,
logger: Logger,
): Promise<semver.SemVer | undefined> {
): Promise<VersionAndFeatures | undefined> {
try {
const output: string = await runCodeQlCliCommand(
const output: VersionResult = await runJsonCodeQlCliCommand<VersionResult>(
codeQlPath,
["version"],
["--format=terse"],
["--format=json"],
"Checking CodeQL version",
logger,
);
return semver.parse(output.trim()) || undefined;
const version = parse(output.version.trim()) || undefined;
if (version === undefined) {
return undefined;
}
return {
version,
features: output.features ?? {},
};
} catch (e) {
// Failed to run the version command. This might happen if the cli version is _really_ old, or it is corrupted.
// Either way, we can't determine compatibility.

View File

@@ -1,40 +1,41 @@
import { EOL } from "os";
import { spawn } from "child-process-promise";
import * as child_process from "child_process";
import type { ChildProcessWithoutNullStreams } from "child_process";
import { spawn as spawnChildProcess } from "child_process";
import { readFile } from "fs-extra";
import { dirname, join, delimiter } from "path";
import * as sarif from "sarif";
import { delimiter, dirname, join } from "path";
import type { Log } from "sarif";
import { SemVer } from "semver";
import { Readable } from "stream";
import type { Readable } from "stream";
import tk from "tree-kill";
import { promisify } from "util";
import { CancellationToken, Disposable, Uri } from "vscode";
import type { CancellationToken, Disposable, Uri } from "vscode";
import {
BQRSInfo,
import type {
BqrsInfo,
DecodedBqrs,
DecodedBqrsChunk,
} from "../common/bqrs-cli-types";
import { allowCanaryQueryServer, CliConfig } from "../config";
import {
DistributionProvider,
FindDistributionResultKind,
} from "./distribution";
import type { CliConfig } from "../config";
import type { DistributionProvider } from "./distribution";
import { FindDistributionResultKind } from "./distribution";
import {
assertNever,
getChildProcessErrorMessage,
getErrorMessage,
getErrorStack,
} from "../common/helpers-pure";
import { walkDirectory } from "../common/files";
import { QueryMetadata, SortDirection } from "../common/interface-types";
import { BaseLogger, Logger } from "../common/logging";
import { ProgressReporter } from "../common/logging/vscode";
import { CompilationMessage } from "../query-server/legacy-messages";
import type { QueryMetadata } from "../common/interface-types";
import { SortDirection } from "../common/interface-types";
import type { BaseLogger, Logger } from "../common/logging";
import type { ProgressReporter } from "../common/logging/vscode";
import { sarifParser } from "../common/sarif-parser";
import { App } from "../common/app";
import type { App } from "../common/app";
import { QueryLanguage } from "../common/query-language";
import { LINE_ENDINGS, splitStreamAtSeparators } from "../common/split-stream";
import type { Position } from "../query-server/messages";
import { LOGGING_FLAGS } from "./cli-command";
import type { CliFeatures, VersionAndFeatures } from "./cli-version";
import { ExitCodeError, getCliError } from "./cli-errors";
/**
* The version of the SARIF format that we are using.
@@ -46,21 +47,6 @@ const SARIF_FORMAT = "sarifv2.1.0";
*/
const CSV_FORMAT = "csv";
/**
* Flags to pass to all cli commands.
*/
const LOGGING_FLAGS = ["-v", "--log-to-stderr"];
/**
* The expected output of `codeql resolve library-path`.
*/
export interface QuerySetup {
libraryPath: string[];
dbscheme: string;
relativeName?: string;
compilationCache?: string;
}
/**
* The expected output of `codeql resolve queries --format bylanguage`.
*/
@@ -88,7 +74,7 @@ export interface DbInfo {
/**
* The expected output of `codeql resolve upgrades`.
*/
export interface UpgradesInfo {
interface UpgradesInfo {
scripts: string[];
finalDbscheme: string;
matchesTarget?: boolean;
@@ -102,33 +88,33 @@ export type QlpacksInfo = { [name: string]: string[] };
/**
* The expected output of `codeql resolve languages`.
*/
export type LanguagesInfo = { [name: string]: string[] };
type LanguagesInfo = { [name: string]: string[] };
/** Information about an ML model, as resolved by `codeql resolve ml-models`. */
export type MlModelInfo = {
type MlModelInfo = {
checksum: string;
path: string;
};
/** The expected output of `codeql resolve ml-models`. */
export type MlModelsInfo = { models: MlModelInfo[] };
type MlModelsInfo = { models: MlModelInfo[] };
/** Information about a data extension predicate, as resolved by `codeql resolve extensions`. */
export type DataExtensionResult = {
type DataExtensionResult = {
predicate: string;
file: string;
index: number;
};
/** The expected output of `codeql resolve extensions`. */
export type ResolveExtensionsResult = {
type ResolveExtensionsResult = {
models: MlModelInfo[];
data: {
[path: string]: DataExtensionResult[];
};
};
export type GenerateExtensiblePredicateMetadataResult = {
type GenerateExtensiblePredicateMetadataResult = {
// There are other properties in this object, but they are
// not relevant for its use in the extension, so we omit them.
extensible_predicates: Array<{
@@ -137,10 +123,20 @@ export type GenerateExtensiblePredicateMetadataResult = {
}>;
};
type PackDownloadResult = {
// There are other properties in this object, but they are
// not relevant for its use in the extension, so we omit them.
packs: Array<{
name: string;
version: string;
}>;
packDir: string;
};
/**
* The expected output of `codeql resolve qlref`.
*/
export type QlrefInfo = { resolvedPath: string };
type QlrefInfo = { resolvedPath: string };
// `codeql bqrs interpret` requires both of these to be present or
// both absent.
@@ -152,12 +148,38 @@ export interface SourceInfo {
/**
* The expected output of `codeql resolve queries`.
*/
export type ResolvedQueries = string[];
type ResolvedQueries = string[];
/**
* The expected output of `codeql resolve tests`.
*/
export type ResolvedTests = string[];
type ResolvedTests = string[];
/**
* The severity of a compilation message for a test message.
*/
export enum CompilationMessageSeverity {
Error = "ERROR",
Warning = "WARNING",
}
/**
* A compilation message for a test message (either an error or a warning).
*/
export interface CompilationMessage {
/**
* The text of the message
*/
message: string;
/**
* The source position associated with the message
*/
position: Position;
/**
* The severity of the message
*/
severity: CompilationMessageSeverity;
}
/**
* Event fired by `codeql test run`.
@@ -187,11 +209,13 @@ interface BqrsDecodeOptions {
entities?: string[];
}
export type OnLineCallback = (
type OnLineCallback = (
line: string,
) => Promise<string | undefined> | string | undefined;
type VersionChangedListener = (newVersion: SemVer | undefined) => void;
type VersionChangedListener = (
newVersionAndFeatures: VersionAndFeatures | undefined,
) => void;
/**
* This class manages a cli server started by `codeql execute cli-server` to
@@ -201,7 +225,7 @@ type VersionChangedListener = (newVersion: SemVer | undefined) => void;
*/
export class CodeQLCliServer implements Disposable {
/** The process for the cli server, or undefined if one doesn't exist yet */
process?: child_process.ChildProcessWithoutNullStreams;
process?: ChildProcessWithoutNullStreams;
/** Queue of future commands*/
commandQueue: Array<() => void>;
/** Whether a command is running */
@@ -209,8 +233,8 @@ export class CodeQLCliServer implements Disposable {
/** A buffer with a single null byte. */
nullBuffer: Buffer;
/** Version of current cli, lazily computed by the `getVersion()` method */
private _version: SemVer | undefined;
/** Version of current cli and its supported features, lazily computed by the `getVersion()` method */
private _versionAndFeatures: VersionAndFeatures | undefined;
private _versionChangedListeners: VersionChangedListener[] = [];
@@ -241,15 +265,11 @@ export class CodeQLCliServer implements Disposable {
if (this.distributionProvider.onDidChangeDistribution) {
this.distributionProvider.onDidChangeDistribution(() => {
this.restartCliServer();
this._version = undefined;
this._supportedLanguages = undefined;
});
}
if (this.cliConfig.onDidChangeConfiguration) {
this.cliConfig.onDidChangeConfiguration(() => {
this.restartCliServer();
this._version = undefined;
this._supportedLanguages = undefined;
});
}
}
@@ -290,6 +310,8 @@ export class CodeQLCliServer implements Disposable {
const callback = (): void => {
try {
this.killProcessIfRunning();
this._versionAndFeatures = undefined;
this._supportedLanguages = undefined;
} finally {
this.runNext();
}
@@ -319,7 +341,7 @@ export class CodeQLCliServer implements Disposable {
/**
* Launch the cli server
*/
private async launchProcess(): Promise<child_process.ChildProcessWithoutNullStreams> {
private async launchProcess(): Promise<ChildProcessWithoutNullStreams> {
const codeQlPath = await this.getCodeQlPath();
const args = [];
if (shouldDebugCliServer()) {
@@ -348,6 +370,8 @@ export class CodeQLCliServer implements Disposable {
silent?: boolean,
): Promise<string> {
const stderrBuffers: Buffer[] = [];
// The current buffer of stderr of a single line. To be used for logging.
let currentLineStderrBuffer: Buffer = Buffer.alloc(0);
if (this.commandInProcess) {
throw new Error("runCodeQlCliInternal called while cli was running");
}
@@ -405,9 +429,43 @@ export class CodeQLCliServer implements Disposable {
// Listen to stderr
process.stderr.addListener("data", (newData: Buffer) => {
stderrBuffers.push(newData);
if (!silent) {
currentLineStderrBuffer = Buffer.concat([
currentLineStderrBuffer,
newData,
]);
// Print the stderr to the logger as it comes in. We need to ensure that
// we don't split messages on the same line, so we buffer the stderr and
// split it on EOLs.
const eolBuffer = Buffer.from(EOL);
let hasCreatedSubarray = false;
let eolIndex;
while (
(eolIndex = currentLineStderrBuffer.indexOf(eolBuffer)) !== -1
) {
const line = currentLineStderrBuffer.subarray(0, eolIndex);
void this.logger.log(line.toString("utf-8"));
currentLineStderrBuffer = currentLineStderrBuffer.subarray(
eolIndex + eolBuffer.length,
);
hasCreatedSubarray = true;
}
// We have created a subarray, which means that the complete original buffer is now referenced
// by the subarray. We need to create a new buffer to avoid memory leaks.
if (hasCreatedSubarray) {
currentLineStderrBuffer = Buffer.from(currentLineStderrBuffer);
}
}
});
// Listen for process exit.
process.addListener("close", (code) => reject(code));
process.addListener("close", (code) =>
reject(new ExitCodeError(code)),
);
// Write the command followed by a null terminator.
process.stdin.write(JSON.stringify(args), "utf8");
process.stdin.write(this.nullBuffer);
@@ -417,28 +475,29 @@ export class CodeQLCliServer implements Disposable {
// Make sure we remove the terminator;
const data = fullBuffer.toString("utf8", 0, fullBuffer.length - 1);
if (!silent) {
void this.logger.log(currentLineStderrBuffer.toString("utf8"));
currentLineStderrBuffer = Buffer.alloc(0);
void this.logger.log("CLI command succeeded.");
}
return data;
} catch (err) {
// Kill the process if it isn't already dead.
this.killProcessIfRunning();
// Report the error (if there is a stderr then use that otherwise just report the error code or nodejs error)
const newError =
stderrBuffers.length === 0
? new Error(
`${description} failed with args:${EOL} ${argsString}${EOL}${err}`,
)
: new Error(
`${description} failed with args:${EOL} ${argsString}${EOL}${Buffer.concat(
stderrBuffers,
).toString("utf8")}`,
);
newError.stack += getErrorStack(err);
throw newError;
const cliError = getCliError(
err,
stderrBuffers.length > 0
? Buffer.concat(stderrBuffers).toString("utf8")
: undefined,
description,
args,
);
cliError.stack += getErrorStack(err);
throw cliError;
} finally {
if (!silent) {
void this.logger.log(Buffer.concat(stderrBuffers).toString("utf8"));
if (!silent && currentLineStderrBuffer.length > 0) {
void this.logger.log(currentLineStderrBuffer.toString("utf8"));
}
// Remove the listeners we set up.
process.stdout.removeAllListeners("data");
@@ -637,9 +696,10 @@ export class CodeQLCliServer implements Disposable {
} = {},
): Promise<OutputType> {
let args: string[] = [];
if (addFormat)
if (addFormat) {
// Add format argument first, in case commandArgs contains positional parameters.
args = args.concat(["--format", "json"]);
}
args = args.concat(commandArgs);
const result = await this.runCodeQlCliCommand(command, args, description, {
progressReporter,
@@ -721,29 +781,6 @@ export class CodeQLCliServer implements Disposable {
);
}
/**
* Resolve the library path and dbscheme for a query.
* @param workspaces The current open workspaces
* @param queryPath The path to the query
*/
async resolveLibraryPath(
workspaces: string[],
queryPath: string,
silent = false,
): Promise<QuerySetup> {
const subcommandArgs = [
"--query",
queryPath,
...this.getAdditionalPacksArg(workspaces),
];
return await this.runJsonCodeQlCliCommand<QuerySetup>(
["resolve", "library-path"],
subcommandArgs,
"Resolving library paths",
{ silent },
);
}
/**
* Resolves the language for a query.
* @param queryUri The URI of the query
@@ -797,6 +834,11 @@ export class CodeQLCliServer implements Disposable {
["resolve", "tests", "--strict-test-discovery"],
subcommandArgs,
"Resolving tests",
{
// This happens as part of a background process, so we don't want to
// spam the log with messages.
silent: true,
},
);
}
@@ -881,10 +923,9 @@ export class CodeQLCliServer implements Disposable {
additionalPacks: string[],
queryPath: string,
): Promise<MlModelsInfo> {
const args = (await this.cliConstraints.supportsPreciseResolveMlModels())
? // use the dirname of the path so that we can handle query libraries
[...this.getAdditionalPacksArg(additionalPacks), dirname(queryPath)]
: this.getAdditionalPacksArg(additionalPacks);
const args =
// use the dirname of the path so that we can handle query libraries
[...this.getAdditionalPacksArg(additionalPacks), dirname(queryPath)];
return await this.runJsonCodeQlCliCommand<MlModelsInfo>(
["resolve", "ml-models"],
args,
@@ -925,11 +966,11 @@ export class CodeQLCliServer implements Disposable {
* @param bqrsPath The path to the bqrs.
* @param pageSize The page size to precompute offsets into the binary file for.
*/
async bqrsInfo(bqrsPath: string, pageSize?: number): Promise<BQRSInfo> {
async bqrsInfo(bqrsPath: string, pageSize?: number): Promise<BqrsInfo> {
const subcommandArgs = (
pageSize ? ["--paginate-rows", pageSize.toString()] : []
).concat(bqrsPath);
return await this.runJsonCodeQlCliCommand<BQRSInfo>(
return await this.runJsonCodeQlCliCommand<BqrsInfo>(
["bqrs", "info"],
subcommandArgs,
"Reading bqrs header",
@@ -942,8 +983,12 @@ export class CodeQLCliServer implements Disposable {
name?: string,
): Promise<string> {
const subcommandArgs = [];
if (target) subcommandArgs.push("--target", target);
if (name) subcommandArgs.push("--name", name);
if (target) {
subcommandArgs.push("--target", target);
}
if (name) {
subcommandArgs.push("--name", name);
}
subcommandArgs.push(archivePath);
return await this.runCodeQlCliCommand(
@@ -964,7 +1009,9 @@ export class CodeQLCliServer implements Disposable {
outputDirectory?: string,
): Promise<string> {
const subcommandArgs = ["--format=markdown"];
if (outputDirectory) subcommandArgs.push("--output", outputDirectory);
if (outputDirectory) {
subcommandArgs.push("--output", outputDirectory);
}
subcommandArgs.push(pathToQhelp);
return await this.runCodeQlCliCommand(
@@ -988,9 +1035,7 @@ export class CodeQLCliServer implements Disposable {
const subcommandArgs = [
"--format=text",
`--end-summary=${endSummaryPath}`,
...((await this.cliConstraints.supportsSourceMap())
? ["--sourcemap"]
: []),
"--sourcemap",
inputPath,
outputPath,
];
@@ -1099,7 +1144,7 @@ export class CodeQLCliServer implements Disposable {
interpretedResultsPath: string,
sourceInfo?: SourceInfo,
args?: string[],
): Promise<sarif.Log> {
): Promise<Log> {
const additionalArgs = [
// TODO: This flag means that we don't group interpreted results
// by primary location. We may want to revisit whether we call
@@ -1270,12 +1315,6 @@ export class CodeQLCliServer implements Disposable {
): Promise<QlpacksInfo> {
const args = this.getAdditionalPacksArg(additionalPacks);
if (extensionPacksOnly) {
if (!(await this.cliConstraints.supportsQlpacksKind())) {
void this.logger.log(
"Warning: Running with extension packs is only supported by CodeQL CLI v2.12.3 or later.",
);
return {};
}
args.push("--kind", "extension", "--no-recursive");
} else if (kind) {
args.push("--kind", kind);
@@ -1383,13 +1422,10 @@ export class CodeQLCliServer implements Disposable {
async packAdd(dir: string, queryLanguage: QueryLanguage) {
const args = ["--dir", dir];
args.push(`codeql/${queryLanguage}-all`);
return this.runJsonCodeQlCliCommandWithAuthentication(
return this.runCodeQlCliCommand(
["pack", "add"],
args,
`Adding and installing ${queryLanguage} pack dependency.`,
{
addFormat: false,
},
);
}
@@ -1397,7 +1433,7 @@ export class CodeQLCliServer implements Disposable {
* Downloads a specified pack.
* @param packs The `<package-scope/name[@version]>` of the packs to download.
*/
async packDownload(packs: string[]) {
async packDownload(packs: string[]): Promise<PackDownloadResult> {
return this.runJsonCodeQlCliCommandWithAuthentication(
["pack", "download"],
packs,
@@ -1414,15 +1450,13 @@ export class CodeQLCliServer implements Disposable {
args.push("--mode", "update");
}
if (workspaceFolders?.length > 0) {
if (await this.cliConstraints.supportsAdditionalPacksInstall()) {
args.push(
// Allow prerelease packs from the ql submodule.
"--allow-prerelease",
// Allow the use of --additional-packs argument without issueing a warning
"--no-strict-mode",
...this.getAdditionalPacksArg(workspaceFolders),
);
}
args.push(
// Allow prerelease packs from the ql submodule.
"--allow-prerelease",
// Allow the use of --additional-packs argument without issueing a warning
"--no-strict-mode",
...this.getAdditionalPacksArg(workspaceFolders),
);
}
return this.runJsonCodeQlCliCommandWithAuthentication(
["pack", "install"],
@@ -1431,16 +1465,28 @@ export class CodeQLCliServer implements Disposable {
);
}
/**
* Compile a CodeQL pack and bundle it into a single file.
*
* @param sourcePackDir The directory of the input CodeQL pack.
* @param workspaceFolders The workspace folders to search for additional packs.
* @param outputBundleFile The path to the output bundle file.
* @param outputPackDir The directory to contain the unbundled output pack.
* @param moreOptions Additional options to be passed to `codeql pack bundle`.
*/
async packBundle(
dir: string,
sourcePackDir: string,
workspaceFolders: string[],
outputPath: string,
outputBundleFile: string,
outputPackDir: string,
moreOptions: string[],
): Promise<void> {
const args = [
"-o",
outputPath,
dir,
outputBundleFile,
sourcePackDir,
"--pack-path",
outputPackDir,
...moreOptions,
...this.getAdditionalPacksArg(workspaceFolders),
];
@@ -1495,27 +1541,27 @@ export class CodeQLCliServer implements Disposable {
);
}
public async getVersion() {
if (!this._version) {
try {
const newVersion = await this.refreshVersion();
this._version = newVersion;
this._versionChangedListeners.forEach((listener) =>
listener(newVersion),
);
public async getVersion(): Promise<SemVer> {
return (await this.getVersionAndFeatures()).version;
}
public async getFeatures(): Promise<CliFeatures> {
return (await this.getVersionAndFeatures()).features;
}
private async getVersionAndFeatures(): Promise<VersionAndFeatures> {
if (!this._versionAndFeatures) {
try {
const newVersionAndFeatures = await this.refreshVersion();
this._versionAndFeatures = newVersionAndFeatures;
this._versionChangedListeners.forEach((listener) =>
listener(newVersionAndFeatures),
);
// this._version is only undefined upon config change, so we reset CLI-based context key only when necessary.
await this.app.commands.execute(
"setContext",
"codeql.supportsQuickEvalCount",
newVersion.compare(
CliVersionConstraint.CLI_VERSION_WITH_QUICK_EVAL_COUNT,
) >= 0,
);
await this.app.commands.execute(
"setContext",
"codeql.supportsTrimCache",
newVersion.compare(
newVersionAndFeatures.version.compare(
CliVersionConstraint.CLI_VERSION_WITH_TRIM_CACHE,
) >= 0,
);
@@ -1526,23 +1572,23 @@ export class CodeQLCliServer implements Disposable {
throw e;
}
}
return this._version;
return this._versionAndFeatures;
}
public addVersionChangedListener(listener: VersionChangedListener) {
if (this._version) {
listener(this._version);
if (this._versionAndFeatures) {
listener(this._versionAndFeatures);
}
this._versionChangedListeners.push(listener);
}
private async refreshVersion() {
private async refreshVersion(): Promise<VersionAndFeatures> {
const distribution = await this.distributionProvider.getDistribution();
switch (distribution.kind) {
case FindDistributionResultKind.CompatibleDistribution:
// eslint-disable-next-line no-fallthrough -- Intentional fallthrough
case FindDistributionResultKind.IncompatibleDistribution:
return distribution.version;
return distribution.versionAndFeatures;
default:
// We should not get here because if no distributions are available, then
@@ -1555,11 +1601,8 @@ export class CodeQLCliServer implements Disposable {
return paths.length ? ["--additional-packs", paths.join(delimiter)] : [];
}
public async useExtensionPacks(): Promise<boolean> {
return (
this.cliConfig.useExtensionPacks &&
(await this.cliConstraints.supportsQlpacksKind())
);
public useExtensionPacks(): boolean {
return this.cliConfig.useExtensionPacks;
}
public async setUseExtensionPacks(useExtensionPacks: boolean) {
@@ -1587,10 +1630,10 @@ export function spawnServer(
command: string[],
commandArgs: string[],
logger: Logger,
stderrListener: (data: any) => void,
stdoutListener?: (data: any) => void,
stderrListener: (data: string | Buffer) => void,
stdoutListener?: (data: string | Buffer) => void,
progressReporter?: ProgressReporter,
): child_process.ChildProcessWithoutNullStreams {
): ChildProcessWithoutNullStreams {
// Enable verbose logging.
const args = command.concat(commandArgs).concat(LOGGING_FLAGS);
@@ -1601,29 +1644,32 @@ export function spawnServer(
progressReporter.report({ message: `Starting ${name}` });
}
void logger.log(`Starting ${name} using CodeQL CLI: ${base} ${argsString}`);
const child = child_process.spawn(base, args);
const child = spawnChildProcess(base, args);
if (!child || !child.pid) {
throw new Error(
`Failed to start ${name} using command ${base} ${argsString}.`,
);
}
let lastStdout: any = undefined;
let lastStdout: string | Buffer | undefined = undefined;
child.stdout!.on("data", (data) => {
lastStdout = data;
});
// Set up event listeners.
child.on("close", async (code, signal) => {
if (code !== null)
if (code !== null) {
void logger.log(`Child process exited with code ${code}`);
if (signal)
}
if (signal) {
void logger.log(
`Child process exited due to receipt of signal ${signal}`,
);
}
// If the process exited abnormally, log the last stdout message,
// It may be from the jvm.
if (code !== 0 && lastStdout !== undefined)
if (code !== 0 && lastStdout !== undefined) {
void logger.log(`Last stdout was "${lastStdout.toString()}"`);
}
});
child.stderr!.on("data", stderrListener);
if (stdoutListener !== undefined) {
@@ -1637,45 +1683,6 @@ export function spawnServer(
return child;
}
/**
* Runs a CodeQL CLI command without invoking the CLI server, returning the output as a string.
* @param codeQlPath The path to the CLI.
* @param command The `codeql` command to be run, provided as an array of command/subcommand names.
* @param commandArgs The arguments to pass to the `codeql` command.
* @param description Description of the action being run, to be shown in log and error messages.
* @param logger Logger to write command log messages, e.g. to an output channel.
* @param progressReporter Used to output progress messages, e.g. to the status bar.
* @returns The contents of the command's stdout, if the command succeeded.
*/
export async function runCodeQlCliCommand(
codeQlPath: string,
command: string[],
commandArgs: string[],
description: string,
logger: Logger,
progressReporter?: ProgressReporter,
): Promise<string> {
// Add logging arguments first, in case commandArgs contains positional parameters.
const args = command.concat(LOGGING_FLAGS).concat(commandArgs);
const argsString = args.join(" ");
try {
if (progressReporter !== undefined) {
progressReporter.report({ message: description });
}
void logger.log(
`${description} using CodeQL CLI: ${codeQlPath} ${argsString}...`,
);
const result = await promisify(child_process.execFile)(codeQlPath, args);
void logger.log(result.stderr);
void logger.log("CLI command succeeded.");
return result.stdout;
} catch (err) {
throw new Error(
`${description} failed: ${getChildProcessErrorMessage(err)}`,
);
}
}
/**
* Log a text stream to a `Logger` interface.
* @param stream The stream to log.
@@ -1697,7 +1704,7 @@ function isEnvTrue(name: string): boolean {
);
}
export function shouldDebugIdeServer() {
export function shouldDebugLanguageServer() {
return isEnvTrue("IDE_SERVER_JAVA_DEBUG");
}
@@ -1705,67 +1712,14 @@ export function shouldDebugQueryServer() {
return isEnvTrue("QUERY_SERVER_JAVA_DEBUG");
}
export function shouldDebugCliServer() {
function shouldDebugCliServer() {
return isEnvTrue("CLI_SERVER_JAVA_DEBUG");
}
export class CliVersionConstraint {
// The oldest version of the CLI that we support. This is used to determine
// whether to show a warning about the CLI being too old on startup.
public static OLDEST_SUPPORTED_CLI_VERSION = new SemVer("2.9.4");
/**
* CLI version where building QLX packs for remote queries is supported.
* (The options were _accepted_ by a few earlier versions, but only from
* 2.11.3 will it actually use the existing compilation cache correctly).
*/
public static CLI_VERSION_QLX_REMOTE = new SemVer("2.11.3");
/**
* CLI version where the `resolve ml-models` subcommand was enhanced to work with packaging.
*/
public static CLI_VERSION_WITH_PRECISE_RESOLVE_ML_MODELS = new SemVer(
"2.10.0",
);
/**
* CLI version where the `resolve extensions` subcommand exists.
*/
public static CLI_VERSION_WITH_RESOLVE_EXTENSIONS = new SemVer("2.10.2");
/**
* CLI version that supports the `--sourcemap` option for log generation.
*/
public static CLI_VERSION_WITH_SOURCEMAP = new SemVer("2.10.3");
/**
* CLI version that supports the new query server.
*/
public static CLI_VERSION_WITH_NEW_QUERY_SERVER = new SemVer("2.11.1");
/**
* CLI version that supports `${workspace}` references in qlpack.yml files.
*/
public static CLI_VERSION_WITH_WORKSPACE_RFERENCES = new SemVer("2.11.3");
/**
* CLI version that supports the `--kind` option for the `resolve qlpacks` command.
*/
public static CLI_VERSION_WITH_QLPACKS_KIND = new SemVer("2.12.3");
/**
* CLI version that supports the `--additional-packs` option for the `pack install` command.
*/
public static CLI_VERSION_WITH_ADDITIONAL_PACKS_INSTALL = new SemVer(
"2.12.4",
);
public static CLI_VERSION_GLOBAL_CACHE = new SemVer("2.12.4");
/**
* CLI version where the query server supports quick-eval count mode.
*/
public static CLI_VERSION_WITH_QUICK_EVAL_COUNT = new SemVer("2.13.3");
public static OLDEST_SUPPORTED_CLI_VERSION = new SemVer("2.13.5");
/**
* CLI version where the `generate extensible-predicate-metadata`
@@ -1788,6 +1742,15 @@ export class CliVersionConstraint {
*/
public static CLI_VERSION_WITH_TRIM_CACHE = new SemVer("2.15.1");
public static CLI_VERSION_WITHOUT_MRVA_EXTENSIBLE_PREDICATE_HACK = new SemVer(
"2.16.1",
);
/**
* CLI version where there is support for multiple queries on the pack create command.
*/
public static CLI_VERSION_WITH_MULTI_QUERY_PACK_CREATE = new SemVer("2.16.1");
constructor(private readonly cli: CodeQLCliServer) {
/**/
}
@@ -1796,81 +1759,32 @@ export class CliVersionConstraint {
return (await this.cli.getVersion()).compare(v) >= 0;
}
async supportsQlxRemote() {
return this.isVersionAtLeast(CliVersionConstraint.CLI_VERSION_QLX_REMOTE);
}
async supportsPreciseResolveMlModels() {
return this.isVersionAtLeast(
CliVersionConstraint.CLI_VERSION_WITH_PRECISE_RESOLVE_ML_MODELS,
);
}
async supportsResolveExtensions() {
return this.isVersionAtLeast(
CliVersionConstraint.CLI_VERSION_WITH_RESOLVE_EXTENSIONS,
);
}
async supportsSourceMap() {
return this.isVersionAtLeast(
CliVersionConstraint.CLI_VERSION_WITH_SOURCEMAP,
);
}
async supportsNewQueryServer() {
// This allows users to explicitly opt-out of the new query server.
return (
allowCanaryQueryServer() &&
this.isVersionAtLeast(
CliVersionConstraint.CLI_VERSION_WITH_NEW_QUERY_SERVER,
)
);
}
async supportsNewQueryServerForTests() {
return this.isVersionAtLeast(
CliVersionConstraint.CLI_VERSION_WITH_NEW_QUERY_SERVER,
);
}
async supportsWorkspaceReferences() {
return this.isVersionAtLeast(
CliVersionConstraint.CLI_VERSION_WITH_WORKSPACE_RFERENCES,
);
}
async supportsQlpacksKind() {
return this.isVersionAtLeast(
CliVersionConstraint.CLI_VERSION_WITH_QLPACKS_KIND,
);
}
async supportsAdditionalPacksInstall() {
return this.isVersionAtLeast(
CliVersionConstraint.CLI_VERSION_WITH_ADDITIONAL_PACKS_INSTALL,
);
}
async usesGlobalCompilationCache() {
return this.isVersionAtLeast(CliVersionConstraint.CLI_VERSION_GLOBAL_CACHE);
}
async supportsVisibilityNotifications() {
return this.isVersionAtLeast(
CliVersionConstraint.CLI_VERSION_WITH_VISIBILITY_NOTIFICATIONS,
);
}
async supportsQuickEvalCount() {
return this.isVersionAtLeast(
CliVersionConstraint.CLI_VERSION_WITH_QUICK_EVAL_COUNT,
);
}
async supportsGenerateExtensiblePredicateMetadata() {
return this.isVersionAtLeast(
CliVersionConstraint.CLI_VERSION_WITH_EXTENSIBLE_PREDICATE_METADATA,
);
}
async preservesExtensiblePredicatesInMrvaPack() {
// Negated, because we _stopped_ preserving these in 2.16.1.
return !(await this.isVersionAtLeast(
CliVersionConstraint.CLI_VERSION_WITHOUT_MRVA_EXTENSIBLE_PREDICATE_HACK,
));
}
async supportsPackCreateWithMultipleQueries() {
return this.isVersionAtLeast(
CliVersionConstraint.CLI_VERSION_WITH_MULTI_QUERY_PACK_CREATE,
);
}
async supportsMrvaPackCreate(): Promise<boolean> {
return (await this.cli.getFeatures()).mrvaPackCreate === true;
}
}

View File

@@ -1,21 +1,18 @@
import * as fetch from "node-fetch";
import { pathExists, mkdtemp, createWriteStream, remove } from "fs-extra";
import type { WriteStream } from "fs";
import { createWriteStream, mkdtemp, pathExists, remove } from "fs-extra";
import { tmpdir } from "os";
import { delimiter, dirname, join } from "path";
import * as semver from "semver";
import { URL } from "url";
import { ExtensionContext, Event } from "vscode";
import { DistributionConfig } from "../config";
import { Range, satisfies } from "semver";
import type { Event, ExtensionContext } from "vscode";
import type { DistributionConfig } from "../config";
import { extLogger } from "../common/logging/vscode";
import type { VersionAndFeatures } from "./cli-version";
import { getCodeQlCliVersion } from "./cli-version";
import {
ProgressCallback,
reportStreamProgress,
} from "../common/vscode/progress";
import type { ProgressCallback } from "../common/vscode/progress";
import { reportStreamProgress } from "../common/vscode/progress";
import {
codeQlLauncherName,
deprecatedCodeQlLauncherName,
extractZipArchive,
getRequiredAssetName,
} from "../common/distribution";
import {
@@ -26,6 +23,12 @@ import {
showAndLogErrorMessage,
showAndLogWarningMessage,
} from "../common/logging";
import { unzipToDirectoryConcurrently } from "../common/unzip-concurrently";
import { reportUnzipProgress } from "../common/vscode/unzip-progress";
import type { Release } from "./distribution/release";
import { ReleasesApiConsumer } from "./distribution/releases-api-consumer";
import { createTimeoutSignal } from "../common/fetch-stream";
import { AbortError } from "node-fetch";
/**
* distribution.ts
@@ -35,28 +38,21 @@ import {
*/
/**
* Default value for the owner name of the extension-managed distribution on GitHub.
*
* We set the default here rather than as a default config value so that this default is invoked
* upon blanking the setting.
* Repository name with owner of the stable version of the extension-managed distribution on GitHub.
*/
const DEFAULT_DISTRIBUTION_OWNER_NAME = "github";
const STABLE_DISTRIBUTION_REPOSITORY_NWO = "github/codeql-cli-binaries";
/**
* Default value for the repository name of the extension-managed distribution on GitHub.
*
* We set the default here rather than as a default config value so that this default is invoked
* upon blanking the setting.
* Repository name with owner of the nightly version of the extension-managed distribution on GitHub.
*/
const DEFAULT_DISTRIBUTION_REPOSITORY_NAME = "codeql-cli-binaries";
const NIGHTLY_DISTRIBUTION_REPOSITORY_NWO = "dsp-testing/codeql-cli-nightlies";
/**
* Range of versions of the CLI that are compatible with the extension.
*
* This applies to both extension-managed and CLI distributions.
*/
export const DEFAULT_DISTRIBUTION_VERSION_RANGE: semver.Range =
new semver.Range("2.x");
export const DEFAULT_DISTRIBUTION_VERSION_RANGE: Range = new Range("2.x");
export interface DistributionProvider {
getCodeQlPathWithoutVersionCheck(): Promise<string | undefined>;
@@ -67,7 +63,7 @@ export interface DistributionProvider {
export class DistributionManager implements DistributionProvider {
constructor(
public readonly config: DistributionConfig,
private readonly versionRange: semver.Range,
private readonly versionRange: Range,
extensionContext: ExtensionContext,
) {
this._onDidChangeDistribution = config.onDidChangeConfiguration;
@@ -95,11 +91,11 @@ export class DistributionManager implements DistributionProvider {
kind: FindDistributionResultKind.NoDistribution,
};
}
const version = await getCodeQlCliVersion(
const versionAndFeatures = await getCodeQlCliVersion(
distribution.codeQlPath,
extLogger,
);
if (version === undefined) {
if (versionAndFeatures === undefined) {
return {
distribution,
kind: FindDistributionResultKind.UnknownCompatibilityDistribution,
@@ -126,17 +122,21 @@ export class DistributionManager implements DistributionProvider {
distribution.kind !== DistributionKind.ExtensionManaged ||
this.config.includePrerelease;
if (!semver.satisfies(version, this.versionRange, { includePrerelease })) {
if (
!satisfies(versionAndFeatures.version, this.versionRange, {
includePrerelease,
})
) {
return {
distribution,
kind: FindDistributionResultKind.IncompatibleDistribution,
version,
versionAndFeatures,
};
}
return {
distribution,
kind: FindDistributionResultKind.CompatibleDistribution,
version,
versionAndFeatures,
};
}
@@ -195,9 +195,8 @@ export class DistributionManager implements DistributionProvider {
if (process.env.PATH) {
for (const searchDirectory of process.env.PATH.split(delimiter)) {
const expectedLauncherPath = await getExecutableFromDirectory(
searchDirectory,
);
const expectedLauncherPath =
await getExecutableFromDirectory(searchDirectory);
if (expectedLauncherPath) {
return {
codeQlPath: expectedLauncherPath,
@@ -284,7 +283,7 @@ export class DistributionManager implements DistributionProvider {
class ExtensionSpecificDistributionManager {
constructor(
private readonly config: DistributionConfig,
private readonly versionRange: semver.Range,
private readonly versionRange: Range,
private readonly extensionContext: ExtensionContext,
) {
/**/
@@ -388,15 +387,25 @@ class ExtensionSpecificDistributionManager {
);
}
const assetStream =
await this.createReleasesApiConsumer().streamBinaryContentOfAsset(
assets[0],
);
const {
signal,
onData,
dispose: disposeTimeout,
} = createTimeoutSignal(this.config.downloadTimeout);
const tmpDirectory = await mkdtemp(join(tmpdir(), "vscode-codeql"));
let archiveFile: WriteStream | undefined = undefined;
try {
const assetStream =
await this.createReleasesApiConsumer().streamBinaryContentOfAsset(
assets[0],
signal,
);
const archivePath = join(tmpDirectory, "distributionDownload.zip");
const archiveFile = createWriteStream(archivePath);
archiveFile = createWriteStream(archivePath);
const contentLength = assetStream.headers.get("content-length");
const totalNumBytes = contentLength
@@ -409,20 +418,52 @@ class ExtensionSpecificDistributionManager {
progressCallback,
);
await new Promise((resolve, reject) =>
assetStream.body.on("data", onData);
await new Promise((resolve, reject) => {
if (!archiveFile) {
throw new Error("Invariant violation: archiveFile not set");
}
assetStream.body
.pipe(archiveFile)
.on("finish", resolve)
.on("error", reject),
);
.on("error", reject);
// If an error occurs on the body, we also want to reject the promise (e.g. during a timeout error).
assetStream.body.on("error", reject);
});
disposeTimeout();
await this.bumpDistributionFolderIndex();
void extLogger.log(
`Extracting CodeQL CLI to ${this.getDistributionStoragePath()}`,
);
await extractZipArchive(archivePath, this.getDistributionStoragePath());
await unzipToDirectoryConcurrently(
archivePath,
this.getDistributionStoragePath(),
progressCallback
? reportUnzipProgress(
`Extracting CodeQL CLI ${release.name}`,
progressCallback,
)
: undefined,
);
} catch (e) {
if (e instanceof AbortError) {
const thrownError = new AbortError("The download timed out.");
thrownError.stack = e.stack;
throw thrownError;
}
throw e;
} finally {
disposeTimeout();
archiveFile?.close();
await remove(tmpDirectory);
}
}
@@ -444,9 +485,18 @@ class ExtensionSpecificDistributionManager {
void extLogger.log(
`Searching for latest release including ${requiredAssetName}.`,
);
const versionRange = this.usingNightlyReleases
? undefined
: this.versionRange;
const orderBySemver = !this.usingNightlyReleases;
const includePrerelease =
this.usingNightlyReleases || this.config.includePrerelease;
return this.createReleasesApiConsumer().getLatestRelease(
this.versionRange,
this.config.includePrerelease,
versionRange,
orderBySemver,
includePrerelease,
(release) => {
// v2.12.3 was released with a bug that causes the extension to fail
// so we force the extension to ignore it.
@@ -476,19 +526,26 @@ class ExtensionSpecificDistributionManager {
}
private createReleasesApiConsumer(): ReleasesApiConsumer {
const ownerName = this.config.ownerName
? this.config.ownerName
: DEFAULT_DISTRIBUTION_OWNER_NAME;
const repositoryName = this.config.repositoryName
? this.config.repositoryName
: DEFAULT_DISTRIBUTION_REPOSITORY_NAME;
return new ReleasesApiConsumer(
ownerName,
repositoryName,
this.distributionRepositoryNwo,
this.config.personalAccessToken,
);
}
private get distributionRepositoryNwo(): string {
if (this.config.channel === "nightly") {
return NIGHTLY_DISTRIBUTION_REPOSITORY_NWO;
} else {
return STABLE_DISTRIBUTION_REPOSITORY_NWO;
}
}
private get usingNightlyReleases(): boolean {
return (
this.distributionRepositoryNwo === NIGHTLY_DISTRIBUTION_REPOSITORY_NWO
);
}
private async bumpDistributionFolderIndex(): Promise<void> {
const index = this.extensionContext.globalState.get(
ExtensionSpecificDistributionManager._currentDistributionFolderIndexStateKey,
@@ -543,171 +600,6 @@ class ExtensionSpecificDistributionManager {
private static readonly _codeQlExtractedFolderName = "codeql";
}
export class ReleasesApiConsumer {
constructor(
ownerName: string,
repoName: string,
personalAccessToken?: string,
) {
// Specify version of the GitHub API
this._defaultHeaders["accept"] = "application/vnd.github.v3+json";
if (personalAccessToken) {
this._defaultHeaders["authorization"] = `token ${personalAccessToken}`;
}
this._ownerName = ownerName;
this._repoName = repoName;
}
public async getLatestRelease(
versionRange: semver.Range,
includePrerelease = false,
additionalCompatibilityCheck?: (release: GithubRelease) => boolean,
): Promise<Release> {
const apiPath = `/repos/${this._ownerName}/${this._repoName}/releases`;
const allReleases: GithubRelease[] = await (
await this.makeApiCall(apiPath)
).json();
const compatibleReleases = allReleases.filter((release) => {
if (release.prerelease && !includePrerelease) {
return false;
}
const version = semver.parse(release.tag_name);
if (
version === null ||
!semver.satisfies(version, versionRange, { includePrerelease })
) {
return false;
}
return (
!additionalCompatibilityCheck || additionalCompatibilityCheck(release)
);
});
// Tag names must all be parsable to semvers due to the previous filtering step.
const latestRelease = compatibleReleases.sort((a, b) => {
const versionComparison = semver.compare(
semver.parse(b.tag_name)!,
semver.parse(a.tag_name)!,
);
if (versionComparison !== 0) {
return versionComparison;
}
return b.created_at.localeCompare(a.created_at, "en-US");
})[0];
if (latestRelease === undefined) {
throw new Error(
"No compatible CodeQL CLI releases were found. " +
"Please check that the CodeQL extension is up to date.",
);
}
const assets: ReleaseAsset[] = latestRelease.assets.map((asset) => {
return {
id: asset.id,
name: asset.name,
size: asset.size,
};
});
return {
assets,
createdAt: latestRelease.created_at,
id: latestRelease.id,
name: latestRelease.name,
};
}
public async streamBinaryContentOfAsset(
asset: ReleaseAsset,
): Promise<fetch.Response> {
const apiPath = `/repos/${this._ownerName}/${this._repoName}/releases/assets/${asset.id}`;
return await this.makeApiCall(apiPath, {
accept: "application/octet-stream",
});
}
protected async makeApiCall(
apiPath: string,
additionalHeaders: { [key: string]: string } = {},
): Promise<fetch.Response> {
const response = await this.makeRawRequest(
ReleasesApiConsumer._apiBase + apiPath,
Object.assign({}, this._defaultHeaders, additionalHeaders),
);
if (!response.ok) {
// Check for rate limiting
const rateLimitResetValue = response.headers.get("X-RateLimit-Reset");
if (response.status === 403 && rateLimitResetValue) {
const secondsToMillisecondsFactor = 1000;
const rateLimitResetDate = new Date(
parseInt(rateLimitResetValue, 10) * secondsToMillisecondsFactor,
);
throw new GithubRateLimitedError(
response.status,
await response.text(),
rateLimitResetDate,
);
}
throw new GithubApiError(response.status, await response.text());
}
return response;
}
private async makeRawRequest(
requestUrl: string,
headers: { [key: string]: string },
redirectCount = 0,
): Promise<fetch.Response> {
const response = await fetch.default(requestUrl, {
headers,
redirect: "manual",
});
const redirectUrl = response.headers.get("location");
if (
isRedirectStatusCode(response.status) &&
redirectUrl &&
redirectCount < ReleasesApiConsumer._maxRedirects
) {
const parsedRedirectUrl = new URL(redirectUrl);
if (parsedRedirectUrl.protocol !== "https:") {
throw new Error("Encountered a non-https redirect, rejecting");
}
if (parsedRedirectUrl.host !== "api.github.com") {
// Remove authorization header if we are redirected outside of the GitHub API.
//
// This is necessary to stream release assets since AWS fails if more than one auth
// mechanism is provided.
delete headers["authorization"];
}
return await this.makeRawRequest(redirectUrl, headers, redirectCount + 1);
}
return response;
}
private readonly _defaultHeaders: { [key: string]: string } = {};
private readonly _ownerName: string;
private readonly _repoName: string;
private static readonly _apiBase = "https://api.github.com";
private static readonly _maxRedirects = 20;
}
function isRedirectStatusCode(statusCode: number): boolean {
return (
statusCode === 301 ||
statusCode === 302 ||
statusCode === 303 ||
statusCode === 307 ||
statusCode === 308
);
}
/*
* Types and helper functions relating to those types.
*/
@@ -747,7 +639,7 @@ interface DistributionResult {
interface CompatibleDistributionResult extends DistributionResult {
kind: FindDistributionResultKind.CompatibleDistribution;
version: semver.SemVer;
versionAndFeatures: VersionAndFeatures;
}
interface UnknownCompatibilityDistributionResult extends DistributionResult {
@@ -756,7 +648,7 @@ interface UnknownCompatibilityDistributionResult extends DistributionResult {
interface IncompatibleDistributionResult extends DistributionResult {
kind: FindDistributionResultKind.IncompatibleDistribution;
version: semver.SemVer;
versionAndFeatures: VersionAndFeatures;
}
interface NoDistributionResult {
@@ -858,116 +750,3 @@ function warnDeprecatedLauncher() {
`Please use "${codeQlLauncherName()}" instead. It is recommended to update to the latest CodeQL binaries.`,
);
}
/**
* A release on GitHub.
*/
interface Release {
assets: ReleaseAsset[];
/**
* The creation date of the release on GitHub.
*/
createdAt: string;
/**
* The id associated with the release on GitHub.
*/
id: number;
/**
* The name associated with the release on GitHub.
*/
name: string;
}
/**
* An asset corresponding to a release on GitHub.
*/
interface ReleaseAsset {
/**
* The id associated with the asset on GitHub.
*/
id: number;
/**
* The name associated with the asset on GitHub.
*/
name: string;
/**
* The size of the asset in bytes.
*/
size: number;
}
/**
* The json returned from github for a release.
*/
export interface GithubRelease {
assets: GithubReleaseAsset[];
/**
* The creation date of the release on GitHub, in ISO 8601 format.
*/
created_at: string;
/**
* The id associated with the release on GitHub.
*/
id: number;
/**
* The name associated with the release on GitHub.
*/
name: string;
/**
* Whether the release is a prerelease.
*/
prerelease: boolean;
/**
* The tag name. This should be the version.
*/
tag_name: string;
}
/**
* The json returned by github for an asset in a release.
*/
export interface GithubReleaseAsset {
/**
* The id associated with the asset on GitHub.
*/
id: number;
/**
* The name associated with the asset on GitHub.
*/
name: string;
/**
* The size of the asset in bytes.
*/
size: number;
}
export class GithubApiError extends Error {
constructor(
public status: number,
public body: string,
) {
super(`API call failed with status code ${status}, body: ${body}`);
}
}
export class GithubRateLimitedError extends GithubApiError {
constructor(
public status: number,
public body: string,
public rateLimitResetDate: Date,
) {
super(status, body);
}
}

View File

@@ -0,0 +1,18 @@
export class GithubApiError extends Error {
constructor(
public status: number,
public body: string,
) {
super(`API call failed with status code ${status}, body: ${body}`);
}
}
export class GithubRateLimitedError extends GithubApiError {
constructor(
public status: number,
public body: string,
public rateLimitResetDate: Date,
) {
super(status, body);
}
}

View File

@@ -0,0 +1,48 @@
/**
* A release of the CodeQL CLI hosted on GitHub.
*/
export interface Release {
/**
* The assets associated with the release on GitHub.
*/
assets: ReleaseAsset[];
/**
* The creation date of the release on GitHub.
*
* This is the date that the release was uploaded to GitHub, and not the date
* when we downloaded it or the date when we fetched the data from the GitHub API.
*/
createdAt: string;
/**
* The id associated with the release on GitHub.
*/
id: number;
/**
* The name associated with the release on GitHub.
*/
name: string;
}
/**
* An asset attached to a release on GitHub.
* Each release may have multiple assets, and each asset can be downloaded independently.
*/
export interface ReleaseAsset {
/**
* The id associated with the asset on GitHub.
*/
id: number;
/**
* The name associated with the asset on GitHub.
*/
name: string;
/**
* The size of the asset in bytes.
*/
size: number;
}

View File

@@ -0,0 +1,212 @@
import type { Response } from "node-fetch";
import { default as fetch } from "node-fetch";
import type { Range } from "semver";
import { compare, parse, satisfies } from "semver";
import { URL } from "url";
import type { Release, ReleaseAsset } from "./release";
import { GithubApiError, GithubRateLimitedError } from "./github-api-error";
/**
* Communicates with the GitHub API to determine the latest compatible release and download assets.
*/
export class ReleasesApiConsumer {
private static readonly apiBase = "https://api.github.com";
private static readonly maxRedirects = 20;
private readonly defaultHeaders: { [key: string]: string } = {};
constructor(
private readonly repositoryNwo: string,
personalAccessToken?: string,
) {
// Specify version of the GitHub API
this.defaultHeaders["accept"] = "application/vnd.github.v3+json";
if (personalAccessToken) {
this.defaultHeaders["authorization"] = `token ${personalAccessToken}`;
}
}
public async getLatestRelease(
versionRange: Range | undefined,
orderBySemver = true,
includePrerelease = false,
additionalCompatibilityCheck?: (release: GithubRelease) => boolean,
): Promise<Release> {
const apiPath = `/repos/${this.repositoryNwo}/releases`;
const allReleases: GithubRelease[] = await (
await this.makeApiCall(apiPath)
).json();
const compatibleReleases = allReleases.filter((release) => {
if (release.prerelease && !includePrerelease) {
return false;
}
if (versionRange !== undefined) {
const version = parse(release.tag_name);
if (
version === null ||
!satisfies(version, versionRange, { includePrerelease })
) {
return false;
}
}
return (
!additionalCompatibilityCheck || additionalCompatibilityCheck(release)
);
});
// Tag names must all be parsable to semvers due to the previous filtering step.
const latestRelease = compatibleReleases.sort((a, b) => {
const versionComparison = orderBySemver
? compare(parse(b.tag_name)!, parse(a.tag_name)!)
: b.id - a.id;
if (versionComparison !== 0) {
return versionComparison;
}
return b.created_at.localeCompare(a.created_at, "en-US");
})[0];
if (latestRelease === undefined) {
throw new Error(
"No compatible CodeQL CLI releases were found. " +
"Please check that the CodeQL extension is up to date.",
);
}
const assets: ReleaseAsset[] = latestRelease.assets.map((asset) => {
return {
id: asset.id,
name: asset.name,
size: asset.size,
};
});
return {
assets,
createdAt: latestRelease.created_at,
id: latestRelease.id,
name: latestRelease.name,
};
}
public async streamBinaryContentOfAsset(
asset: ReleaseAsset,
signal?: AbortSignal,
): Promise<Response> {
const apiPath = `/repos/${this.repositoryNwo}/releases/assets/${asset.id}`;
return await this.makeApiCall(
apiPath,
{
accept: "application/octet-stream",
},
signal,
);
}
protected async makeApiCall(
apiPath: string,
additionalHeaders: { [key: string]: string } = {},
signal?: AbortSignal,
): Promise<Response> {
const response = await this.makeRawRequest(
ReleasesApiConsumer.apiBase + apiPath,
Object.assign({}, this.defaultHeaders, additionalHeaders),
signal,
);
if (!response.ok) {
// Check for rate limiting
const rateLimitResetValue = response.headers.get("X-RateLimit-Reset");
if (response.status === 403 && rateLimitResetValue) {
const secondsToMillisecondsFactor = 1000;
const rateLimitResetDate = new Date(
parseInt(rateLimitResetValue, 10) * secondsToMillisecondsFactor,
);
throw new GithubRateLimitedError(
response.status,
await response.text(),
rateLimitResetDate,
);
}
throw new GithubApiError(response.status, await response.text());
}
return response;
}
private async makeRawRequest(
requestUrl: string,
headers: { [key: string]: string },
signal?: AbortSignal,
redirectCount = 0,
): Promise<Response> {
const response = await fetch(requestUrl, {
headers,
redirect: "manual",
signal,
});
const redirectUrl = response.headers.get("location");
if (
isRedirectStatusCode(response.status) &&
redirectUrl &&
redirectCount < ReleasesApiConsumer.maxRedirects
) {
const parsedRedirectUrl = new URL(redirectUrl);
if (parsedRedirectUrl.protocol !== "https:") {
throw new Error("Encountered a non-https redirect, rejecting");
}
if (parsedRedirectUrl.host !== "api.github.com") {
// Remove authorization header if we are redirected outside of the GitHub API.
//
// This is necessary to stream release assets since AWS fails if more than one auth
// mechanism is provided.
delete headers["authorization"];
}
return await this.makeRawRequest(
redirectUrl,
headers,
signal,
redirectCount + 1,
);
}
return response;
}
}
function isRedirectStatusCode(statusCode: number): boolean {
return (
statusCode === 301 ||
statusCode === 302 ||
statusCode === 303 ||
statusCode === 307 ||
statusCode === 308
);
}
/**
* The json returned from github for a release.
* See https://docs.github.com/en/rest/releases/releases#get-a-release for example response and response schema.
*
* This type must match the format of the GitHub API and is not intended to be used outside of this file except for tests. Please use the `Release` type instead.
*/
export interface GithubRelease {
assets: GithubReleaseAsset[];
created_at: string;
id: number;
name: string;
prerelease: boolean;
tag_name: string;
}
/**
* The json returned by github for an asset in a release.
* See https://docs.github.com/en/rest/releases/releases#get-a-release for example response and response schema.
*
* This type must match the format of the GitHub API and is not intended to be used outside of this file except for tests. Please use the `ReleaseAsset` type instead.
*/
interface GithubReleaseAsset {
id: number;
name: string;
size: number;
}

View File

@@ -1,5 +1,6 @@
import { CodeQLCliServer } from "./cli";
import { Uri, window } from "vscode";
import type { CodeQLCliServer } from "./cli";
import type { Uri } from "vscode";
import { window } from "vscode";
import {
getLanguageDisplayName,
isQueryLanguage,
@@ -62,7 +63,7 @@ export async function askForLanguage(
.sort((a, b) => a.label.localeCompare(b.label));
const selectedItem = await window.showQuickPick(items, {
placeHolder: "Select target language for your query",
placeHolder: "Select target query language",
ignoreFocusOut: true,
});
if (!selectedItem) {

View File

@@ -1,5 +1,5 @@
import { CodeQLCliServer } from "./cli";
import { QueryMetadata } from "../common/interface-types";
import type { CodeQLCliServer } from "./cli";
import type { QueryMetadata } from "../common/interface-types";
import { extLogger } from "../common/logging/vscode";
/**

View File

@@ -1,10 +1,10 @@
import { Credentials } from "./authentication";
import { Disposable } from "./disposable-object";
import { AppEventEmitter } from "./events";
import { NotificationLogger } from "./logging";
import { Memento } from "./memento";
import { AppCommandManager } from "./commands";
import { AppTelemetry } from "./telemetry";
import type { Credentials } from "./authentication";
import type { Disposable } from "./disposable-object";
import type { AppEventEmitter } from "./events";
import type { NotificationLogger } from "./logging";
import type { Memento } from "./memento";
import type { AppCommandManager } from "./commands";
import type { AppTelemetry } from "./telemetry";
export interface App {
createEventEmitter<T>(): AppEventEmitter<T>;

View File

@@ -1,4 +1,4 @@
import * as Octokit from "@octokit/rest";
import type { Octokit } from "@octokit/rest";
/**
* An interface providing methods for obtaining access tokens
@@ -12,7 +12,7 @@ export interface Credentials {
*
* @returns An instance of Octokit.
*/
getOctokit(): Promise<Octokit.Octokit>;
getOctokit(): Promise<Octokit>;
/**
* Returns an OAuth access token.

View File

@@ -4,7 +4,7 @@
* the "for the sake of extensibility" comment in messages.ts.
*/
// eslint-disable-next-line @typescript-eslint/no-namespace
export namespace ColumnKindCode {
export namespace BqrsColumnKindCode {
export const FLOAT = "f";
export const INTEGER = "i";
export const STRING = "s";
@@ -13,55 +13,44 @@ export namespace ColumnKindCode {
export const ENTITY = "e";
}
type ColumnKind =
| typeof ColumnKindCode.FLOAT
| typeof ColumnKindCode.INTEGER
| typeof ColumnKindCode.STRING
| typeof ColumnKindCode.BOOLEAN
| typeof ColumnKindCode.DATE
| typeof ColumnKindCode.ENTITY;
export type BqrsColumnKind =
| typeof BqrsColumnKindCode.FLOAT
| typeof BqrsColumnKindCode.INTEGER
| typeof BqrsColumnKindCode.STRING
| typeof BqrsColumnKindCode.BOOLEAN
| typeof BqrsColumnKindCode.DATE
| typeof BqrsColumnKindCode.ENTITY;
export interface Column {
export interface BqrsSchemaColumn {
name?: string;
kind: ColumnKind;
kind: BqrsColumnKind;
}
export interface ResultSetSchema {
export interface BqrsResultSetSchema {
name: string;
rows: number;
columns: Column[];
pagination?: PaginationInfo;
columns: BqrsSchemaColumn[];
pagination?: BqrsPaginationInfo;
}
export function getResultSetSchema(
resultSetName: string,
resultSets: BQRSInfo,
): ResultSetSchema | undefined {
for (const schema of resultSets["result-sets"]) {
if (schema.name === resultSetName) {
return schema;
}
}
return undefined;
}
interface PaginationInfo {
interface BqrsPaginationInfo {
"step-size": number;
offsets: number[];
}
export interface BQRSInfo {
"result-sets": ResultSetSchema[];
export interface BqrsInfo {
"result-sets": BqrsResultSetSchema[];
}
export type BqrsId = number;
export interface EntityValue {
url?: UrlValue;
export interface BqrsEntityValue {
url?: BqrsUrlValue;
label?: string;
id?: BqrsId;
}
export interface LineColumnLocation {
export interface BqrsLineColumnLocation {
uri: string;
startLine: number;
startColumn: number;
@@ -69,7 +58,7 @@ export interface LineColumnLocation {
endColumn: number;
}
export interface WholeFileLocation {
export interface BqrsWholeFileLocation {
uri: string;
startLine: never;
startColumn: never;
@@ -77,37 +66,17 @@ export interface WholeFileLocation {
endColumn: never;
}
export type ResolvableLocationValue = WholeFileLocation | LineColumnLocation;
export type BqrsUrlValue =
| BqrsWholeFileLocation
| BqrsLineColumnLocation
| string;
export type UrlValue = ResolvableLocationValue | string;
export type CellValue = EntityValue | number | string | boolean;
export type ResultRow = CellValue[];
export interface RawResultSet {
readonly schema: ResultSetSchema;
readonly rows: readonly ResultRow[];
}
// TODO: This function is not necessary. It generates a tuple that is slightly easier
// to handle than the ResultSetSchema and DecodedBqrsChunk. But perhaps it is unnecessary
// boilerplate.
export function transformBqrsResultSet(
schema: ResultSetSchema,
page: DecodedBqrsChunk,
): RawResultSet {
return {
schema,
rows: Array.from(page.tuples),
};
}
export type BqrsCellValue = BqrsEntityValue | number | string | boolean;
export type BqrsKind =
| "String"
| "Float"
| "Integer"
| "String"
| "Boolean"
| "Date"
| "Entity";
@@ -116,8 +85,9 @@ interface BqrsColumn {
name?: string;
kind: BqrsKind;
}
export interface DecodedBqrsChunk {
tuples: CellValue[][];
tuples: BqrsCellValue[][];
next?: number;
columns: BqrsColumn[];
}

View File

@@ -0,0 +1,216 @@
import type {
BqrsCellValue as BqrsCellValue,
BqrsColumnKind as BqrsColumnKind,
DecodedBqrsChunk,
BqrsEntityValue as BqrsEntityValue,
BqrsLineColumnLocation,
BqrsResultSetSchema,
BqrsUrlValue as BqrsUrlValue,
BqrsWholeFileLocation,
BqrsSchemaColumn,
} from "./bqrs-cli-types";
import { BqrsColumnKindCode } from "./bqrs-cli-types";
import type {
CellValue,
Column,
EntityValue,
RawResultSet,
Row,
UrlValue,
UrlValueResolvable,
} from "./raw-result-types";
import { ColumnKind } from "./raw-result-types";
import { assertNever } from "./helpers-pure";
import { isEmptyPath } from "./bqrs-utils";
export function bqrsToResultSet(
schema: BqrsResultSetSchema,
chunk: DecodedBqrsChunk,
): RawResultSet {
const name = schema.name;
const totalRowCount = schema.rows;
const columns = schema.columns.map(mapColumn);
const rows = chunk.tuples.map(
(tuple): Row => tuple.map((cell): CellValue => mapCellValue(cell)),
);
const resultSet: RawResultSet = {
name,
totalRowCount,
columns,
rows,
};
if (chunk.next) {
resultSet.nextPageOffset = chunk.next;
}
return resultSet;
}
function mapColumn(column: BqrsSchemaColumn): Column {
const result: Column = {
kind: mapColumnKind(column.kind),
};
if (column.name) {
result.name = column.name;
}
return result;
}
function mapColumnKind(kind: BqrsColumnKind): ColumnKind {
switch (kind) {
case BqrsColumnKindCode.STRING:
return ColumnKind.String;
case BqrsColumnKindCode.FLOAT:
return ColumnKind.Float;
case BqrsColumnKindCode.INTEGER:
return ColumnKind.Integer;
case BqrsColumnKindCode.BOOLEAN:
return ColumnKind.Boolean;
case BqrsColumnKindCode.DATE:
return ColumnKind.Date;
case BqrsColumnKindCode.ENTITY:
return ColumnKind.Entity;
default:
assertNever(kind);
}
}
function mapCellValue(cellValue: BqrsCellValue): CellValue {
switch (typeof cellValue) {
case "string":
return {
type: "string",
value: cellValue,
};
case "number":
return {
type: "number",
value: cellValue,
};
case "boolean":
return {
type: "boolean",
value: cellValue,
};
case "object":
return {
type: "entity",
value: mapEntityValue(cellValue),
};
}
}
function mapEntityValue(cellValue: BqrsEntityValue): EntityValue {
const result: EntityValue = {};
if (cellValue.id) {
result.id = cellValue.id;
}
if (cellValue.label) {
result.label = cellValue.label;
}
if (cellValue.url) {
result.url = mapUrlValue(cellValue.url);
}
return result;
}
export function mapUrlValue(urlValue: BqrsUrlValue): UrlValue | undefined {
if (typeof urlValue === "string") {
const location = tryGetLocationFromString(urlValue);
if (location !== undefined) {
return location;
}
return {
type: "string",
value: urlValue,
};
}
if (isWholeFileLoc(urlValue)) {
return {
type: "wholeFileLocation",
uri: urlValue.uri,
};
}
if (isLineColumnLoc(urlValue)) {
return {
type: "lineColumnLocation",
uri: urlValue.uri,
startLine: urlValue.startLine,
startColumn: urlValue.startColumn,
endLine: urlValue.endLine,
endColumn: urlValue.endColumn,
};
}
return undefined;
}
function isLineColumnLoc(loc: BqrsUrlValue): loc is BqrsLineColumnLocation {
return (
typeof loc !== "string" &&
!isEmptyPath(loc.uri) &&
"startLine" in loc &&
"startColumn" in loc &&
"endLine" in loc &&
"endColumn" in loc
);
}
function isWholeFileLoc(loc: BqrsUrlValue): loc is BqrsWholeFileLocation {
return (
typeof loc !== "string" && !isEmptyPath(loc.uri) && !isLineColumnLoc(loc)
);
}
/**
* The CodeQL filesystem libraries use this pattern in `getURL()` predicates
* to describe the location of an entire filesystem resource.
* Such locations appear as `StringLocation`s instead of `FivePartLocation`s.
*
* Folder resources also get similar URLs, but with the `folder` scheme.
* They are deliberately ignored here, since there is no suitable location to show the user.
*/
const FILE_LOCATION_REGEX = /file:\/\/(.+):([0-9]+):([0-9]+):([0-9]+):([0-9]+)/;
function tryGetLocationFromString(loc: string): UrlValueResolvable | undefined {
const matches = FILE_LOCATION_REGEX.exec(loc);
if (matches && matches.length > 1 && matches[1]) {
if (isWholeFileMatch(matches)) {
return {
type: "wholeFileLocation",
uri: matches[1],
};
} else {
return {
type: "lineColumnLocation",
uri: matches[1],
startLine: Number(matches[2]),
startColumn: Number(matches[3]),
endLine: Number(matches[4]),
endColumn: Number(matches[5]),
};
}
}
return undefined;
}
function isWholeFileMatch(matches: RegExpExecArray): boolean {
return (
matches[2] === "0" &&
matches[3] === "0" &&
matches[4] === "0" &&
matches[5] === "0"
);
}

View File

@@ -1,111 +1,21 @@
import {
UrlValue,
ResolvableLocationValue,
LineColumnLocation,
WholeFileLocation,
} from "./bqrs-cli-types";
import { createRemoteFileRef } from "../common/location-link-utils";
/**
* The CodeQL filesystem libraries use this pattern in `getURL()` predicates
* to describe the location of an entire filesystem resource.
* Such locations appear as `StringLocation`s instead of `FivePartLocation`s.
*
* Folder resources also get similar URLs, but with the `folder` scheme.
* They are deliberately ignored here, since there is no suitable location to show the user.
*/
const FILE_LOCATION_REGEX = /file:\/\/(.+):([0-9]+):([0-9]+):([0-9]+):([0-9]+)/;
/**
* Gets a resolvable source file location for the specified `LocationValue`, if possible.
* @param loc The location to test.
*/
export function tryGetResolvableLocation(
loc: UrlValue | undefined,
): ResolvableLocationValue | undefined {
let resolvedLoc;
if (loc === undefined) {
resolvedLoc = undefined;
} else if (isWholeFileLoc(loc) || isLineColumnLoc(loc)) {
resolvedLoc = loc as ResolvableLocationValue;
} else if (isStringLoc(loc)) {
resolvedLoc = tryGetLocationFromString(loc);
} else {
resolvedLoc = undefined;
}
return resolvedLoc;
}
export function tryGetLocationFromString(
loc: string,
): ResolvableLocationValue | undefined {
const matches = FILE_LOCATION_REGEX.exec(loc);
if (matches && matches.length > 1 && matches[1]) {
if (isWholeFileMatch(matches)) {
return {
uri: matches[1],
} as WholeFileLocation;
} else {
return {
uri: matches[1],
startLine: Number(matches[2]),
startColumn: Number(matches[3]),
endLine: Number(matches[4]),
endColumn: Number(matches[5]),
};
}
} else {
return undefined;
}
}
function isWholeFileMatch(matches: RegExpExecArray): boolean {
return (
matches[2] === "0" &&
matches[3] === "0" &&
matches[4] === "0" &&
matches[5] === "0"
);
}
import type { UrlValue } from "./raw-result-types";
import { isUrlValueResolvable } from "./raw-result-types";
/**
* Checks whether the file path is empty. If so, we do not want to render this location
* as a link.
*
* @param uri A file uri
*/
export function isEmptyPath(uriStr: string) {
return !uriStr || uriStr === "file:/";
}
export function isLineColumnLoc(loc: UrlValue): loc is LineColumnLocation {
return (
typeof loc !== "string" &&
!isEmptyPath(loc.uri) &&
"startLine" in loc &&
"startColumn" in loc &&
"endLine" in loc &&
"endColumn" in loc
);
}
export function isWholeFileLoc(loc: UrlValue): loc is WholeFileLocation {
return (
typeof loc !== "string" && !isEmptyPath(loc.uri) && !isLineColumnLoc(loc)
);
}
export function isStringLoc(loc: UrlValue): loc is string {
return typeof loc === "string";
}
export function tryGetRemoteLocation(
loc: UrlValue | undefined,
fileLinkPrefix: string,
sourceLocationPrefix: string | undefined,
): string | undefined {
const resolvableLocation = tryGetResolvableLocation(loc);
if (!resolvableLocation) {
if (!loc || !isUrlValueResolvable(loc)) {
return undefined;
}
@@ -115,22 +25,19 @@ export function tryGetRemoteLocation(
// "file:${sourceLocationPrefix}/relative/path/to/file"
// So we need to strip off the first part to get the relative path.
if (sourceLocationPrefix) {
if (!resolvableLocation.uri.startsWith(`file:${sourceLocationPrefix}/`)) {
if (!loc.uri.startsWith(`file:${sourceLocationPrefix}/`)) {
return undefined;
}
trimmedLocation = resolvableLocation.uri.replace(
`file:${sourceLocationPrefix}/`,
"",
);
trimmedLocation = loc.uri.replace(`file:${sourceLocationPrefix}/`, "");
} else {
// If the source location prefix is empty (e.g. for older remote queries), we assume that the database
// was created on a Linux actions runner and has the format:
// "file:/home/runner/work/<repo>/<repo>/relative/path/to/file"
// So we need to drop the first 6 parts of the path.
if (!resolvableLocation.uri.startsWith("file:/home/runner/work/")) {
if (!loc.uri.startsWith("file:/home/runner/work/")) {
return undefined;
}
const locationParts = resolvableLocation.uri.split("/");
const locationParts = loc.uri.split("/");
trimmedLocation = locationParts.slice(6, locationParts.length).join("/");
}
@@ -138,11 +45,16 @@ export function tryGetRemoteLocation(
fileLinkPrefix,
filePath: trimmedLocation,
};
if (loc.type === "wholeFileLocation") {
return createRemoteFileRef(fileLink);
}
return createRemoteFileRef(
fileLink,
resolvableLocation.startLine,
resolvableLocation.endLine,
resolvableLocation.startColumn,
resolvableLocation.endColumn,
loc.startLine,
loc.endLine,
loc.startColumn,
loc.endColumn,
);
}

View File

@@ -0,0 +1,3 @@
export function readableBytesMb(numBytes: number): string {
return `${(numBytes / (1024 * 1024)).toFixed(1)} MB`;
}

View File

@@ -1,10 +1,9 @@
import type { CommandManager } from "../packages/commands";
import type { Uri, Range, TextDocumentShowOptions } from "vscode";
import type { Uri, Range, TextDocumentShowOptions, TestItem } from "vscode";
import type { AstItem } from "../language-support";
import type { DbTreeViewItem } from "../databases/ui/db-tree-view-item";
import type { DatabaseItem } from "../databases/local-databases";
import type { QueryHistoryInfo } from "../query-history/query-history-info";
import type { TestTreeNode } from "../query-testing/test-tree-node";
import type {
VariantAnalysis,
VariantAnalysisScannedRepository,
@@ -146,6 +145,7 @@ export type LocalQueryCommands = {
"codeQL.quickQuery": () => Promise<void>;
"codeQL.getCurrentQuery": () => Promise<string>;
"codeQL.createQuery": () => Promise<void>;
"codeQLQuickQuery.createQuery": () => Promise<void>;
};
// Debugger commands
@@ -275,9 +275,11 @@ export type VariantAnalysisCommands = {
"codeQL.openVariantAnalysisView": (
variantAnalysisId: number,
) => Promise<void>;
"codeQL.runVariantAnalysis": (uri?: Uri) => Promise<void>;
"codeQL.runVariantAnalysisContextEditor": (uri?: Uri) => Promise<void>;
"codeQL.runVariantAnalysis": () => Promise<void>;
"codeQL.runVariantAnalysisContextEditor": (uri: Uri) => Promise<void>;
"codeQL.runVariantAnalysisContextExplorer": ExplorerSelectionCommandFunction<Uri>;
"codeQLQueries.runVariantAnalysisContextMenu": TreeViewContextSingleSelectionCommandFunction<QueryTreeViewItem>;
"codeQL.runVariantAnalysisPublishedPack": () => Promise<void>;
};
export type DatabasePanelCommands = {
@@ -333,11 +335,9 @@ export type SummaryLanguageSupportCommands = {
};
export type TestUICommands = {
"codeQLTests.showOutputDifferences": (node: TestTreeNode) => Promise<void>;
"codeQLTests.acceptOutput": (node: TestTreeNode) => Promise<void>;
"codeQLTests.acceptOutputContextTestItem": (
node: TestTreeNode,
) => Promise<void>;
"codeQLTests.showOutputDifferences": (node: TestItem) => Promise<void>;
"codeQLTests.acceptOutput": (node: TestItem) => Promise<void>;
"codeQLTests.acceptOutputContextTestItem": (node: TestItem) => Promise<void>;
};
export type MockGitHubApiServerCommands = {

View File

@@ -1,6 +1,6 @@
import { DisposableObject } from "./disposable-object";
import { getErrorMessage } from "./helpers-pure";
import { Logger } from "./logging";
import type { BaseLogger } from "./logging";
/**
* Base class for "discovery" operations, which scan the file system to find specific kinds of
@@ -13,7 +13,7 @@ export abstract class Discovery extends DisposableObject {
constructor(
protected readonly name: string,
private readonly logger: Logger,
protected readonly logger: BaseLogger,
) {
super();
}

View File

@@ -1,7 +1,7 @@
// Avoid explicitly referencing Disposable type in vscode.
// This file cannot have dependencies on the vscode API.
export interface Disposable {
dispose(): any;
dispose(): unknown;
}
export type DisposeHandler = (disposable: Disposable) => void;

View File

@@ -1,7 +1,4 @@
import { platform } from "os";
import { Open } from "unzipper";
import { join } from "path";
import { pathExists, chmod } from "fs-extra";
/**
* Get the name of the codeql cli installation we prefer to install, based on our current platform.
@@ -19,31 +16,6 @@ export function getRequiredAssetName(): string {
}
}
export async function extractZipArchive(
archivePath: string,
outPath: string,
): Promise<void> {
const archive = await Open.file(archivePath);
await archive.extract({
concurrency: 4,
path: outPath,
});
// Set file permissions for extracted files
await Promise.all(
archive.files.map(async (file) => {
// Only change file permissions if within outPath (path.join normalises the path)
const extractedPath = join(outPath, file.path);
if (
extractedPath.indexOf(outPath) !== 0 ||
!(await pathExists(extractedPath))
) {
return Promise.resolve();
}
return chmod(extractedPath, file.externalFileAttributes >>> 16);
}),
);
}
export function codeQlLauncherName(): string {
return platform() === "win32" ? "codeql.exe" : "codeql";
}

View File

@@ -84,12 +84,13 @@ export interface ErrorLike {
stack?: string;
}
function isErrorLike(error: any): error is ErrorLike {
if (
function isErrorLike(error: unknown): error is ErrorLike {
return (
error !== undefined &&
error !== null &&
typeof error === "object" &&
"message" in error &&
typeof error.message === "string" &&
(error.stack === undefined || typeof error.stack === "string")
) {
return true;
}
return false;
(!("stack" in error) || typeof error.stack === "string")
);
}

View File

@@ -1,4 +1,4 @@
import { Disposable } from "./disposable-object";
import type { Disposable } from "./disposable-object";
export interface AppEvent<T> {
(listener: (event: T) => void): Disposable;

View File

@@ -0,0 +1,36 @@
import { clearTimeout } from "node:timers";
export function createTimeoutSignal(timeoutSeconds: number): {
signal: AbortSignal;
onData: () => void;
dispose: () => void;
} {
const timeout = timeoutSeconds * 1000;
const abortController = new AbortController();
let timeoutId: NodeJS.Timeout;
// If we don't get any data within the timeout, abort the download
timeoutId = setTimeout(() => {
abortController.abort();
}, timeout);
// If we receive any data within the timeout, reset the timeout
const onData = () => {
clearTimeout(timeoutId);
timeoutId = setTimeout(() => {
abortController.abort();
}, timeout);
};
const dispose = () => {
clearTimeout(timeoutId);
};
return {
signal: abortController.signal,
onData,
dispose,
};
}

View File

@@ -1,5 +1,5 @@
import { basename, dirname, join } from "path";
import { EnvironmentContext } from "./app";
import type { EnvironmentContext } from "./app";
/**
* A node in the tree of files. This will be either a `FileTreeDirectory` or a `FileTreeLeaf`.

View File

@@ -1,5 +1,5 @@
import { pathExists, stat, readdir, opendir } from "fs-extra";
import { isAbsolute, join, relative, resolve } from "path";
import { pathExists, stat, readdir, opendir, lstatSync } from "fs-extra";
import { dirname, isAbsolute, join, relative, resolve } from "path";
import { tmpdir as osTmpdir } from "os";
/**
@@ -91,18 +91,23 @@ export async function readDirFullPaths(path: string): Promise<string[]> {
* Symbolic links are ignored.
*
* @param dir the directory to walk
* @param includeDirectories whether to include directories in the results
*
* @return An iterator of the full path to all files recursively found in the directory.
*/
export async function* walkDirectory(
dir: string,
includeDirectories = false,
): AsyncIterableIterator<string> {
const seenFiles = new Set<string>();
for await (const d of await opendir(dir)) {
const entry = join(dir, d.name);
seenFiles.add(entry);
if (d.isDirectory()) {
yield* walkDirectory(entry);
if (includeDirectories) {
yield entry;
}
yield* walkDirectory(entry, includeDirectories);
} else if (d.isFile()) {
yield entry;
}
@@ -119,11 +124,55 @@ export interface IOError {
readonly code: string;
}
export function isIOError(e: any): e is IOError {
return e.code !== undefined && typeof e.code === "string";
export function isIOError(e: unknown): e is IOError {
return (
e !== undefined &&
e !== null &&
typeof e === "object" &&
"code" in e &&
typeof e.code === "string"
);
}
// This function is a wrapper around `os.tmpdir()` to make it easier to mock in tests.
export function tmpdir(): string {
return osTmpdir();
}
/**
* Finds the common parent directory of an arbitrary number of absolute paths. The result
* will be an absolute path.
* @param paths The array of paths.
* @returns The common parent directory of the paths.
*/
export function findCommonParentDir(...paths: string[]): string {
if (paths.length === 0) {
throw new Error("At least one path must be provided");
}
if (paths.some((path) => !isAbsolute(path))) {
throw new Error("All paths must be absolute");
}
paths = paths.map((path) => normalizePath(path));
// If there's only one path and it's a file, return its dirname
if (paths.length === 1) {
return lstatSync(paths[0]).isFile() ? dirname(paths[0]) : paths[0];
}
let commonDir = paths[0];
while (!paths.every((path) => containsPath(commonDir, path))) {
if (isTopLevelPath(commonDir)) {
throw new Error(
"Reached filesystem root and didn't find a common parent directory",
);
}
commonDir = dirname(commonDir);
}
return commonDir;
}
function isTopLevelPath(path: string): boolean {
return dirname(path) === path;
}

View File

@@ -7,6 +7,18 @@
import { RedactableError } from "./errors";
// Matches any type that is not an array. This is useful to help avoid
// nested arrays, or for cases like createSingleSelectionCommand to avoid T
// accidentally getting instantiated as DatabaseItem[] instead of DatabaseItem.
export type NotArray =
| string
| bigint
| number
| boolean
| (object & {
length?: never;
});
/**
* This error is used to indicate a runtime failure of an exhaustivity check enforced at compile time.
*/
@@ -27,26 +39,26 @@ export function assertNever(value: never): never {
/**
* Use to perform array filters where the predicate is asynchronous.
*/
export const asyncFilter = async function <T>(
export async function asyncFilter<T>(
arr: T[],
predicate: (arg0: T) => Promise<boolean>,
) {
const results = await Promise.all(arr.map(predicate));
return arr.filter((_, index) => results[index]);
};
}
/**
* This regex matches strings of the form `owner/repo` where:
* - `owner` is made up of alphanumeric characters, hyphens, underscores, or periods
* - `repo` is made up of alphanumeric characters, hyphens, underscores, or periods
*/
export const REPO_REGEX = /^[a-zA-Z0-9-_\.]+\/[a-zA-Z0-9-_\.]+$/;
export const REPO_REGEX = /^[a-zA-Z0-9-_.]+\/[a-zA-Z0-9-_.]+$/;
/**
* This regex matches GiHub organization and user strings. These are made up for alphanumeric
* characters, hyphens, underscores or periods.
*/
export const OWNER_REGEX = /^[a-zA-Z0-9-_\.]+$/;
export const OWNER_REGEX = /^[a-zA-Z0-9-_.]+$/;
export function getErrorMessage(e: unknown): string {
if (e instanceof RedactableError) {

View File

@@ -1,30 +1,31 @@
import * as sarif from "sarif";
import {
RawResultSet,
ResultRow,
ResultSetSchema,
Column,
ResolvableLocationValue,
} from "../common/bqrs-cli-types";
import {
import type { Log, Result } from "sarif";
import type {
VariantAnalysis,
VariantAnalysisScannedRepositoryResult,
VariantAnalysisScannedRepositoryState,
} from "../variant-analysis/shared/variant-analysis";
import {
import type {
RepositoriesFilterSortState,
RepositoriesFilterSortStateWithIds,
} from "../variant-analysis/shared/variant-analysis-filter-sort";
import { ErrorLike } from "../common/errors";
import { DataFlowPaths } from "../variant-analysis/shared/data-flow-paths";
import { Method } from "../model-editor/method";
import { ModeledMethod } from "../model-editor/modeled-method";
import {
import type { ErrorLike } from "../common/errors";
import type { DataFlowPaths } from "../variant-analysis/shared/data-flow-paths";
import type { Method } from "../model-editor/method";
import type { ModeledMethod } from "../model-editor/modeled-method";
import type {
MethodModelingPanelViewState,
ModelEditorViewState,
} from "../model-editor/shared/view-state";
import { Mode } from "../model-editor/shared/mode";
import { QueryLanguage } from "./query-language";
import type { Mode } from "../model-editor/shared/mode";
import type { QueryLanguage } from "./query-language";
import type {
Column,
RawResultSet,
Row,
UrlValueResolvable,
} from "./raw-result-types";
import type { AccessPathSuggestionOptions } from "../model-editor/suggestions";
import type { ModelEvaluationRunState } from "../model-editor/shared/model-evaluation-run-state";
/**
* This module contains types and code that are shared between
@@ -35,10 +36,13 @@ export const SELECT_TABLE_NAME = "#select";
export const ALERTS_TABLE_NAME = "alerts";
export const GRAPH_TABLE_NAME = "graph";
export type RawTableResultSet = { t: "RawResultSet" } & RawResultSet;
export type InterpretedResultSet<T> = {
type RawTableResultSet = {
t: "RawResultSet";
resultSet: RawResultSet;
};
type InterpretedResultSet<T> = {
t: "InterpretedResultSet";
readonly schema: ResultSetSchema;
name: string;
interpretation: InterpretationT<T>;
};
@@ -74,7 +78,7 @@ export type SarifInterpretationData = {
* they appear in the sarif file.
*/
sortState?: InterpretedResultsSortState;
} & sarif.Log;
} & Log;
export type GraphInterpretationData = {
t: "GraphInterpretationData";
@@ -208,7 +212,7 @@ export type FromResultsViewMsg =
*/
interface ViewSourceFileMsg {
t: "viewSourceFile";
loc: ResolvableLocationValue;
loc: UrlValueResolvable;
databaseUri: string;
}
@@ -334,13 +338,15 @@ interface ChangeCompareMessage {
newResultSetName: string;
}
export type ToCompareViewMessage = SetComparisonsMessage;
export type ToCompareViewMessage =
| SetComparisonQueryInfoMessage
| SetComparisonsMessage;
/**
* Message to the compare view that specifies the query results to compare.
* Message to the compare view that sets the metadata of the compared queries.
*/
export interface SetComparisonsMessage {
readonly t: "setComparisons";
export interface SetComparisonQueryInfoMessage {
readonly t: "setComparisonQueryInfo";
readonly stats: {
fromQuery?: {
name: string;
@@ -353,26 +359,44 @@ export interface SetComparisonsMessage {
time: string;
};
};
readonly columns: readonly Column[];
readonly commonResultSetNames: string[];
readonly currentResultSetName: string;
readonly rows: QueryCompareResult | undefined;
readonly message: string | undefined;
readonly databaseUri: string;
readonly commonResultSetNames: string[];
}
/**
* Message to the compare view that specifies the query results to compare.
*/
export interface SetComparisonsMessage {
readonly t: "setComparisons";
readonly currentResultSetName: string;
readonly result: QueryCompareResult | undefined;
readonly message: string | undefined;
}
export type QueryCompareResult =
| RawQueryCompareResult
| InterpretedQueryCompareResult;
/**
* from is the set of rows that have changes in the "from" query.
* to is the set of rows that have changes in the "to" query.
* They are in the same order, so element 1 in "from" corresponds to
* element 1 in "to".
*
* If an array element is null, that means that the element was removed
* (or added) in the comparison.
*/
export type QueryCompareResult = {
from: ResultRow[];
to: ResultRow[];
export type RawQueryCompareResult = {
kind: "raw";
columns: readonly Column[];
from: Row[];
to: Row[];
};
/**
* from is the set of results that have changes in the "from" query.
* to is the set of results that have changes in the "to" query.
*/
export type InterpretedQueryCompareResult = {
kind: "interpreted";
sourceLocationPrefix: string;
from: Result[];
to: Result[];
};
/**
@@ -505,9 +529,10 @@ interface SetMethodsMessage {
methods: Method[];
}
interface SetModeledMethodsMessage {
t: "setModeledMethods";
interface SetModeledAndModifiedMethodsMessage {
t: "setModeledAndModifiedMethods";
methods: Record<string, ModeledMethod[]>;
modifiedMethodSignatures: string[];
}
interface SetModifiedMethodsMessage {
@@ -520,6 +545,11 @@ interface SetInProgressMethodsMessage {
methods: string[];
}
interface SetProcessedByAutoModelMethodsMessage {
t: "setProcessedByAutoModelMethods";
methods: string[];
}
interface SwitchModeMessage {
t: "switchMode";
mode: Mode;
@@ -562,6 +592,14 @@ interface StopGeneratingMethodsFromLlmMessage {
packageName: string;
}
interface StartModelEvaluationMessage {
t: "startModelEvaluation";
}
interface StopModelEvaluationMessage {
t: "stopModelEvaluation";
}
interface ModelDependencyMessage {
t: "modelDependency";
}
@@ -587,18 +625,36 @@ interface SetInProgressMessage {
inProgress: boolean;
}
interface SetProcessedByAutoModelMessage {
t: "setProcessedByAutoModel";
processedByAutoModel: boolean;
}
interface RevealMethodMessage {
t: "revealMethod";
methodSignature: string;
}
interface SetAccessPathSuggestionsMessage {
t: "setAccessPathSuggestions";
accessPathSuggestions: AccessPathSuggestionOptions;
}
interface SetModelEvaluationRunMessage {
t: "setModelEvaluationRun";
run: ModelEvaluationRunState | undefined;
}
export type ToModelEditorMessage =
| SetExtensionPackStateMessage
| SetMethodsMessage
| SetModeledMethodsMessage
| SetModeledAndModifiedMethodsMessage
| SetModifiedMethodsMessage
| SetInProgressMethodsMessage
| RevealMethodMessage;
| SetProcessedByAutoModelMethodsMessage
| RevealMethodMessage
| SetAccessPathSuggestionsMessage
| SetModelEvaluationRunMessage;
export type FromModelEditorMessage =
| CommonFromViewMessages
@@ -613,7 +669,9 @@ export type FromModelEditorMessage =
| StopGeneratingMethodsFromLlmMessage
| ModelDependencyMessage
| HideModeledMethodsMessage
| SetMultipleModeledMethodsMessage;
| SetMultipleModeledMethodsMessage
| StartModelEvaluationMessage
| StopModelEvaluationMessage;
interface RevealInEditorMessage {
t: "revealInModelEditor";
@@ -651,6 +709,7 @@ interface SetSelectedMethodMessage {
modeledMethods: ModeledMethod[];
isModified: boolean;
isInProgress: boolean;
processedByAutoModel: boolean;
}
export type ToMethodModelingMessage =
@@ -660,4 +719,5 @@ export type ToMethodModelingMessage =
| SetMethodModifiedMessage
| SetSelectedMethodMessage
| SetInModelingModeMessage
| SetInProgressMessage;
| SetInProgressMessage
| SetProcessedByAutoModelMessage;

View File

@@ -1,4 +1,4 @@
import { Memento } from "./memento";
import type { Memento } from "./memento";
/**
* Provides a utility method to invoke a function only if a minimum time interval has elapsed since

View File

@@ -10,9 +10,9 @@ import { readFile } from "fs-extra";
* @param path The path to the file.
* @param handler Callback to be invoked for each top-level JSON object in order.
*/
export async function readJsonlFile(
export async function readJsonlFile<T>(
path: string,
handler: (value: any) => Promise<void>,
handler: (value: T) => Promise<void>,
): Promise<void> {
const logSummary = await readFile(path, "utf-8");
@@ -20,7 +20,7 @@ export async function readJsonlFile(
const jsonSummaryObjects: string[] = logSummary.split(/\r?\n\r?\n/g);
for (const obj of jsonSummaryObjects) {
const jsonObj = JSON.parse(obj);
const jsonObj = JSON.parse(obj) as T;
await handler(jsonObj);
}
}

View File

@@ -1,4 +1,4 @@
import { FileLink } from "../variant-analysis/shared/analysis-result";
import type { FileLink } from "../variant-analysis/shared/analysis-result";
export function createRemoteFileRef(
fileLink: FileLink,

View File

@@ -1,4 +1,4 @@
import { Logger } from "./logger";
import type { Logger } from "./logger";
export interface NotificationLogger extends Logger {
showErrorMessage(message: string): Promise<void>;

View File

@@ -1,6 +1,6 @@
import { NotificationLogger } from "./notification-logger";
import { AppTelemetry } from "../telemetry";
import { RedactableError } from "../errors";
import type { NotificationLogger } from "./notification-logger";
import type { AppTelemetry } from "../telemetry";
import type { RedactableError } from "../errors";
interface ShowAndLogOptions {
/**

View File

@@ -1,7 +1,7 @@
import { appendFile, ensureFile } from "fs-extra";
import { isAbsolute } from "path";
import { getErrorMessage } from "../helpers-pure";
import { Logger, LogOptions } from "./logger";
import type { Logger, LogOptions } from "./logger";
/**
* An implementation of {@link Logger} that sends the output both to another {@link Logger}

View File

@@ -11,7 +11,7 @@ export const extLogger = new OutputChannelLogger("CodeQL Extension Log");
export const queryServerLogger = new OutputChannelLogger("CodeQL Query Server");
// Logger for messages from the language server.
export const ideServerLogger = new OutputChannelLogger(
export const languageServerLogger = new OutputChannelLogger(
"CodeQL Language Server",
);

View File

@@ -1,7 +1,8 @@
import { window as Window, OutputChannel, Progress } from "vscode";
import { Logger, LogOptions } from "../logger";
import type { OutputChannel, Progress } from "vscode";
import { window as Window } from "vscode";
import type { Logger, LogOptions } from "../logger";
import { DisposableObject } from "../../disposable-object";
import { NotificationLogger } from "../notification-logger";
import type { NotificationLogger } from "../notification-logger";
/**
* A logger that writes messages to an output channel in the VS Code Output tab.
@@ -63,7 +64,7 @@ export class OutputChannelLogger
message: string,
show: (message: string, ...items: string[]) => Thenable<string | undefined>,
): Promise<void> {
const label = "Show Log";
const label = "View extension logs";
const result = await show(message, label);
if (result === label) {

View File

@@ -40,5 +40,5 @@ export interface Memento {
* @param key A string.
* @param value A value. MUST not contain cyclic references.
*/
update(key: string, value: any): Thenable<void>;
update<T>(key: string, value: T | undefined): Thenable<void>;
}

View File

@@ -1,5 +1,5 @@
import { Repository } from "../../variant-analysis/gh-api/repository";
import {
import type { Repository } from "../../variant-analysis/gh-api/repository";
import type {
VariantAnalysis,
VariantAnalysisRepoTask,
} from "../../variant-analysis/gh-api/variant-analysis";

View File

@@ -1,6 +1,7 @@
import { join, resolve } from "path";
import { pathExists } from "fs-extra";
import { setupServer, SetupServer } from "msw/node";
import type { SetupServer } from "msw/node";
import { setupServer } from "msw/node";
import { DisposableObject } from "../disposable-object";

View File

@@ -2,24 +2,24 @@ import { ensureDir, writeFile } from "fs-extra";
import { join } from "path";
import fetch from "node-fetch";
import { SetupServer } from "msw/node";
import type { SetupServer } from "msw/node";
import { DisposableObject } from "../disposable-object";
import { gzipDecode } from "../zlib";
import {
import type {
AutoModelResponse,
BasicErrorResponse,
CodeSearchResponse,
GetVariantAnalysisRepoResultRequest,
GitHubApiRequest,
RequestKind,
} from "./gh-api-request";
import {
import { RequestKind } from "./gh-api-request";
import type {
VariantAnalysis,
VariantAnalysisRepoTask,
} from "../../variant-analysis/gh-api/variant-analysis";
import { Repository } from "../../variant-analysis/gh-api/repository";
import type { Repository } from "../../variant-analysis/gh-api/repository";
export class Recorder extends DisposableObject {
private currentRecordedScenario: GitHubApiRequest[] = [];

View File

@@ -1,8 +1,9 @@
import { join } from "path";
import { readdir, readJson, readFile } from "fs-extra";
import { http, RequestHandler } from "msw";
import type { RequestHandler } from "msw";
import { http } from "msw";
import type { GitHubApiRequest } from "./gh-api-request";
import {
GitHubApiRequest,
isAutoModelRequest,
isCodeSearchRequest,
isGetRepoRequest,

View File

@@ -1,5 +1,6 @@
import { pathExists } from "fs-extra";
import { env, QuickPickItem, Uri, window } from "vscode";
import type { QuickPickItem } from "vscode";
import { env, Uri, window } from "vscode";
import {
getMockGitHubApiServerScenariosPath,
@@ -7,8 +8,9 @@ import {
} from "../../../config";
import { DisposableObject } from "../../disposable-object";
import { MockGitHubApiServer } from "../mock-gh-api-server";
import { MockGitHubApiServerCommands } from "../../commands";
import { App, AppMode } from "../../app";
import type { MockGitHubApiServerCommands } from "../../commands";
import type { App } from "../../app";
import { AppMode } from "../../app";
import path from "path";
/**

View File

@@ -1,8 +1,8 @@
import * as Octokit from "@octokit/rest";
import { Octokit } from "@octokit/rest";
import { retry } from "@octokit/plugin-retry";
import fetch from "node-fetch";
export const AppOctokit = Octokit.Octokit.defaults({
export const AppOctokit = Octokit.defaults({
request: {
fetch,
},

View File

@@ -1,4 +1,4 @@
import { join } from "path";
import { dirname, join, parse } from "path";
import { pathExists } from "fs-extra";
export const QLPACK_FILENAMES = ["qlpack.yml", "codeql-pack.yml"];
@@ -8,7 +8,13 @@ export const QLPACK_LOCK_FILENAMES = [
];
export const FALLBACK_QLPACK_FILENAME = QLPACK_FILENAMES[0];
export async function getQlPackPath(
/**
* Gets the path to the QL pack file (a qlpack.yml or
* codeql-pack.yml).
* @param packRoot The root of the pack.
* @returns The path to the qlpack file, or undefined if it doesn't exist.
*/
export async function getQlPackFilePath(
packRoot: string,
): Promise<string | undefined> {
for (const filename of QLPACK_FILENAMES) {
@@ -21,3 +27,28 @@ export async function getQlPackPath(
return undefined;
}
/**
* Recursively find the directory containing qlpack.yml or codeql-pack.yml. If
* no such directory is found, the directory containing the query file is returned.
* @param queryFile The query file to start from.
* @returns The path to the pack root or undefined if it doesn't exist.
*/
export async function findPackRoot(
queryFile: string,
): Promise<string | undefined> {
let dir = dirname(queryFile);
while (!(await getQlPackFilePath(dir))) {
dir = dirname(dir);
if (isFileSystemRoot(dir)) {
return undefined;
}
}
return dir;
}
function isFileSystemRoot(dir: string): boolean {
const pathObj = parse(dir);
return pathObj.root === dir && pathObj.base === "";
}

View File

@@ -0,0 +1,26 @@
import { QueryLanguage } from "./query-language";
import { loadQlpackFile } from "../packaging/qlpack-file-loader";
/**
* @param qlpackPath The path to the `qlpack.yml` or `codeql-pack.yml` file.
* @return the language of the given qlpack file, or undefined if the file is
* not a valid qlpack file or does not contain exactly one language.
*/
export async function getQlPackLanguage(
qlpackPath: string,
): Promise<QueryLanguage | undefined> {
const qlPack = await loadQlpackFile(qlpackPath);
const dependencies = qlPack?.dependencies;
if (!dependencies) {
return;
}
const matchingLanguages = Object.values(QueryLanguage).filter(
(language) => `codeql/${language}-all` in dependencies,
);
if (matchingLanguages.length !== 1) {
return undefined;
}
return matchingLanguages[0];
}

View File

@@ -0,0 +1,90 @@
export enum ColumnKind {
String = "string",
Float = "float",
Integer = "integer",
Boolean = "boolean",
Date = "date",
Entity = "entity",
}
export type Column = {
name?: string;
kind: ColumnKind;
};
type UrlValueString = {
type: "string";
value: string;
};
export type UrlValueWholeFileLocation = {
type: "wholeFileLocation";
uri: string;
};
export type UrlValueLineColumnLocation = {
type: "lineColumnLocation";
uri: string;
startLine: number;
startColumn: number;
endLine: number;
endColumn: number;
};
export type UrlValueResolvable =
| UrlValueWholeFileLocation
| UrlValueLineColumnLocation;
export function isUrlValueResolvable(
value: UrlValue,
): value is UrlValueResolvable {
return (
value.type === "wholeFileLocation" || value.type === "lineColumnLocation"
);
}
export type UrlValue = UrlValueString | UrlValueResolvable;
export type EntityValue = {
url?: UrlValue;
label?: string;
id?: number;
};
type CellValueEntity = {
type: "entity";
value: EntityValue;
};
type CellValueNumber = {
type: "number";
value: number;
};
type CellValueString = {
type: "string";
value: string;
};
type CellValueBoolean = {
type: "boolean";
value: boolean;
};
export type CellValue =
| CellValueEntity
| CellValueNumber
| CellValueString
| CellValueBoolean;
export type Row = CellValue[];
export type RawResultSet = {
name: string;
totalRowCount: number;
columns: Column[];
rows: Row[];
nextPageOffset?: number;
};

View File

@@ -1,11 +1,12 @@
export type DeepReadonly<T> = T extends Array<infer R>
? DeepReadonlyArray<R>
: // eslint-disable-next-line @typescript-eslint/ban-types
T extends Function
? T
: T extends object
? DeepReadonlyObject<T>
: T;
export type DeepReadonly<T> =
T extends Array<infer R>
? DeepReadonlyArray<R>
: // eslint-disable-next-line @typescript-eslint/ban-types
T extends Function
? T
: T extends object
? DeepReadonlyObject<T>
: T;
interface DeepReadonlyArray<T> extends ReadonlyArray<DeepReadonly<T>> {}

Some files were not shown because too many files have changed in this diff Show More