Skip to content

Commit 1f5f215

Browse files
authored
config(amazonq): disable auto-review by default (#7058)
## Problem We heard from users that auto scans are sometimes causing highlight linting issues where entire IDE is now yellow-underlined with warnings that may sometimes be irrelevant ## Solution We will disable auto scans by default, and user can re-enable in the menu. --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 674973e commit 1f5f215

File tree

4 files changed

+27
-21
lines changed

4 files changed

+27
-21
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "bugfix",
3+
"description": "/review: disable auto-review by default"
4+
}

packages/amazonq/test/unit/codewhisperer/service/securityScanHandler.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
pollScanJobStatus,
1717
SecurityScanTimedOutError,
1818
CodeWhispererConstants,
19+
CodeScansState,
1920
} from 'aws-core-vscode/codewhisperer'
2021
import { timeoutUtils } from 'aws-core-vscode/shared'
2122
import assert from 'assert'
@@ -281,6 +282,7 @@ describe('securityScanHandler', function () {
281282
shouldAdvanceTime: true,
282283
})
283284
sinon.stub(timeoutUtils, 'sleep').resolves()
285+
sinon.stub(CodeScansState.instance, 'isScansEnabled').returns(true)
284286
})
285287

286288
afterEach(function () {

packages/core/src/codewhisperer/models/model.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ export class CodeScansState {
280280
return (this.#instance ??= new this())
281281
}
282282

283-
protected constructor(fallback: boolean = true) {
283+
protected constructor(fallback: boolean = false) {
284284
this.#fallback = fallback
285285
}
286286

packages/core/src/test/codewhisperer/commands/basicCommands.test.ts

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -193,36 +193,36 @@ describe('CodeWhisperer-basicCommands', function () {
193193
codeScansState = new TestCodeScansState()
194194
})
195195

196-
it('has auto scans enabled by default', async function () {
196+
it('has auto scans disabled by default', async function () {
197197
targetCommand = testCommand(toggleCodeScans, codeScansState)
198-
assert.strictEqual(codeScansState.isScansEnabled(), true)
198+
assert.strictEqual(codeScansState.isScansEnabled(), false)
199199
})
200200

201201
it('toggles states as expected', async function () {
202202
targetCommand = testCommand(toggleCodeScans, codeScansState)
203-
assert.strictEqual(codeScansState.isScansEnabled(), true)
204-
await targetCommand.execute(placeholder, cwQuickPickSource)
205203
assert.strictEqual(codeScansState.isScansEnabled(), false)
206204
await targetCommand.execute(placeholder, cwQuickPickSource)
207205
assert.strictEqual(codeScansState.isScansEnabled(), true)
208206
await targetCommand.execute(placeholder, cwQuickPickSource)
209207
assert.strictEqual(codeScansState.isScansEnabled(), false)
208+
await targetCommand.execute(placeholder, cwQuickPickSource)
209+
assert.strictEqual(codeScansState.isScansEnabled(), true)
210210
})
211211

212212
it('setScansEnabled() works as expected', async function () {
213-
// initially true
214-
assert.strictEqual(codeScansState.isScansEnabled(), true)
215-
216-
await codeScansState.setScansEnabled(false)
213+
// initially false
217214
assert.strictEqual(codeScansState.isScansEnabled(), false)
218215

219-
// set new state to current state
220-
await codeScansState.setScansEnabled(false)
221-
assert.strictEqual(codeScansState.isScansEnabled(), false)
216+
await codeScansState.setScansEnabled(true)
217+
assert.strictEqual(codeScansState.isScansEnabled(), true)
222218

223-
// set to opposite state
219+
// set new state to current state
224220
await codeScansState.setScansEnabled(true)
225221
assert.strictEqual(codeScansState.isScansEnabled(), true)
222+
223+
// set to opposite state
224+
await codeScansState.setScansEnabled(false)
225+
assert.strictEqual(codeScansState.isScansEnabled(), false)
226226
})
227227

228228
it('triggers event listener when toggled', async function () {
@@ -239,28 +239,28 @@ describe('CodeWhisperer-basicCommands', function () {
239239
assert.strictEqual(eventListener.callCount, 1)
240240
})
241241

242-
it('emits aws_modifySetting event on user toggling autoScans - deactivate', async function () {
242+
it('emits aws_modifySetting event on user toggling autoScans - activate', async function () {
243243
targetCommand = testCommand(toggleCodeScans, codeScansState)
244244
await targetCommand.execute(placeholder, cwQuickPickSource)
245245

246-
assert.strictEqual(codeScansState.isScansEnabled(), false)
246+
assert.strictEqual(codeScansState.isScansEnabled(), true)
247247
assertTelemetryCurried('aws_modifySetting')({
248248
settingId: CodeWhispererConstants.autoScansConfig.settingId,
249-
settingState: CodeWhispererConstants.autoScansConfig.deactivated,
249+
settingState: CodeWhispererConstants.autoScansConfig.activated,
250250
})
251251
})
252252

253-
it('emits aws_modifySetting event on user toggling autoScans -- activate', async function () {
254-
codeScansState = new TestCodeScansState(false)
255-
assert.strictEqual(codeScansState.isScansEnabled(), false)
253+
it('emits aws_modifySetting event on user toggling autoScans -- deactivate', async function () {
254+
codeScansState = new TestCodeScansState(true)
255+
assert.strictEqual(codeScansState.isScansEnabled(), true)
256256

257257
targetCommand = testCommand(toggleCodeScans, codeScansState)
258258
await targetCommand.execute(placeholder, cwQuickPickSource)
259259

260-
assert.strictEqual(codeScansState.isScansEnabled(), true)
260+
assert.strictEqual(codeScansState.isScansEnabled(), false)
261261
assertTelemetryCurried('aws_modifySetting')({
262262
settingId: CodeWhispererConstants.autoScansConfig.settingId,
263-
settingState: CodeWhispererConstants.autoScansConfig.activated,
263+
settingState: CodeWhispererConstants.autoScansConfig.deactivated,
264264
})
265265
})
266266

0 commit comments

Comments
 (0)