aws / aws-toolkit-vscode
Showing 150 of 227 files from the diff.
Other files ignored by Codecov
docs/TESTPLAN.md has changed.
.eslintrc.js has changed.

@@ -34,15 +34,18 @@
Loading
34 34
}
35 35
36 36
// We use a symbol to safe-guard against collisions (alternatively this can be a class and use 'instanceof')
37 -
const WIZARD_CONTROL = Symbol()
37 +
const WIZARD_CONTROL = Symbol() // eslint-disable-line @typescript-eslint/naming-convention
38 38
const makeControlString = (type: string) => `[WIZARD_CONTROL] ${type}`
39 39
40 +
// eslint-disable-next-line @typescript-eslint/naming-convention
40 41
export const WIZARD_RETRY = {
41 42
    id: WIZARD_CONTROL,
42 43
    type: ControlSignal.Retry,
43 44
    toString: () => makeControlString('Retry'),
44 45
}
46 +
// eslint-disable-next-line @typescript-eslint/naming-convention
45 47
export const WIZARD_BACK = { id: WIZARD_CONTROL, type: ControlSignal.Back, toString: () => makeControlString('Back') }
48 +
// eslint-disable-next-line @typescript-eslint/naming-convention
46 49
export const WIZARD_EXIT = { id: WIZARD_CONTROL, type: ControlSignal.Exit, toString: () => makeControlString('Exit') }
47 50
48 51
/** Control signals allow for alterations of the normal wizard flow */

@@ -9,7 +9,7 @@
Loading
9 9
import { ChildNodeCache } from './childNodeCache'
10 10
import * as AsyncLock from 'async-lock'
11 11
12 -
const LOCK_KEY = 'ChildNodeLoader'
12 +
const lockKey = 'ChildNodeLoader'
13 13
14 14
export interface ChildNodePage<T extends AWSTreeNodeBase = AWSTreeNodeBase> {
15 15
    newChildren: T[]
@@ -56,7 +56,7 @@
Loading
56 56
     * Returns true if a {@link loadMoreChildren} call is in progress.
57 57
     */
58 58
    public isLoadingMoreChildren(): boolean {
59 -
        return this.loadChildrenLock.isBusy(LOCK_KEY)
59 +
        return this.loadChildrenLock.isBusy(lockKey)
60 60
    }
61 61
62 62
    /**
@@ -92,7 +92,7 @@
Loading
92 92
     */
93 93
    private async loadMoreChildrenIf(condition: () => boolean): Promise<void> {
94 94
        if (condition()) {
95 -
            return this.loadChildrenLock.acquire(LOCK_KEY, async () => {
95 +
            return this.loadChildrenLock.acquire(lockKey, async () => {
96 96
                if (condition()) {
97 97
                    const newPage = await this.loadPage(this.cache.continuationToken)
98 98
                    this.cache.appendPage(newPage)

@@ -16,8 +16,8 @@
Loading
16 16
import { Timeout, waitTimeout } from '../shared/utilities/timeoutUtils'
17 17
import { fromExtensionManifest } from '../shared/settings'
18 18
19 -
const CREDENTIALS_TIMEOUT = 300000 // 5 minutes
20 -
const CREDENTIALS_PROGRESS_DELAY = 1000
19 +
const credentialsTimeout = 300000 // 5 minutes
20 +
const credentialsProgressDelay = 1000
21 21
22 22
export function asEnvironmentVariables(credentials: Credentials): NodeJS.ProcessEnv {
23 23
    const environmentVariables: NodeJS.ProcessEnv = {}
@@ -70,7 +70,7 @@
Loading
70 70
export async function resolveProviderWithCancel(
71 71
    profile: string,
72 72
    provider: Promise<Credentials>,
73 -
    timeout: Timeout | number = CREDENTIALS_TIMEOUT
73 +
    timeout: Timeout | number = credentialsTimeout
74 74
): Promise<Credentials> {
75 75
    if (typeof timeout === 'number') {
76 76
        timeout = new Timeout(timeout)
@@ -84,7 +84,7 @@
Loading
84 84
                timeout
85 85
            )
86 86
        }
87 -
    }, CREDENTIALS_PROGRESS_DELAY)
87 +
    }, credentialsProgressDelay)
88 88
89 89
    return await waitTimeout(provider, timeout, {
90 90
        allowUndefined: false,

@@ -41,14 +41,14 @@
Loading
41 41
    },
42 42
}
43 43
44 -
const SSMDOCUMENT_LANGUAGESERVER_DEFAULTPORT = 6010
44 +
const ssmdocumentLanguageserverDefaultport = 6010
45 45
46 46
async function getLanguageServerDebuggerPort(extensionContext: ExtensionContext): Promise<number> {
47 47
    // get the port from env variable or use 6010 as default if not set
48 48
    const env = process.env as EnvironmentVariables
49 49
    const port = env.SSMDOCUMENT_LANGUAGESERVER_PORT
50 50
        ? parseInt(env.SSMDOCUMENT_LANGUAGESERVER_PORT as string)
51 -
        : SSMDOCUMENT_LANGUAGESERVER_DEFAULTPORT
51 +
        : ssmdocumentLanguageserverDefaultport
52 52
53 53
    return getPortPromise({ port: port })
54 54
}

@@ -50,7 +50,7 @@
Loading
50 50
 * CLIs and their full filenames and download paths for their respective OSes
51 51
 * TODO: Add SAM? Other CLIs?
52 52
 */
53 -
export const AWS_CLIS: { [cli in AwsClis]: Cli } = {
53 +
export const awsClis: { [cli in AwsClis]: Cli } = {
54 54
    'session-manager-plugin': {
55 55
        command: {
56 56
            unix: path.join('sessionmanagerplugin', 'bin', 'session-manager-plugin'),
@@ -80,7 +80,7 @@
Loading
80 80
    confirm: boolean,
81 81
    window: Window = Window.vscode()
82 82
): Promise<string | never> {
83 -
    const cliToInstall = AWS_CLIS[cli]
83 +
    const cliToInstall = awsClis[cli]
84 84
    if (!cliToInstall) {
85 85
        throw new InstallerError(`Invalid not found for CLI: ${cli}`)
86 86
    }
@@ -252,9 +252,9 @@
Loading
252 252
): Promise<string> {
253 253
    progress.report({ message: msgDownloading })
254 254
255 -
    const ssmInstaller = await downloadCliSource(AWS_CLIS['session-manager-plugin'], tempDir, timeout)
255 +
    const ssmInstaller = await downloadCliSource(awsClis['session-manager-plugin'], tempDir, timeout)
256 256
    const outDir = path.join(getToolkitLocalCliPath(), 'sessionmanagerplugin')
257 -
    const finalPath = path.join(getToolkitLocalCliPath(), getOsCommand(AWS_CLIS['session-manager-plugin']))
257 +
    const finalPath = path.join(getToolkitLocalCliPath(), getOsCommand(awsClis['session-manager-plugin']))
258 258
    const TimedProcess = ChildProcess.extend({ timeout, rejectOnError: true, rejectOnErrorCode: true })
259 259
260 260
    getLogger('channel').info(`Installing SSM CLI from ${ssmInstaller} to ${outDir}...`)
@@ -326,7 +326,7 @@
Loading
326 326
    if (DevSettings.instance.get('forceInstallTools', false)) {
327 327
        return installCli(cli, confirm, window)
328 328
    } else {
329 -
        return (await getCliCommand(AWS_CLIS[cli])) ?? installCli(cli, confirm, window)
329 +
        return (await getCliCommand(awsClis[cli])) ?? installCli(cli, confirm, window)
330 330
    }
331 331
}
332 332

@@ -151,7 +151,7 @@
Loading
151 151
            req = EditorContext.buildListRecommendationRequest(
152 152
                editor as vscode.TextEditor,
153 153
                this.nextToken,
154 -
                accessToken ? undefined : config.isIncludeSuggestionsWithCodeReferencesEnabled
154 +
                accessToken ? undefined : config.isSuggestionsWithCodeReferencesEnabled
155 155
            )
156 156
        } else {
157 157
            req = EditorContext.buildGenerateRecommendationRequest(editor as vscode.TextEditor)
@@ -341,7 +341,11 @@
Loading
341 341
        this.nextToken = ''
342 342
        this.errorMessagePrompt = ''
343 343
    }
344 -
    reportUserDecisionOfCurrentRecommendation(editor: vscode.TextEditor | undefined, acceptIndex: number) {
344 +
345 +
    /**
346 +
     * Emits telemetry reflecting user decision for current recommendation.
347 +
     */
348 +
    reportUserDecisionOfRecommendation(editor: vscode.TextEditor | undefined, acceptIndex: number) {
345 349
        TelemetryHelper.instance.recordUserDecisionTelemetry(
346 350
            this.requestId,
347 351
            this.sessionId,
@@ -359,7 +363,7 @@
Loading
359 363
360 364
    canShowRecommendationInIntelliSense(editor: vscode.TextEditor, showPrompt: boolean = false): boolean {
361 365
        const reject = () => {
362 -
            this.reportUserDecisionOfCurrentRecommendation(editor, -1)
366 +
            this.reportUserDecisionOfRecommendation(editor, -1)
363 367
            this.clearRecommendations()
364 368
        }
365 369
        if (!this.isValidResponse()) {

@@ -18,9 +18,9 @@
Loading
18 18
import { DevSettings } from '../settings'
19 19
import { ClassToInterfaceType } from '../utilities/tsUtils'
20 20
21 -
export const ACCOUNT_METADATA_KEY = 'awsAccount'
22 -
export const REGION_KEY = 'awsRegion'
23 -
export const COMPUTE_REGION_KEY = 'computeRegion'
21 +
export const accountMetadataKey = 'awsAccount'
22 +
export const regionKey = 'awsRegion'
23 +
export const computeRegionKey = 'computeRegion'
24 24
25 25
export enum AccountStatus {
26 26
    NotApplicable = 'n/a',
@@ -28,7 +28,7 @@
Loading
28 28
    Invalid = 'invalid',
29 29
}
30 30
31 -
export const METADATA_FIELD_NAME = {
31 +
export const metadataFieldName = {
32 32
    RESULT: 'result',
33 33
    DURATION: 'duration',
34 34
    REASON: 'reason',
@@ -53,16 +53,16 @@
Loading
53 53
export type TelemetryClient = ClassToInterfaceType<DefaultTelemetryClient>
54 54
55 55
export class DefaultTelemetryClient implements TelemetryClient {
56 -
    private static readonly DEFAULT_IDENTITY_POOL = 'us-east-1:820fd6d1-95c0-4ca4-bffb-3f01d32da842'
57 -
    private static readonly DEFAULT_TELEMETRY_ENDPOINT = 'https://client-telemetry.us-east-1.amazonaws.com'
58 -
    private static readonly PRODUCT_NAME = 'AWS Toolkit For VS Code'
56 +
    private static readonly defaultIdentityPool = 'us-east-1:820fd6d1-95c0-4ca4-bffb-3f01d32da842'
57 +
    private static readonly defaultTelemetryEndpoint = 'https://client-telemetry.us-east-1.amazonaws.com'
58 +
    private static readonly productName = 'AWS Toolkit For VS Code'
59 59
60 60
    private static initializeConfig(): TelemetryConfiguration {
61 61
        const settings = DevSettings.instance
62 62
63 63
        return {
64 -
            endpoint: settings.get('telemetryEndpoint', this.DEFAULT_TELEMETRY_ENDPOINT),
65 -
            identityPool: settings.get('telemetryUserPool', this.DEFAULT_IDENTITY_POOL),
64 +
            endpoint: settings.get('telemetryEndpoint', this.defaultTelemetryEndpoint),
65 +
            identityPool: settings.get('telemetryUserPool', this.defaultIdentityPool),
66 66
        }
67 67
    }
68 68
@@ -86,7 +86,7 @@
Loading
86 86
            if (!isAutomation()) {
87 87
                await this.client
88 88
                    .postMetrics({
89 -
                        AWSProduct: DefaultTelemetryClient.PRODUCT_NAME,
89 +
                        AWSProduct: DefaultTelemetryClient.productName,
90 90
                        AWSProductVersion: extensionVersion,
91 91
                        ClientID: this.clientId,
92 92
                        OS: os.platform(),
@@ -113,7 +113,7 @@
Loading
113 113
        try {
114 114
            await this.client
115 115
                .postFeedback({
116 -
                    AWSProduct: DefaultTelemetryClient.PRODUCT_NAME,
116 +
                    AWSProduct: DefaultTelemetryClient.productName,
117 117
                    AWSProductVersion: extensionVersion,
118 118
                    OS: os.platform(),
119 119
                    OSVersion: os.release(),

@@ -19,18 +19,18 @@
Loading
19 19
import { DefaultCloudWatchLogsClient } from '../../shared/clients/cloudWatchLogsClient'
20 20
const localize = nls.loadMessageBundle()
21 21
22 -
const CONTEXT_BASE = 'awsAppRunnerServiceNode'
23 -
24 -
const OPERATION_STATUS = {
25 -
    START_DEPLOYMENT: localize('AWS.apprunner.operationStatus.deploy', 'Deploying...'),
26 -
    CREATE_SERVICE: localize('AWS.apprunner.operationStatus.create', 'Creating...'),
27 -
    PAUSE_SERVICE: localize('AWS.apprunner.operationStatus.pause', 'Pausing...'),
28 -
    RESUME_SERVICE: localize('AWS.apprunner.operationStatus.resume', 'Resuming...'),
29 -
    DELETE_SERVICE: localize('AWS.apprunner.operationStatus.delete', 'Deleting...'),
30 -
    UPDATE_SERVICE: localize('AWS.apprunner.operationStatus.update', 'Updating...'),
22 +
const contextBase = 'awsAppRunnerServiceNode'
23 +
24 +
const operationStatus = {
25 +
    START_DEPLOYMENT: localize('AWS.apprunner.operationStatus.deploy', 'Deploying...'), // eslint-disable-line @typescript-eslint/naming-convention
26 +
    CREATE_SERVICE: localize('AWS.apprunner.operationStatus.create', 'Creating...'), // eslint-disable-line @typescript-eslint/naming-convention
27 +
    PAUSE_SERVICE: localize('AWS.apprunner.operationStatus.pause', 'Pausing...'), // eslint-disable-line @typescript-eslint/naming-convention
28 +
    RESUME_SERVICE: localize('AWS.apprunner.operationStatus.resume', 'Resuming...'), // eslint-disable-line @typescript-eslint/naming-convention
29 +
    DELETE_SERVICE: localize('AWS.apprunner.operationStatus.delete', 'Deleting...'), // eslint-disable-line @typescript-eslint/naming-convention
30 +
    UPDATE_SERVICE: localize('AWS.apprunner.operationStatus.update', 'Updating...'), // eslint-disable-line @typescript-eslint/naming-convention
31 31
}
32 32
33 -
type ServiceOperation = keyof typeof OPERATION_STATUS
33 +
type ServiceOperation = keyof typeof operationStatus
34 34
35 35
export class AppRunnerServiceNode extends CloudWatchLogsBase implements AWSResourceNode {
36 36
    public readonly name: string
@@ -76,7 +76,7 @@
Loading
76 76
77 77
    private setLabel(): void {
78 78
        const displayStatus = this.currentOperation.Type
79 -
            ? OPERATION_STATUS[this.currentOperation.Type]
79 +
            ? operationStatus[this.currentOperation.Type]
80 80
            : `${this._info.Status.charAt(0)}${this._info.Status.slice(1).toLowerCase().replace(/\_/g, ' ')}`
81 81
        this.label = `${this._info.ServiceName} [${displayStatus}]`
82 82
    }
@@ -138,7 +138,7 @@
Loading
138 138
        }
139 139
140 140
        this._info = Object.assign(this._info, info)
141 -
        this.contextValue = `${CONTEXT_BASE}.${this._info.Status}`
141 +
        this.contextValue = `${contextBase}.${this._info.Status}`
142 142
        this.setLabel()
143 143
    }
144 144

@@ -7,7 +7,7 @@
Loading
7 7
import { RuntimeFamily } from '../../../lambda/models/samLambdaRuntime'
8 8
import { ExtContext } from '../../extensions'
9 9
import { sleep } from '../../utilities/timeoutUtils'
10 -
import { DefaultSamLocalInvokeCommand, WAIT_FOR_DEBUGGER_MESSAGES } from '../cli/samCliLocalInvoke'
10 +
import { DefaultSamLocalInvokeCommand, waitForDebuggerMessages } from '../cli/samCliLocalInvoke'
11 11
import { runLambdaFunction, waitForPort } from '../localLambdaRunner'
12 12
import { SamLaunchRequestArgs } from './awsSamDebugger'
13 13
@@ -44,7 +44,7 @@
Loading
44 44
}
45 45
46 46
export async function invokeJavaLambda(ctx: ExtContext, config: SamLaunchRequestArgs): Promise<SamLaunchRequestArgs> {
47 -
    config.samLocalInvokeCommand = new DefaultSamLocalInvokeCommand([WAIT_FOR_DEBUGGER_MESSAGES.JAVA])
47 +
    config.samLocalInvokeCommand = new DefaultSamLocalInvokeCommand([waitForDebuggerMessages.JAVA])
48 48
    // eslint-disable-next-line @typescript-eslint/unbound-method
49 49
    config.onWillAttachDebugger = async (port, timeout) => {
50 50
        await waitForPort(port, timeout, true)

@@ -17,9 +17,9 @@
Loading
17 17
import { AwsContext } from '../awsContext'
18 18
import { getIdeProperties, isCloud9 } from '../extensionUtilities'
19 19
20 -
export const DEFAULT_REGION = 'us-east-1'
21 -
export const DEFAULT_PARTITION = 'aws'
22 -
export const DEFAULT_DNS_SUFFIX = 'amazonaws.com'
20 +
export const defaultRegion = 'us-east-1'
21 +
export const defaultPartition = 'aws'
22 +
export const defaultDnsSuffix = 'amazonaws.com'
23 23
24 24
interface RegionData {
25 25
    dnsSuffix: string
@@ -44,7 +44,7 @@
Loading
44 44
    }
45 45
46 46
    public get defaultRegionId() {
47 -
        return this.awsContext.getCredentialDefaultRegion() ?? DEFAULT_REGION
47 +
        return this.awsContext.getCredentialDefaultRegion() ?? defaultRegion
48 48
    }
49 49
50 50
    public get defaultPartitionId() {

@@ -96,7 +96,7 @@
Loading
96 96
97 97
    public async promptNotConnected(): Promise<SsoConnection> {
98 98
        type ConnectionFlowEvent = Partial<MetricShapes[MetricName]> & {
99 -
            readonly codecatalyst_connectionFlow: 'Create' | 'Switch' | 'Upgrade'
99 +
            readonly codecatalyst_connectionFlow: 'Create' | 'Switch' | 'Upgrade' // eslint-disable-line @typescript-eslint/naming-convention
100 100
        }
101 101
102 102
        const conn = (await this.auth.listConnections()).find(isBuilderIdConnection)

@@ -174,11 +174,13 @@
Loading
174 174
175 175
    // Default constructs are public static so they can be validated aganist by other functions.
176 176
177 +
    // eslint-disable-next-line @typescript-eslint/naming-convention
177 178
    public static readonly NO_ITEMS_ITEM: vscode.QuickPickItem = {
178 179
        label: localize('AWS.picker.dynamic.noItemsFound.label', '[No items found]'),
179 180
        detail: localize('AWS.picker.dynamic.noItemsFound.detail', 'Click here to go back'),
180 181
        alwaysShow: true,
181 182
    }
183 +
    // eslint-disable-next-line @typescript-eslint/naming-convention
182 184
    public static readonly ERROR_ITEM: vscode.QuickPickItem = {
183 185
        label: localize('AWS.picker.dynamic.errorNode.label', 'There was an error retrieving more items.'),
184 186
        alwaysShow: true,

@@ -50,9 +50,9 @@
Loading
50 50
51 51
type CreateReason = 'unknown' | 'userCancelled' | 'fileNotFound' | 'complete' | 'error'
52 52
53 -
export const SAM_INIT_TEMPLATE_FILES: string[] = ['template.yaml', 'template.yml']
54 -
export const SAM_INIT_README_FILE: string = 'README.TOOLKIT.md'
55 -
export const SAM_INIT_README_SOURCE: string = 'resources/markdown/samReadme.md'
53 +
export const samInitTemplateFiles: string[] = ['template.yaml', 'template.yml']
54 +
export const samInitReadmeFile: string = 'README.TOOLKIT.md'
55 +
export const samInitReadmeSource: string = 'resources/markdown/samReadme.md'
56 56
57 57
export async function resumeCreateNewSamApp(
58 58
    extContext: ExtContext,
@@ -199,14 +199,14 @@
Loading
199 199
200 200
        await runSamCliInit(initArguments, samCliContext)
201 201
202 -
        const templateUri = await getProjectUri(config, SAM_INIT_TEMPLATE_FILES)
202 +
        const templateUri = await getProjectUri(config, samInitTemplateFiles)
203 203
        if (!templateUri) {
204 204
            reason = 'fileNotFound'
205 205
206 206
            return
207 207
        }
208 208
209 -
        const readmeUri = vscode.Uri.file(path.join(path.dirname(templateUri.fsPath), SAM_INIT_README_FILE))
209 +
        const readmeUri = vscode.Uri.file(path.join(path.dirname(templateUri.fsPath), samInitReadmeFile))
210 210
211 211
        // Needs to be done or else gopls won't start
212 212
        if (goRuntimes.includes(createRuntime)) {
@@ -453,7 +453,7 @@
Loading
453 453
): Promise<boolean> {
454 454
    try {
455 455
        const configString: string = configurations.reduce((acc, cur) => `${acc}\n* ${cur.name}`, '')
456 -
        const readme = (await getText(globals.context.asAbsolutePath(SAM_INIT_README_SOURCE)))
456 +
        const readme = (await getText(globals.context.asAbsolutePath(samInitReadmeSource)))
457 457
            .replace(/\$\{PRODUCTNAME\}/g, `${getIdeProperties().company} Toolkit For ${getIdeProperties().longName}`)
458 458
            .replace(/\$\{IDE\}/g, getIdeProperties().shortName)
459 459
            .replace(/\$\{CODELENS\}/g, getIdeProperties().codelens)

@@ -55,7 +55,7 @@
Loading
55 55
    'nodejs8.10',
56 56
    'nodejs10.x',
57 57
])
58 -
const DEFAULT_RUNTIMES = ImmutableMap<RuntimeFamily, Runtime>([
58 +
const defaultRuntimes = ImmutableMap<RuntimeFamily, Runtime>([
59 59
    [RuntimeFamily.NodeJS, 'nodejs14.x'],
60 60
    [RuntimeFamily.Python, 'python3.9'],
61 61
    [RuntimeFamily.DotNetCore, 'dotnetcore3.1'],
@@ -191,7 +191,7 @@
Loading
191 191
 * Provides the default runtime for a given `RuntimeFamily` or undefined if the runtime is invalid.
192 192
 */
193 193
export function getDefaultRuntime(runtime: RuntimeFamily): string | undefined {
194 -
    return DEFAULT_RUNTIMES.get(runtime)
194 +
    return defaultRuntimes.get(runtime)
195 195
}
196 196
197 197
/**

@@ -14,7 +14,7 @@
Loading
14 14
import { Commands } from '../vscode/commands2'
15 15
import globals from '../extensionGlobals'
16 16
17 -
export const TEMPLATE_FILE_GLOB_PATTERN = '**/*.{yaml,yml}'
17 +
export const templateFileGlobPattern = '**/*.{yaml,yml}'
18 18
19 19
/**
20 20
 * Match any file path that contains a .aws-sam folder. The way this works is:
@@ -22,9 +22,9 @@
Loading
22 22
 * a '/' or '\' followed by any number of characters or end of a string (so it
23 23
 * matches both /.aws-sam or /.aws-sam/<any number of characters>)
24 24
 */
25 -
export const TEMPLATE_FILE_EXCLUDE_PATTERN = /.*[/\\]\.aws-sam([/\\].*|$)/
25 +
export const templateFileExcludePattern = /.*[/\\]\.aws-sam([/\\].*|$)/
26 26
27 -
export const DEVFILE_EXCLUDE_PATTERN = /.*devfile\.(yaml|yml)/i
27 +
export const devfileExcludePattern = /.*devfile\.(yaml|yml)/i
28 28
29 29
/**
30 30
 * Creates a CloudFormationTemplateRegistry which retains the state of CloudFormation templates in a workspace.
@@ -36,9 +36,9 @@
Loading
36 36
    try {
37 37
        const registry = new CloudFormationTemplateRegistry()
38 38
        globals.templateRegistry = registry
39 -
        await registry.addExcludedPattern(DEVFILE_EXCLUDE_PATTERN)
40 -
        await registry.addExcludedPattern(TEMPLATE_FILE_EXCLUDE_PATTERN)
41 -
        await registry.addWatchPattern(TEMPLATE_FILE_GLOB_PATTERN)
39 +
        await registry.addExcludedPattern(devfileExcludePattern)
40 +
        await registry.addExcludedPattern(templateFileExcludePattern)
41 +
        await registry.addWatchPattern(templateFileGlobPattern)
42 42
        await registry.watchUntitledFiles()
43 43
    } catch (e) {
44 44
        vscode.window.showErrorMessage(

@@ -9,7 +9,7 @@
Loading
9 9
import * as vscode from 'vscode'
10 10
import * as path from 'path'
11 11
import { DevEnvClient } from '../shared/clients/devenvClient'
12 -
import { DevfileRegistry, DEVFILE_GLOB_PATTERN } from '../shared/fs/devfileRegistry'
12 +
import { DevfileRegistry, devfileGlobPattern } from '../shared/fs/devfileRegistry'
13 13
import { getLogger } from '../shared/logger'
14 14
import { Commands } from '../shared/vscode/commands2'
15 15
import { checkUnsavedChanges } from '../shared/utilities/workspaceUtils'
@@ -110,13 +110,13 @@
Loading
110 110
export function registerDevfileWatcher(devenvClient: DevEnvClient): vscode.Disposable {
111 111
    const registry = new DevfileRegistry()
112 112
    const codelensProvider = new DevfileCodeLensProvider(registry, devenvClient)
113 -
    registry.addWatchPattern(DEVFILE_GLOB_PATTERN)
113 +
    registry.addWatchPattern(devfileGlobPattern)
114 114
115 115
    const codelensDisposable = vscode.languages.registerCodeLensProvider(
116 116
        {
117 117
            language: 'yaml',
118 118
            scheme: 'file',
119 -
            pattern: DEVFILE_GLOB_PATTERN,
119 +
            pattern: devfileGlobPattern,
120 120
        },
121 121
        codelensProvider
122 122
    )

@@ -20,7 +20,7 @@
Loading
20 20
import { Commands } from '../../shared/vscode/commands'
21 21
import { getIcon } from '../../shared/icons'
22 22
23 -
export const CONTEXT_VALUE_STATE_MACHINE = 'awsStateMachineNode'
23 +
export const contextValueStateMachine = 'awsStateMachineNode'
24 24
25 25
const sfnNodeMap = new Map<string, StepFunctionsNode>()
26 26
@@ -120,7 +120,7 @@
Loading
120 120
    details: StepFunctions.StateMachineListItem
121 121
): StateMachineNode {
122 122
    const node = new StateMachineNode(parent, regionCode, details)
123 -
    node.contextValue = CONTEXT_VALUE_STATE_MACHINE
123 +
    node.contextValue = contextValueStateMachine
124 124
125 125
    return node
126 126
}

@@ -32,7 +32,7 @@
Loading
32 32
        const start = acceptanceEntry.range.start
33 33
        const end = isCloud9() ? acceptanceEntry.editor.selection.active : acceptanceEntry.range.end
34 34
        const languageId = acceptanceEntry.editor.document.languageId
35 -
        RecommendationHandler.instance.reportUserDecisionOfCurrentRecommendation(
35 +
        RecommendationHandler.instance.reportUserDecisionOfRecommendation(
36 36
            acceptanceEntry.editor,
37 37
            acceptanceEntry.acceptIndex
38 38
        )

@@ -71,7 +71,7 @@
Loading
71 71
}
72 72
73 73
// Most SSO 'expirables' are fairly long lived, so a one minute buffer is plenty.
74 -
const EXPIRATION_BUFFER_MS = 60000
74 +
const expirationBufferMs = 60000
75 75
export function isExpired(expirable: { expiresAt: Date }): boolean {
76 -
    return globals.clock.Date.now() + EXPIRATION_BUFFER_MS >= expirable.expiresAt.getTime()
76 +
    return globals.clock.Date.now() + expirationBufferMs >= expirable.expiresAt.getTime()
77 77
}

@@ -22,7 +22,7 @@
Loading
22 22
23 23
export type InputBox = Omit<vscode.InputBox, 'buttons'> & { buttons: PrompterButtons<string> }
24 24
25 -
export const DEFAULT_INPUTBOX_OPTIONS: vscode.InputBoxOptions = {
25 +
export const defaultInputboxOptions: vscode.InputBoxOptions = {
26 26
    ignoreFocusOut: true,
27 27
}
28 28
@@ -34,7 +34,7 @@
Loading
34 34
 */
35 35
export function createInputBox(options?: ExtendedInputBoxOptions): InputBoxPrompter {
36 36
    const inputBox = vscode.window.createInputBox() as InputBox
37 -
    assign({ ...DEFAULT_INPUTBOX_OPTIONS, ...options }, inputBox)
37 +
    assign({ ...defaultInputboxOptions, ...options }, inputBox)
38 38
    inputBox.buttons = options?.buttons ?? []
39 39
40 40
    const prompter = new InputBoxPrompter(inputBox)
@@ -92,10 +92,12 @@
Loading
92 92
93 93
        this.inputBox.onDidChangeValue(
94 94
            value => (this.inputBox.validationMessage = validate(value)),
95 +
            undefined,
95 96
            this.validateEvents
96 97
        )
97 98
        this.inputBox.onDidAccept(
98 99
            () => (this.inputBox.validationMessage = validate(this.inputBox.value)),
100 +
            undefined,
99 101
            this.validateEvents
100 102
        )
101 103
    }

@@ -15,7 +15,7 @@
Loading
15 15
import { YAML_FORMATS } from '../../constants/aslFormats'
16 16
import globals from '../../../shared/extensionGlobals'
17 17
18 -
const YAML_OPTIONS: yaml.Options = {
18 +
const yamlOptions: yaml.Options = {
19 19
    merge: false,
20 20
    maxAliasCount: 0,
21 21
    schema: 'yaml-1.1',
@@ -70,7 +70,7 @@
Loading
70 70
        let yamlErrors: string[] = []
71 71
72 72
        if (isYaml) {
73 -
            const parsed = yaml.parseDocument(text, YAML_OPTIONS)
73 +
            const parsed = yaml.parseDocument(text, yamlOptions)
74 74
            yamlErrors = parsed.errors.map(error => error.message)
75 75
            let json: any
76 76

@@ -48,7 +48,7 @@
Loading
48 48
}
49 49
50 50
const execFileAsync = promisify(execFile)
51 -
const MIN_GIT_FILTER_VERSION = new SemVer('2.27.0')
51 +
const minGitFilterVersion = new SemVer('2.27.0')
52 52
53 53
function formatBranch(branch?: GitTypes.Branch): string {
54 54
    return branch?.name ?? branch?.commit ?? 'unknown'
@@ -333,9 +333,9 @@
Loading
333 333
        const api = await this.validateApi(new Error('Cannot list files when the git extension is disabled'))
334 334
        const version = await this.getVersion()
335 335
336 -
        if (version === undefined || version.compare(MIN_GIT_FILTER_VERSION) === -1) {
336 +
        if (version === undefined || version.compare(minGitFilterVersion) === -1) {
337 337
            throw new Error(
338 -
                `Git version is too low or could not be determined (min=${MIN_GIT_FILTER_VERSION}): ${
338 +
                `Git version is too low or could not be determined (min=${minGitFilterVersion}): ${
339 339
                    version ?? 'unknown'
340 340
                }`
341 341
            )

@@ -18,8 +18,8 @@
Loading
18 18
import { LambdaFunctionNode } from './lambdaFunctionNode'
19 19
import { samLambdaImportableRuntimes } from '../models/samLambdaRuntime'
20 20
21 -
export const CONTEXT_VALUE_LAMBDA_FUNCTION = 'awsRegionFunctionNode'
22 -
export const CONTEXT_VALUE_LAMBDA_FUNCTION_IMPORTABLE = 'awsRegionFunctionNodeDownloadable'
21 +
export const contextValueLambdaFunction = 'awsRegionFunctionNode'
22 +
export const contextValueLambdaFunctionImportable = 'awsRegionFunctionNodeDownloadable'
23 23
24 24
/**
25 25
 * An AWS Explorer node representing the Lambda Service.
@@ -72,8 +72,8 @@
Loading
72 72
): LambdaFunctionNode {
73 73
    const node = new LambdaFunctionNode(parent, regionCode, configuration)
74 74
    node.contextValue = samLambdaImportableRuntimes.contains(node.configuration.Runtime ?? '')
75 -
        ? CONTEXT_VALUE_LAMBDA_FUNCTION_IMPORTABLE
76 -
        : CONTEXT_VALUE_LAMBDA_FUNCTION
75 +
        ? contextValueLambdaFunctionImportable
76 +
        : contextValueLambdaFunction
77 77
78 78
    return node
79 79
}

@@ -20,14 +20,14 @@
Loading
20 20
import { DefaultS3Client } from '../../../shared/clients/s3Client'
21 21
import { telemetry } from '../../../shared/telemetry/telemetry'
22 22
23 -
export const CONTEXT_VALUE_RESOURCE_OPERATIONS: any = {
23 +
export const contextValueResourceOperations: any = {
24 24
    CREATE: 'Creatable',
25 25
    DELETE: 'Deletable',
26 26
    UPDATE: 'Updatable',
27 27
}
28 -
export const CONTEXT_VALUE_RESOURCE = 'ResourceNode'
28 +
export const contextValueResource = 'ResourceNode'
29 29
30 -
const UNAVAILABLE_RESOURCE = localize('AWS.explorerNode.resources.unavailable', 'Unavailable in region')
30 +
const unavailableResource = localize('AWS.explorerNode.resources.unavailable', 'Unavailable in region')
31 31
32 32
export class ResourceTypeNode extends AWSTreeNodeBase implements LoadMoreNode {
33 33
    private readonly childLoader: ChildNodeLoader = new ChildNodeLoader(this, token => this.loadPage(token))
@@ -45,19 +45,19 @@
Loading
45 45
        )
46 46
        this.tooltip = typeName
47 47
        const supportedOperations = metadata.operations
48 -
            ? metadata.operations.map(op => CONTEXT_VALUE_RESOURCE_OPERATIONS[op])
49 -
            : Object.values(CONTEXT_VALUE_RESOURCE_OPERATIONS)
48 +
            ? metadata.operations.map(op => contextValueResourceOperations[op])
49 +
            : Object.values(contextValueResourceOperations)
50 50
51 51
        if (!metadata.available) {
52 52
            this.contextValue = 'UnavailableResourceTypeNode'
53 -
            this.description = !metadata.available ? UNAVAILABLE_RESOURCE : ''
53 +
            this.description = !metadata.available ? unavailableResource : ''
54 54
        } else {
55 55
            const documentedContextValue = metadata.documentation ? 'Documented' : ''
56 56
            const createContextValue = supportedOperations.includes('Creatable') ? 'Creatable' : ''
57 57
            this.contextValue = `${documentedContextValue}${createContextValue}ResourceTypeNode`
58 58
        }
59 59
60 -
        this.childContextValue = supportedOperations.join('') + CONTEXT_VALUE_RESOURCE
60 +
        this.childContextValue = supportedOperations.join('') + contextValueResource
61 61
    }
62 62
63 63
    public async getChildren(): Promise<AWSTreeNodeBase[]> {
@@ -73,7 +73,7 @@
Loading
73 73
                    getLogger().warn(
74 74
                        `Resource type ${this.typeName} does not support LIST action in ${this.parent.region}`
75 75
                    )
76 -
                    return new PlaceholderNode(this, `[${UNAVAILABLE_RESOURCE}]`)
76 +
                    return new PlaceholderNode(this, `[${unavailableResource}]`)
77 77
                } else {
78 78
                    result = 'Failed'
79 79
                    return new TreeShim(createErrorItem(error, `Resources: unexpected error: ${error.message}`))

@@ -10,11 +10,10 @@
Loading
10 10
import { InterfaceNoSymbol } from '../utilities/tsUtils'
11 11
import globals from '../extensionGlobals'
12 12
13 -
export const DEFAULT_MAX_THINGS = 250 // 250 is the maximum allowed by the API
14 -
export const DEFAULT_DELIMITER = '/'
13 +
const defaultMaxThings = 250 // 250 is the maximum allowed by the API
15 14
16 15
/* ATS is recommended over the deprecated Verisign certificates */
17 -
const IOT_ENDPOINT_TYPE = 'iot:Data-ATS'
16 +
const iotEndpointType = 'iot:Data-ATS'
18 17
19 18
export type IotThing = { readonly name: string; readonly arn: string }
20 19
export type IotCertificate = {
@@ -26,9 +25,9 @@
Loading
26 25
export type IotPolicy = IotThing
27 26
export type IotClient = InterfaceNoSymbol<DefaultIotClient>
28 27
29 -
const IOT_SERVICE_ARN = 'iot'
28 +
const iotServiceArn = 'iot'
30 29
//Pattern to extract the certificate ID from the parsed ARN resource.
31 -
const CERT_ARN_RESOURCE_PATTERN = /cert\/(\w+)/
30 +
const certArnResourcePattern = /cert\/(\w+)/
32 31
33 32
export interface ListThingCertificatesResponse {
34 33
    readonly certificates: Iot.CertificateDescription[]
@@ -52,7 +51,7 @@
Loading
52 51
53 52
        const output: Iot.ListThingsResponse = await iot
54 53
            .listThings({
55 -
                maxResults: request?.maxResults ?? DEFAULT_MAX_THINGS,
54 +
                maxResults: request?.maxResults ?? defaultMaxThings,
56 55
                nextToken: request?.nextToken,
57 56
            })
58 57
            .promise()
@@ -101,7 +100,7 @@
Loading
101 100
102 101
        const output: Iot.ListCertificatesResponse = await iot
103 102
            .listCertificates({
104 -
                pageSize: request.pageSize ?? DEFAULT_MAX_THINGS,
103 +
                pageSize: request.pageSize ?? defaultMaxThings,
105 104
                marker: request.marker,
106 105
                ascendingOrder: request.ascendingOrder,
107 106
            })
@@ -127,7 +126,7 @@
Loading
127 126
        const output: Iot.ListThingPrincipalsResponse = await iot
128 127
            .listThingPrincipals({
129 128
                thingName: request.thingName,
130 -
                maxResults: request.maxResults ?? DEFAULT_MAX_THINGS,
129 +
                maxResults: request.maxResults ?? defaultMaxThings,
131 130
                nextToken: request.nextToken,
132 131
            })
133 132
            .promise()
@@ -170,8 +169,8 @@
Loading
170 169
171 170
        const describedCerts = iotPrincipals.map(async iotPrincipal => {
172 171
            const principalArn = parse(iotPrincipal)
173 -
            const certIdFound = principalArn.resource.match(CERT_ARN_RESOURCE_PATTERN)
174 -
            if (principalArn.service != IOT_SERVICE_ARN || !certIdFound) {
172 +
            const certIdFound = principalArn.resource.match(certArnResourcePattern)
173 +
            if (principalArn.service != iotServiceArn || !certIdFound) {
175 174
                return undefined
176 175
            }
177 176
            const certId = certIdFound[1]
@@ -201,7 +200,7 @@
Loading
201 200
202 201
        const output = await iot
203 202
            .listPrincipalThings({
204 -
                maxResults: request.maxResults ?? DEFAULT_MAX_THINGS,
203 +
                maxResults: request.maxResults ?? defaultMaxThings,
205 204
                nextToken: request.nextToken,
206 205
                principal: request.principal,
207 206
            })
@@ -300,7 +299,7 @@
Loading
300 299
301 300
        const output: Iot.ListPoliciesResponse = await iot
302 301
            .listPolicies({
303 -
                pageSize: request.pageSize ?? DEFAULT_MAX_THINGS,
302 +
                pageSize: request.pageSize ?? defaultMaxThings,
304 303
                marker: request.marker,
305 304
                ascendingOrder: request.ascendingOrder,
306 305
            })
@@ -322,7 +321,7 @@
Loading
322 321
        const output: Iot.ListPrincipalPoliciesResponse = await iot
323 322
            .listPrincipalPolicies({
324 323
                principal: request.principal,
325 -
                pageSize: request.pageSize ?? DEFAULT_MAX_THINGS,
324 +
                pageSize: request.pageSize ?? defaultMaxThings,
326 325
                marker: request.marker,
327 326
                ascendingOrder: request.ascendingOrder,
328 327
            })
@@ -346,7 +345,7 @@
Loading
346 345
347 346
        const output = await iot
348 347
            .listTargetsForPolicy({
349 -
                pageSize: request.pageSize ?? DEFAULT_MAX_THINGS,
348 +
                pageSize: request.pageSize ?? defaultMaxThings,
350 349
                marker: request.marker,
351 350
                policyName: request.policyName,
352 351
            })
@@ -427,7 +426,7 @@
Loading
427 426
        getLogger().debug('GetEndpoint called')
428 427
        const iot = await this.iotProvider(this.regionCode)
429 428
430 -
        const output = await iot.describeEndpoint({ endpointType: IOT_ENDPOINT_TYPE }).promise()
429 +
        const output = await iot.describeEndpoint({ endpointType: iotEndpointType }).promise()
431 430
        if (!output.endpointAddress) {
432 431
            throw new Error('Failed to retrieve endpoint')
433 432
        }

@@ -103,7 +103,7 @@
Loading
103 103
 */
104 104
export const welcomeCodeWhispererReadmeFileSource = 'resources/markdown/WelcomeToCodeWhisperer.md'
105 105
106 -
export const welcomeCodeWhispererCloud9ReadmeFileSource = 'resources/markdown/WelcomeToCodeWhispererCloud9.md'
106 +
export const welcomeCodeWhispererCloud9Readme = 'resources/markdown/WelcomeToCodeWhispererCloud9.md'
107 107
108 108
export const welcomeMessageKey = 'CODEWHISPERER_WELCOME_MESSAGE'
109 109
@@ -242,7 +242,7 @@
Loading
242 242
243 243
export const accessTokenMigrationDoNotShowAgainKey = 'CODEWHISPERER_ACCESS_TOKEN_MIGRATION_DO_NOT_SHOW_AGAIN'
244 244
245 -
export const accessTokenMigrationDoNotShowAgainLastShown =
245 +
export const accessTokenMigrationDoNotShowLastShown =
246 246
    'CODEWHISPERER_ACCESS_TOKEN_MIGRATION_DO_NOT_SHOW_AGAIN_LAST_SHOWN_TIME'
247 247
248 248
export const accessTokenMigrationDoNotShowAgainInfo = `You will not receive this notification again. If you would like to continue using CodeWhisperer after January 31, 2023, you can still connect with AWS. [Learn More](https://docs.aws.amazon.com/toolkit-for-vscode/latest/userguide/codewhisper-setup-general.html).`

@@ -11,7 +11,7 @@
Loading
11 11
import path = require('path')
12 12
import { sleep } from '../../../shared/utilities/timeoutUtils'
13 13
14 -
export const IMPORT_REGEX =
14 +
export const importRegex =
15 15
    /^(?:from[ ]+(\S+)[ ]+)?import[ ]+(\S+)(?:[ ]+as[ ]+\S+)?[ ]*([,]*[ ]+(\S+)(?:[ ]+as[ ]+\S+)?[ ]*)*$/gm
16 16
17 17
export class PythonDependencyGraph extends DependencyGraph {
@@ -30,7 +30,7 @@
Loading
30 30
    private async readImports(uri: vscode.Uri) {
31 31
        const content: string = await readFileAsString(uri.fsPath)
32 32
        this._totalLines += content.split(DependencyGraphConstants.newlineRegex).length
33 -
        const regExp = new RegExp(IMPORT_REGEX)
33 +
        const regExp = new RegExp(importRegex)
34 34
        return content.match(regExp) ?? []
35 35
    }
36 36

@@ -16,7 +16,7 @@
Loading
16 16
 * Detects functions that could possibly be used as Lambda Function Handlers from a Typescript file.
17 17
 */
18 18
export class TypescriptLambdaHandlerSearch implements LambdaHandlerSearch {
19 -
    public static readonly MAXIMUM_FUNCTION_PARAMETERS: number = 3
19 +
    public static readonly maximumFunctionParameters: number = 3
20 20
21 21
    private readonly _baseFilename: string
22 22
    // _candidateDeclaredFunctionNames - names of functions that could be lambda handlers
@@ -67,7 +67,7 @@
Loading
67 67
68 68
        handlers.push(...this.findCandidateHandlersInModuleExports())
69 69
        handlers.push(...this.findCandidateHandlersInExportedFunctions())
70 -
        handlers.push(...this.findCandidateHandlersInExportDeclarations())
70 +
        handlers.push(...this.findCandidateHandlersInExportDecls())
71 71
72 72
        return handlers
73 73
    }
@@ -158,7 +158,7 @@
Loading
158 158
    /**
159 159
     * @description Looks at "export { xyz }" statements to find candidate Lambda handlers
160 160
     */
161 -
    private findCandidateHandlersInExportDeclarations(): RootlessLambdaHandlerCandidate[] {
161 +
    private findCandidateHandlersInExportDecls(): RootlessLambdaHandlerCandidate[] {
162 162
        const handlers: RootlessLambdaHandlerCandidate[] = []
163 163
164 164
        this._candidateExportDeclarations.forEach(exportDeclaration => {
@@ -289,7 +289,7 @@
Loading
289 289
     */
290 290
    private static isValidFunctionAssignment(expression: ts.Expression): boolean {
291 291
        if (ts.isFunctionLike(expression)) {
292 -
            return expression.parameters.length <= TypescriptLambdaHandlerSearch.MAXIMUM_FUNCTION_PARAMETERS
292 +
            return expression.parameters.length <= TypescriptLambdaHandlerSearch.maximumFunctionParameters
293 293
        }
294 294
295 295
        return false
@@ -317,6 +317,6 @@
Loading
317 317
    ): boolean {
318 318
        const nameIsValid: boolean = !validateName || !!node.name
319 319
320 -
        return node.parameters.length <= TypescriptLambdaHandlerSearch.MAXIMUM_FUNCTION_PARAMETERS && nameIsValid
320 +
        return node.parameters.length <= TypescriptLambdaHandlerSearch.maximumFunctionParameters && nameIsValid
321 321
    }
322 322
}

@@ -9,7 +9,7 @@
Loading
9 9
    getConfigFilename,
10 10
    getCredentialsFilename,
11 11
    loadSharedCredentialsProfiles,
12 -
    updateAwsSdkLoadConfigEnvironmentVariable,
12 +
    updateAwsSdkLoadConfigEnvVar,
13 13
} from '../sharedCredentials'
14 14
import { CredentialsProviderType } from './credentials'
15 15
import { BaseCredentialsProviderFactory } from './credentialsProviderFactory'
@@ -55,7 +55,7 @@
Loading
55 55
        const allCredentialProfiles = await loadSharedCredentialsProfiles()
56 56
        this.loadedCredentialsModificationMillis = await this.getLastModifiedMillis(getCredentialsFilename())
57 57
        this.loadedConfigModificationMillis = await this.getLastModifiedMillis(getConfigFilename())
58 -
        await updateAwsSdkLoadConfigEnvironmentVariable()
58 +
        await updateAwsSdkLoadConfigEnvVar()
59 59
60 60
        const profileNames = Array.from(allCredentialProfiles.keys())
61 61
        getLogger().verbose(`credentials: found profiles: ${profileNames}`)

@@ -27,10 +27,7 @@
Loading
27 27
    SamTemplate,
28 28
} from '../models/samTemplates'
29 29
import * as semver from 'semver'
30 -
import {
31 -
    MINIMUM_SAM_CLI_VERSION_INCLUSIVE_FOR_ARM_SUPPORT,
32 -
    MINIMUM_SAM_CLI_VERSION_INCLUSIVE_FOR_IMAGE_SUPPORT,
33 -
} from '../../shared/sam/cli/samCliValidator'
30 +
import { minSamCliVersionForArmSupport, minSamCliVersionForImageSupport } from '../../shared/sam/cli/samCliValidator'
34 31
import * as fsutil from '../../shared/filesystemUtilities'
35 32
import { Wizard } from '../../shared/wizards/wizard'
36 33
import { createFolderPrompt } from '../../shared/ui/common/location'
@@ -57,7 +54,7 @@
Loading
57 54
58 55
function createRuntimePrompter(samCliVersion: string): QuickPickPrompter<RuntimeAndPackage> {
59 56
    return createRuntimeQuickPick({
60 -
        showImageRuntimes: semver.gte(samCliVersion, MINIMUM_SAM_CLI_VERSION_INCLUSIVE_FOR_IMAGE_SUPPORT),
57 +
        showImageRuntimes: semver.gte(samCliVersion, minSamCliVersionForImageSupport),
61 58
        buttons: createCommonButtons(samInitDocUrl),
62 59
    })
63 60
}
@@ -226,7 +223,7 @@
Loading
226 223
                return false
227 224
            }
228 225
229 -
            if (semver.lt(context.samCliVersion, MINIMUM_SAM_CLI_VERSION_INCLUSIVE_FOR_ARM_SUPPORT)) {
226 +
            if (semver.lt(context.samCliVersion, minSamCliVersionForArmSupport)) {
230 227
                return false
231 228
            }
232 229

@@ -10,22 +10,22 @@
Loading
10 10
import { normalizeSeparator } from '../utilities/pathUtils'
11 11
import { findParentProjectFile } from '../utilities/workspaceUtils'
12 12
13 -
export const JAVASCRIPT_LANGUAGE = 'javascript'
13 +
export const javascriptLanguage = 'javascript'
14 14
15 -
export const TYPESCRIPT_LANGUAGE = 'typescript'
15 +
export const typescriptLanguage = 'typescript'
16 16
17 -
export const TYPESCRIPT_ALL_FILES: vscode.DocumentFilter[] = [
17 +
export const typescriptAllFiles: vscode.DocumentFilter[] = [
18 18
    {
19 -
        language: JAVASCRIPT_LANGUAGE,
19 +
        language: javascriptLanguage,
20 20
        scheme: 'file',
21 21
    },
22 22
    {
23 -
        language: TYPESCRIPT_LANGUAGE,
23 +
        language: typescriptLanguage,
24 24
        scheme: 'file',
25 25
    },
26 26
]
27 27
28 -
export const JAVASCRIPT_BASE_PATTERN = '**/package.json'
28 +
export const javascriptBasePattern = '**/package.json'
29 29
30 30
export async function getLambdaHandlerCandidates(document: vscode.TextDocument): Promise<LambdaHandlerCandidate[]> {
31 31
    const rootUri = (await findParentProjectFile(document.uri, /^package\.json$/)) || document.uri

@@ -38,7 +38,7 @@
Loading
38 38
import { isClientFault } from '../../shared/errors'
39 39
import { DevSettings } from '../../shared/settings'
40 40
41 -
const BACKOFF_DELAY_MS = 5000
41 +
const backoffDelayMs = 5000
42 42
export class OidcClient {
43 43
    public constructor(private readonly client: SSOOIDC, private readonly clock: { Date: typeof Date }) {}
44 44
@@ -75,7 +75,7 @@
Loading
75 75
        }
76 76
    }
77 77
78 -
    public async pollForToken(request: CreateTokenRequest, timeout: number, interval = BACKOFF_DELAY_MS) {
78 +
    public async pollForToken(request: CreateTokenRequest, timeout: number, interval = backoffDelayMs) {
79 79
        while (this.clock.Date.now() + interval <= timeout) {
80 80
            try {
81 81
                return await this.createToken(request)
@@ -85,7 +85,7 @@
Loading
85 85
                }
86 86
87 87
                if (err instanceof SlowDownException) {
88 -
                    interval += BACKOFF_DELAY_MS
88 +
                    interval += backoffDelayMs
89 89
                } else if (!(err instanceof AuthorizationPendingException)) {
90 90
                    throw err
91 91
                }

@@ -5,11 +5,11 @@
Loading
5 5
6 6
import * as vscode from 'vscode'
7 7
8 -
export const LOG_OUTPUT_CHANNEL: vscode.OutputChannel = vscode.window.createOutputChannel('AWS Toolkit Logs')
8 +
export const logOutputChannel: vscode.OutputChannel = vscode.window.createOutputChannel('AWS Toolkit Logs')
9 9
10 10
/**
11 11
 * Shows the log output channel.
12 12
 */
13 13
export function showLogOutputChannel({ preserveFocus = true }: { preserveFocus?: boolean } = {}): void {
14 -
    LOG_OUTPUT_CHANNEL.show(preserveFocus)
14 +
    logOutputChannel.show(preserveFocus)
15 15
}

@@ -23,7 +23,7 @@
Loading
23 23
    executeCommand: typeof vscode.commands.executeCommand
24 24
}
25 25
26 -
class DefaultConfigureParameterOverridesContext implements ConfigureParameterOverridesContext {
26 +
class DefaultConfigureParamOverridesContext implements ConfigureParameterOverridesContext {
27 27
    public readonly getWorkspaceFolder = vscode.workspace.getWorkspaceFolder
28 28
29 29
    public readonly showErrorMessage = vscode.window.showErrorMessage
@@ -41,7 +41,7 @@
Loading
41 41
        templateUri: vscode.Uri
42 42
        requiredParameterNames?: Iterable<string>
43 43
    },
44 -
    context: ConfigureParameterOverridesContext = new DefaultConfigureParameterOverridesContext()
44 +
    context: ConfigureParameterOverridesContext = new DefaultConfigureParamOverridesContext()
45 45
): Promise<void> {
46 46
    const workspaceFolder = context.getWorkspaceFolder(templateUri)
47 47
    if (!workspaceFolder) {

@@ -17,7 +17,7 @@
Loading
17 17
18 18
const localize = nls.loadMessageBundle()
19 19
20 -
export const WAIT_FOR_DEBUGGER_MESSAGES = {
20 +
export const waitForDebuggerMessages = {
21 21
    PYTHON: 'Debugger waiting for client...',
22 22
    PYTHON_IKPDB: 'IKP3db listening on',
23 23
    NODEJS: 'Debugger listening on',
@@ -54,10 +54,7 @@
Loading
54 54
    private readonly logger: Logger = getLogger()
55 55
56 56
    public constructor(
57 -
        private readonly debuggerAttachCues: string[] = [
58 -
            WAIT_FOR_DEBUGGER_MESSAGES.PYTHON,
59 -
            WAIT_FOR_DEBUGGER_MESSAGES.NODEJS,
60 -
        ]
57 +
        private readonly debuggerAttachCues: string[] = [waitForDebuggerMessages.PYTHON, waitForDebuggerMessages.NODEJS]
61 58
    ) {}
62 59
63 60
    public async invoke({ options, ...params }: SamLocalInvokeCommandArgs): Promise<ChildProcess> {

@@ -11,7 +11,7 @@
Loading
11 11
import { Logger, LogLevel, getLogger } from '.'
12 12
import { extensionSettingsPrefix } from '../constants'
13 13
import { setLogger } from './logger'
14 -
import { LOG_OUTPUT_CHANNEL } from './outputChannel'
14 +
import { logOutputChannel } from './outputChannel'
15 15
import { WinstonToolkitLogger } from './winstonToolkitLogger'
16 16
import { waitUntil } from '../utilities/timeoutUtils'
17 17
import { cleanLogFiles } from './util'
@@ -21,7 +21,7 @@
Loading
21 21
22 22
const localize = nls.loadMessageBundle()
23 23
24 -
const DEFAULT_LOG_LEVEL: LogLevel = 'info'
24 +
const defaultLogLevel: LogLevel = 'info'
25 25
26 26
/**
27 27
 * Activate Logger functionality for the extension.
@@ -30,7 +30,7 @@
Loading
30 30
    extensionContext: vscode.ExtensionContext,
31 31
    outputChannel: vscode.OutputChannel
32 32
): Promise<void> {
33 -
    const logOutputChannel = LOG_OUTPUT_CHANNEL
33 +
    const chan = logOutputChannel
34 34
    const logUri = vscode.Uri.joinPath(extensionContext.logUri, makeLogFilename())
35 35
36 36
    await SystemUtilities.createDirectory(extensionContext.logUri)
@@ -38,7 +38,7 @@
Loading
38 38
    const mainLogger = makeLogger(
39 39
        {
40 40
            logPaths: [logUri.fsPath],
41 -
            outputChannels: [logOutputChannel],
41 +
            outputChannels: [chan],
42 42
        },
43 43
        extensionContext.subscriptions
44 44
    )
@@ -51,7 +51,7 @@
Loading
51 51
        makeLogger(
52 52
            {
53 53
                logPaths: [logUri.fsPath],
54 -
                outputChannels: [outputChannel, logOutputChannel],
54 +
                outputChannels: [outputChannel, chan],
55 55
            },
56 56
            extensionContext.subscriptions
57 57
        ),
@@ -63,7 +63,7 @@
Loading
63 63
        makeLogger(
64 64
            {
65 65
                staticLogLevel: 'verbose', // verbose will log anything
66 -
                outputChannels: [outputChannel, logOutputChannel],
66 +
                outputChannels: [outputChannel, chan],
67 67
                useDebugConsole: true,
68 68
            },
69 69
            extensionContext.subscriptions
@@ -136,7 +136,7 @@
Loading
136 136
function getLogLevel(): LogLevel {
137 137
    const configuration = Settings.instance.getSection(extensionSettingsPrefix)
138 138
139 -
    return configuration.get('logLevel', DEFAULT_LOG_LEVEL)
139 +
    return configuration.get('logLevel', defaultLogLevel)
140 140
}
141 141
142 142
function makeLogFilename(): string {

@@ -36,7 +36,7 @@
Loading
36 36
    readonly reason?: string
37 37
}
38 38
39 -
export const HOST_NAME_PREFIX = 'aws-devenv-'
39 +
export const hostNamePrefix = 'aws-devenv-'
40 40
41 41
export async function ensureDependencies(
42 42
    window = vscode.window
@@ -180,7 +180,7 @@
Loading
180 180
    return Result.ok()
181 181
}
182 182
183 -
const configHostName = `${HOST_NAME_PREFIX}*`
183 +
const configHostName = `${hostNamePrefix}*`
184 184
function createSSHConfigSection(proxyCommand: string): string {
185 185
    // "AddKeysToAgent" will automatically add keys used on the server to the local agent. If not set, then `ssh-add`
186 186
    // must be done locally. It's mostly a convenience thing; private keys are _not_ shared with the server.
@@ -205,7 +205,7 @@
Loading
205 205
    section: string
206 206
    proxyCommand: string
207 207
}) {
208 -
    const matchResult = await matchSshSection(sshPath, `${HOST_NAME_PREFIX}test`)
208 +
    const matchResult = await matchSshSection(sshPath, `${hostNamePrefix}test`)
209 209
    if (matchResult.isErr()) {
210 210
        return matchResult
211 211
    }

@@ -16,15 +16,13 @@
Loading
16 16
    nextToken?: string
17 17
}
18 18
19 -
const MAX_RESULTS_PER_RESPONSE = 10
19 +
const maxResultsPerResponse = 10
20 20
export class DefaultEcsClient {
21 21
    public constructor(public readonly regionCode: string) {}
22 22
23 23
    public async getClusters(nextToken?: string): Promise<EcsResourceAndToken> {
24 24
        const sdkClient = await this.createSdkClient()
25 -
        const clusterArnList = await sdkClient
26 -
            .listClusters({ maxResults: MAX_RESULTS_PER_RESPONSE, nextToken })
27 -
            .promise()
25 +
        const clusterArnList = await sdkClient.listClusters({ maxResults: maxResultsPerResponse, nextToken }).promise()
28 26
        if (clusterArnList.clusterArns?.length === 0) {
29 27
            return { resource: [] }
30 28
        }
@@ -54,7 +52,7 @@
Loading
54 52
    public async getServices(cluster: string, nextToken?: string): Promise<EcsResourceAndToken> {
55 53
        const sdkClient = await this.createSdkClient()
56 54
        const serviceArnList = await sdkClient
57 -
            .listServices({ cluster: cluster, maxResults: MAX_RESULTS_PER_RESPONSE, nextToken })
55 +
            .listServices({ cluster: cluster, maxResults: maxResultsPerResponse, nextToken })
58 56
            .promise()
59 57
        if (serviceArnList.serviceArns?.length === 0) {
60 58
            return { resource: [] }

@@ -18,9 +18,9 @@
Loading
18 18
import { SystemUtilities } from './systemUtilities'
19 19
import { normalizeVSCodeUri } from './utilities/vsCodeUtils'
20 20
21 -
const GOFORMATION_MANIFEST_URL = 'https://api.github.com/repos/awslabs/goformation/releases/latest'
22 -
const DEVFILE_MANIFEST_URL = 'https://api.github.com/repos/devfile/api/releases/latest'
23 -
const SCHEMA_PREFIX = `${AWS_SCHEME}://`
21 +
const goformationManifestUrl = 'https://api.github.com/repos/awslabs/goformation/releases/latest'
22 +
const devfileManifestUrl = 'https://api.github.com/repos/devfile/api/releases/latest'
23 +
const schemaPrefix = `${AWS_SCHEME}://`
24 24
25 25
export type Schemas = { [key: string]: vscode.Uri }
26 26
export type SchemaType = 'yaml' | 'json'
@@ -42,7 +42,7 @@
Loading
42 42
 * Processes the update of schema mappings for files in the workspace
43 43
 */
44 44
export class SchemaService {
45 -
    private static readonly DEFAULT_UPDATE_PERIOD_MILLIS = 1000
45 +
    private static readonly defaultUpdatePeriodMillis = 1000
46 46
47 47
    private updatePeriod: number
48 48
    private timer?: NodeJS.Timer
@@ -60,7 +60,7 @@
Loading
60 60
            handlers?: Map<SchemaType, SchemaHandler>
61 61
        }
62 62
    ) {
63 -
        this.updatePeriod = opts?.updatePeriod ?? SchemaService.DEFAULT_UPDATE_PERIOD_MILLIS
63 +
        this.updatePeriod = opts?.updatePeriod ?? SchemaService.defaultUpdatePeriodMillis
64 64
        this.schemas = opts?.schemas
65 65
        this.handlers =
66 66
            opts?.handlers ??
@@ -144,8 +144,8 @@
Loading
144 144
    const samSchemaUri = vscode.Uri.joinPath(extensionContext.globalStorageUri, 'sam.schema.json')
145 145
    const devfileSchemaUri = vscode.Uri.joinPath(extensionContext.globalStorageUri, 'devfile.schema.json')
146 146
147 -
    const goformationSchemaVersion = await getPropertyFromJsonUrl(GOFORMATION_MANIFEST_URL, 'tag_name')
148 -
    const devfileSchemaVersion = await getPropertyFromJsonUrl(DEVFILE_MANIFEST_URL, 'tag_name')
147 +
    const goformationSchemaVersion = await getPropertyFromJsonUrl(goformationManifestUrl, 'tag_name')
148 +
    const devfileSchemaVersion = await getPropertyFromJsonUrl(devfileManifestUrl, 'tag_name')
149 149
150 150
    const schemas: Schemas = {}
151 151
@@ -156,7 +156,7 @@
Loading
156 156
            url: `https://raw.githubusercontent.com/awslabs/goformation/${goformationSchemaVersion}/schema/cloudformation.schema.json`,
157 157
            cacheKey: 'cfnSchemaVersion',
158 158
            extensionContext,
159 -
            title: SCHEMA_PREFIX + 'cloudformation.schema.json',
159 +
            title: schemaPrefix + 'cloudformation.schema.json',
160 160
        })
161 161
        schemas['cfn'] = cfnSchemaUri
162 162
    } catch (e) {
@@ -170,7 +170,7 @@
Loading
170 170
            url: `https://raw.githubusercontent.com/awslabs/goformation/${goformationSchemaVersion}/schema/sam.schema.json`,
171 171
            cacheKey: 'samSchemaVersion',
172 172
            extensionContext,
173 -
            title: SCHEMA_PREFIX + 'sam.schema.json',
173 +
            title: schemaPrefix + 'sam.schema.json',
174 174
        })
175 175
        schemas['sam'] = samSchemaUri
176 176
    } catch (e) {
@@ -184,7 +184,7 @@
Loading
184 184
            url: `https://raw.githubusercontent.com/devfile/api/${devfileSchemaVersion}/schemas/latest/devfile.json`,
185 185
            cacheKey: 'devfileSchemaVersion',
186 186
            extensionContext,
187 -
            title: SCHEMA_PREFIX + 'devfile.schema.json',
187 +
            title: schemaPrefix + 'devfile.schema.json',
188 188
        })
189 189
        schemas['devfile'] = devfileSchemaUri
190 190
    } catch (e) {

@@ -11,14 +11,14 @@
Loading
11 11
import * as filesystemUtilities from '../filesystemUtilities'
12 12
import { SystemUtilities } from '../systemUtilities'
13 13
import { getLogger } from '../logger'
14 -
import { LAMBDA_PACKAGE_TYPE_IMAGE } from '../constants'
14 +
import { lambdaPackageTypeImage } from '../constants'
15 15
import { isCloud9 } from '../extensionUtilities'
16 16
import { Window } from '../vscode/window'
17 17
18 18
export namespace CloudFormation {
19 -
    export const SERVERLESS_API_TYPE = 'AWS::Serverless::Api'
20 -
    export const SERVERLESS_FUNCTION_TYPE = 'AWS::Serverless::Function'
21 -
    export const LAMBDA_FUNCTION_TYPE = 'AWS::Lambda::Function'
19 +
    export const SERVERLESS_API_TYPE = 'AWS::Serverless::Api' // eslint-disable-line @typescript-eslint/naming-convention
20 +
    export const SERVERLESS_FUNCTION_TYPE = 'AWS::Serverless::Function' // eslint-disable-line @typescript-eslint/naming-convention
21 +
    export const LAMBDA_FUNCTION_TYPE = 'AWS::Lambda::Function' // eslint-disable-line @typescript-eslint/naming-convention
22 22
23 23
    export function isZipLambdaResource(
24 24
        resource?: ZipResourceProperties | ImageResourceProperties
@@ -421,7 +421,7 @@
Loading
421 421
            throw new Error('Missing or invalid value in Template for key: Type')
422 422
        }
423 423
        if (resource.Properties) {
424 -
            if (resource.Properties.PackageType === LAMBDA_PACKAGE_TYPE_IMAGE) {
424 +
            if (resource.Properties.PackageType === lambdaPackageTypeImage) {
425 425
                if (!validatePropertyType(resource.Metadata, 'Dockerfile', template, 'string')) {
426 426
                    throw new Error('Missing or invalid value in Template for key: Metadata.Dockerfile')
427 427
                }

@@ -214,8 +214,8 @@
Loading
214 214
    })
215 215
    const { hostname, vscPath, sshPath, SessionProcess } = connection
216 216
217 -
    const EXT_ID = VSCODE_EXTENSION_ID.awstoolkit
218 -
    const EXT_PATH = `/home/mde-user/.vscode-server/extensions`
217 +
    const extId = VSCODE_EXTENSION_ID.awstoolkit
218 +
    const extPath = `/home/mde-user/.vscode-server/extensions`
219 219
    const userWithHost = `mde-user@${hostname}`
220 220
221 221
    if (path.extname(resp) !== '.vsix') {
@@ -223,7 +223,7 @@
Loading
223 223
224 224
        const packageData = await fs.readFile(path.join(resp, 'package.json'), 'utf-8')
225 225
        const targetManfiest: typeof manifest = JSON.parse(packageData)
226 -
        const destName = `${EXT_PATH}/${EXT_ID}-${targetManfiest.version}`
226 +
        const destName = `${extPath}/${extId}-${targetManfiest.version}`
227 227
        const source = `${resp}${path.sep}`
228 228
229 229
        // Using `.vscodeignore` would be nice here but `rsync` doesn't understand glob patterns
@@ -248,14 +248,14 @@
Loading
248 248
            .reverse()
249 249
            .slice(0, 2)
250 250
            .map(s => s.replace('.vsix', ''))
251 -
        const destName = [EXT_ID, ...suffixParts.reverse()].join('-')
251 +
        const destName = [extId, ...suffixParts.reverse()].join('-')
252 252
253 253
        const installCmd = [
254 -
            `rm ${EXT_PATH}/.obsolete || true`,
255 -
            `find ${EXT_PATH} -type d -name '${EXT_ID}*' -exec rm -rf {} +`,
256 -
            `unzip ${remoteVsix} "extension/*" "extension.vsixmanifest" -d ${EXT_PATH}`,
257 -
            `mv ${EXT_PATH}/extension ${EXT_PATH}/${destName}`,
258 -
            `mv ${EXT_PATH}/extension.vsixmanifest ${EXT_PATH}/${destName}/.vsixmanifest`,
254 +
            `rm ${extPath}/.obsolete || true`,
255 +
            `find ${extPath} -type d -name '${extId}*' -exec rm -rf {} +`,
256 +
            `unzip ${remoteVsix} "extension/*" "extension.vsixmanifest" -d ${extPath}`,
257 +
            `mv ${extPath}/extension ${extPath}/${destName}`,
258 +
            `mv ${extPath}/extension.vsixmanifest ${extPath}/${destName}/.vsixmanifest`,
259 259
        ].join(' && ')
260 260
261 261
        progress.report({ message: 'Installing VSIX...' })

@@ -136,7 +136,7 @@
Loading
136 136
137 137
        RecommendationHandler.instance.cancelPaginatedRequest()
138 138
        // report all recommendation as rejected
139 -
        RecommendationHandler.instance.reportUserDecisionOfCurrentRecommendation(editor, -1)
139 +
        RecommendationHandler.instance.reportUserDecisionOfRecommendation(editor, -1)
140 140
    }
141 141
142 142
    async rejectRecommendation(
@@ -329,7 +329,7 @@
Loading
329 329
        config: ConfigurationEntry,
330 330
        autoTriggerType?: CodewhispererAutomatedTriggerType
331 331
    ) {
332 -
        RecommendationHandler.instance.reportUserDecisionOfCurrentRecommendation(editor, -1)
332 +
        RecommendationHandler.instance.reportUserDecisionOfRecommendation(editor, -1)
333 333
        RecommendationHandler.instance.clearRecommendations()
334 334
        this.setCodeWhispererStatusBarLoading()
335 335
        const isManualTrigger = triggerType === 'OnDemand'
@@ -355,7 +355,7 @@
Loading
355 355
                )
356 356
                this.setCompletionItems(editor)
357 357
                if (RecommendationHandler.instance.checkAndResetCancellationTokens()) {
358 -
                    RecommendationHandler.instance.reportUserDecisionOfCurrentRecommendation(editor, -1)
358 +
                    RecommendationHandler.instance.reportUserDecisionOfRecommendation(editor, -1)
359 359
                    RecommendationHandler.instance.clearRecommendations()
360 360
                    break
361 361
                }
@@ -397,7 +397,7 @@
Loading
397 397
                    RecommendationHandler.instance.recommendations.forEach((r, i) => {
398 398
                        RecommendationHandler.instance.setSuggestionState(i, 'Discard')
399 399
                    })
400 -
                    RecommendationHandler.instance.reportUserDecisionOfCurrentRecommendation(editor, -1)
400 +
                    RecommendationHandler.instance.reportUserDecisionOfRecommendation(editor, -1)
401 401
                    RecommendationHandler.instance.clearRecommendations()
402 402
                    if (this._timer !== undefined) {
403 403
                        clearTimeout(this._timer)
@@ -427,7 +427,7 @@
Loading
427 427
                        RecommendationHandler.instance.recommendations.forEach((r, i) => {
428 428
                            RecommendationHandler.instance.setSuggestionState(i, 'Discard')
429 429
                        })
430 -
                        RecommendationHandler.instance.reportUserDecisionOfCurrentRecommendation(editor, -1)
430 +
                        RecommendationHandler.instance.reportUserDecisionOfRecommendation(editor, -1)
431 431
                        RecommendationHandler.instance.clearRecommendations()
432 432
                    }
433 433
                    if (this._timer !== undefined) {
@@ -448,7 +448,7 @@
Loading
448 448
                                    showTimedMessage(CodeWhispererConstants.noSuggestions, 2000)
449 449
                                }
450 450
                            }
451 -
                            RecommendationHandler.instance.reportUserDecisionOfCurrentRecommendation(editor, -1)
451 +
                            RecommendationHandler.instance.reportUserDecisionOfRecommendation(editor, -1)
452 452
                            RecommendationHandler.instance.clearRecommendations()
453 453
                        }
454 454
                    }

@@ -167,7 +167,7 @@
Loading
167 167
                vsCodeState.isIntelliSenseActive = false
168 168
                RecommendationHandler.instance.isGenerateRecommendationInProgress = true
169 169
                try {
170 -
                    RecommendationHandler.instance.reportUserDecisionOfCurrentRecommendation(editor, -1)
170 +
                    RecommendationHandler.instance.reportUserDecisionOfRecommendation(editor, -1)
171 171
                    RecommendationHandler.instance.clearRecommendations()
172 172
                    await RecommendationHandler.instance.getRecommendations(
173 173
                        client,

@@ -7,11 +7,11 @@
Loading
7 7
import { Runtime } from 'aws-sdk/clients/lambda'
8 8
import globals from './extensionGlobals'
9 9
10 -
export const ACTIVATION_TEMPLATE_PATH_KEY = 'ACTIVATION_TEMPLATE_PATH_KEY'
11 -
export const ACTIVATION_LAUNCH_PATH_KEY = 'ACTIVATION_LAUNCH_PATH_KEY'
12 -
export const SAM_INIT_RUNTIME_KEY = 'SAM_INIT_RUNTIME_KEY'
13 -
export const SAM_INIT_IMAGE_BOOLEAN_KEY = 'SAM_INIT_IMAGE_BOOLEAN_KEY'
14 -
export const SAM_INIT_ARCH_KEY = 'SAM_INIT_ARCH_KEY'
10 +
export const activationTemplatePathKey = 'ACTIVATION_TEMPLATE_PATH_KEY'
11 +
export const activationLaunchPathKey = 'ACTIVATION_LAUNCH_PATH_KEY'
12 +
export const samInitRuntimeKey = 'SAM_INIT_RUNTIME_KEY'
13 +
export const samInitImageBooleanKey = 'SAM_INIT_IMAGE_BOOLEAN_KEY'
14 +
export const samInitArchKey = 'SAM_INIT_ARCH_KEY'
15 15
16 16
export interface SamInitState {
17 17
    template: string | undefined
@@ -27,28 +27,28 @@
Loading
27 27
export class ActivationReloadState {
28 28
    public getSamInitState(): SamInitState | undefined {
29 29
        return {
30 -
            template: this.extensionContext.globalState.get<string>(ACTIVATION_TEMPLATE_PATH_KEY),
31 -
            readme: this.extensionContext.globalState.get<string>(ACTIVATION_LAUNCH_PATH_KEY),
32 -
            runtime: this.extensionContext.globalState.get<string>(SAM_INIT_RUNTIME_KEY),
33 -
            architecture: this.extensionContext.globalState.get<string>(SAM_INIT_ARCH_KEY),
34 -
            isImage: this.extensionContext.globalState.get<boolean>(SAM_INIT_IMAGE_BOOLEAN_KEY),
30 +
            template: this.extensionContext.globalState.get<string>(activationTemplatePathKey),
31 +
            readme: this.extensionContext.globalState.get<string>(activationLaunchPathKey),
32 +
            runtime: this.extensionContext.globalState.get<string>(samInitRuntimeKey),
33 +
            architecture: this.extensionContext.globalState.get<string>(samInitArchKey),
34 +
            isImage: this.extensionContext.globalState.get<boolean>(samInitImageBooleanKey),
35 35
        }
36 36
    }
37 37
38 38
    public setSamInitState(state: SamInitState): void {
39 -
        this.extensionContext.globalState.update(ACTIVATION_TEMPLATE_PATH_KEY, state.template)
40 -
        this.extensionContext.globalState.update(ACTIVATION_LAUNCH_PATH_KEY, state.readme)
41 -
        this.extensionContext.globalState.update(SAM_INIT_RUNTIME_KEY, state.runtime)
42 -
        this.extensionContext.globalState.update(SAM_INIT_ARCH_KEY, state.architecture)
43 -
        this.extensionContext.globalState.update(SAM_INIT_IMAGE_BOOLEAN_KEY, state.isImage)
39 +
        this.extensionContext.globalState.update(activationTemplatePathKey, state.template)
40 +
        this.extensionContext.globalState.update(activationLaunchPathKey, state.readme)
41 +
        this.extensionContext.globalState.update(samInitRuntimeKey, state.runtime)
42 +
        this.extensionContext.globalState.update(samInitArchKey, state.architecture)
43 +
        this.extensionContext.globalState.update(samInitImageBooleanKey, state.isImage)
44 44
    }
45 45
46 46
    public clearSamInitState(): void {
47 -
        this.extensionContext.globalState.update(ACTIVATION_TEMPLATE_PATH_KEY, undefined)
48 -
        this.extensionContext.globalState.update(ACTIVATION_LAUNCH_PATH_KEY, undefined)
49 -
        this.extensionContext.globalState.update(SAM_INIT_RUNTIME_KEY, undefined)
50 -
        this.extensionContext.globalState.update(SAM_INIT_ARCH_KEY, undefined)
51 -
        this.extensionContext.globalState.update(SAM_INIT_IMAGE_BOOLEAN_KEY, undefined)
47 +
        this.extensionContext.globalState.update(activationTemplatePathKey, undefined)
48 +
        this.extensionContext.globalState.update(activationLaunchPathKey, undefined)
49 +
        this.extensionContext.globalState.update(samInitRuntimeKey, undefined)
50 +
        this.extensionContext.globalState.update(samInitArchKey, undefined)
51 +
        this.extensionContext.globalState.update(samInitImageBooleanKey, undefined)
52 52
    }
53 53
54 54
    protected get extensionContext(): vscode.ExtensionContext {

@@ -25,7 +25,7 @@
Loading
25 25
    private readonly _onDidChangeTreeData: vscode.EventEmitter<AWSTreeNodeBase | undefined>
26 26
    private readonly regionNodes: Map<string, RegionNode>
27 27
28 -
    private readonly ROOT_NODE_ADD_REGION = new AWSCommandTreeNode(
28 +
    private readonly rootNodeAddRegion = new AWSCommandTreeNode(
29 29
        undefined,
30 30
        localize('AWS.explorerNode.addRegion', 'Add regions to {0} Explorer...', getIdeProperties().company),
31 31
        'aws.showRegion',
@@ -129,7 +129,7 @@
Loading
129 129
        )
130 130
131 131
        if (this.regionNodes.size === 0) {
132 -
            return [this.getAuthNode(), this.ROOT_NODE_ADD_REGION]
132 +
            return [this.getAuthNode(), this.rootNodeAddRegion]
133 133
        }
134 134
135 135
        return await makeChildrenNodes({

@@ -7,19 +7,19 @@
Loading
7 7
import { IdentifierFormatter, SchemaCodeGenUtils } from '../../eventSchemas/models/schemaCodeGenUtils'
8 8
import { SchemaClient } from '../../shared/clients/schemaClient'
9 9
10 -
const X_AMAZON_EVENT_SOURCE = 'x-amazon-events-source'
11 -
const X_AMAZON_EVENT_DETAIL_TYPE = 'x-amazon-events-detail-type'
10 +
const xAmazonEventSource = 'x-amazon-events-source'
11 +
const xAmazonEventDetailType = 'x-amazon-events-detail-type'
12 12
13 -
const COMPONENTS = 'components'
14 -
const SCHEMAS = 'schemas'
15 -
const COMPONENTS_SCHEMAS_PATH = '#/components/schemas/'
16 -
const AWS_EVENT = 'AWSEvent'
17 -
const PROPERTIES = 'properties'
18 -
const DETAIL = 'detail'
19 -
const REF = '$ref'
13 +
const components = 'components'
14 +
const schemas = 'schemas'
15 +
const componentsSchemasPath = '#/components/schemas/'
16 +
const awsEvent = 'AWSEvent'
17 +
const properties = 'properties'
18 +
const detail = 'detail'
19 +
const ref = '$ref'
20 20
21 -
const DEFAULT_EVENT_SOURCE = 'INSERT-YOUR-EVENT-SOURCE'
22 -
const DEFAULT_EVENT_DETAIL_TYPE = 'INSERT-YOUR-DETAIL-TYPE'
21 +
const defaultEventSource = 'INSERT-YOUR-EVENT-SOURCE'
22 +
const defaultEventDetailType = 'INSERT-YOUR-DETAIL-TYPE'
23 23
24 24
export interface SchemaTemplateParameters {
25 25
    SchemaVersion: string
@@ -28,12 +28,12 @@
Loading
28 28
29 29
// This matches the extra_content parameters to Schema-based templates in both key and value names in cookiecutter.json in the templates used by SamEventBridgeSchemaAppPython
30 30
export interface SchemaTemplateExtraContext {
31 -
    AWS_Schema_registry: string
32 -
    AWS_Schema_name: string
33 -
    AWS_Schema_root: string
34 -
    AWS_Schema_source: string
35 -
    AWS_Schema_detail_type: string
36 -
    user_agent: string
31 +
    AWS_Schema_registry: string // eslint-disable-line @typescript-eslint/naming-convention
32 +
    AWS_Schema_name: string // eslint-disable-line @typescript-eslint/naming-convention
33 +
    AWS_Schema_root: string // eslint-disable-line @typescript-eslint/naming-convention
34 +
    AWS_Schema_source: string // eslint-disable-line @typescript-eslint/naming-convention
35 +
    AWS_Schema_detail_type: string // eslint-disable-line @typescript-eslint/naming-convention
36 +
    user_agent: string // eslint-disable-line @typescript-eslint/naming-convention
37 37
}
38 38
39 39
export async function buildSchemaTemplateParameters(schemaName: string, registryName: string, client: SchemaClient) {
@@ -41,18 +41,18 @@
Loading
41 41
    const schemaNode = JSON.parse(response.Content!)
42 42
    const latestSchemaVersion = response.SchemaVersion
43 43
    // Standard OpenAPI specification for AwsEventNode
44 -
    const awsEventNode = _.get(schemaNode, COMPONENTS.concat('.', SCHEMAS, '.', AWS_EVENT))
44 +
    const awsEventNode = _.get(schemaNode, components.concat('.', schemas, '.', awsEvent))
45 45
46 46
    // Derive source from custom OpenAPI metadata provided by Schemas service
47 -
    let source = _.get(awsEventNode, X_AMAZON_EVENT_SOURCE)
47 +
    let source = _.get(awsEventNode, xAmazonEventSource)
48 48
    if (!_.isString(source)) {
49 -
        source = DEFAULT_EVENT_SOURCE
49 +
        source = defaultEventSource
50 50
    }
51 51
52 52
    // Derive detail type from custom OpenAPI metadata provided by Schemas service
53 -
    let detailType = _.get(awsEventNode, X_AMAZON_EVENT_DETAIL_TYPE)
53 +
    let detailType = _.get(awsEventNode, xAmazonEventDetailType)
54 54
    if (!_.isString(detailType)) {
55 -
        detailType = DEFAULT_EVENT_DETAIL_TYPE
55 +
        detailType = defaultEventDetailType
56 56
    }
57 57
58 58
    // Generate schema root/package from the scheme name
@@ -63,11 +63,11 @@
Loading
63 63
    const rootSchemaEventName = buildRootSchemaEventName(schemaNode, awsEventNode) || getCoreFileName(schemaName)
64 64
65 65
    const templateExtraContent: SchemaTemplateExtraContext = {
66 -
        AWS_Schema_registry: registryName,
67 -
        AWS_Schema_name: rootSchemaEventName!,
68 -
        AWS_Schema_root: schemaPackageHierarchy,
69 -
        AWS_Schema_source: source,
70 -
        AWS_Schema_detail_type: detailType,
66 +
        AWS_Schema_registry: registryName, // eslint-disable-line @typescript-eslint/naming-convention
67 +
        AWS_Schema_name: rootSchemaEventName!, // eslint-disable-line @typescript-eslint/naming-convention
68 +
        AWS_Schema_root: schemaPackageHierarchy, // eslint-disable-line @typescript-eslint/naming-convention
69 +
        AWS_Schema_source: source, // eslint-disable-line @typescript-eslint/naming-convention
70 +
        AWS_Schema_detail_type: detailType, // eslint-disable-line @typescript-eslint/naming-convention
71 71
        // Need to provide user agent to SAM CLI so that it will enable appTemplate-based
72 72
        user_agent: 'AWSToolkit',
73 73
    }
@@ -87,16 +87,16 @@
Loading
87 87
}
88 88
89 89
function buildRootSchemaEventName(schemaNode: any, awsEventNode: any) {
90 -
    const refValue = _.get(awsEventNode, PROPERTIES.concat('.', DETAIL, '.', REF))
90 +
    const refValue = _.get(awsEventNode, properties.concat('.', detail, '.', ref))
91 91
92 -
    if (_.isString(refValue) && refValue.includes(COMPONENTS_SCHEMAS_PATH)) {
93 -
        const awsEventDetailRef = refValue.split(COMPONENTS_SCHEMAS_PATH).pop()
92 +
    if (_.isString(refValue) && refValue.includes(componentsSchemasPath)) {
93 +
        const awsEventDetailRef = refValue.split(componentsSchemasPath).pop()
94 94
        if (!_.isEmpty(awsEventDetailRef)) {
95 95
            return IdentifierFormatter.toValidIdentifier(awsEventDetailRef!)
96 96
        }
97 97
    }
98 98
99 -
    const schemaRoots = _.keysIn(_.get(schemaNode, COMPONENTS.concat('.', SCHEMAS)))
99 +
    const schemaRoots = _.keysIn(_.get(schemaNode, components.concat('.', schemas)))
100 100
    if (!_.isEmpty(schemaRoots)) {
101 101
        return IdentifierFormatter.toValidIdentifier(schemaRoots[0])
102 102
    }

@@ -7,14 +7,14 @@
Loading
7 7
import globals from '../../shared/extensionGlobals'
8 8
import { getLogger } from '../../shared/logger'
9 9
10 -
const COGNITO_ID_KEY = 'cognitoID'
10 +
const cognitoIdKey = 'cognitoID'
11 11
12 12
export const getCognitoCredentials = async (): Promise<CognitoIdentityCredentials> => {
13 13
    const region = CodeWhispererConstants.region
14 14
    try {
15 15
        // grab Cognito identityId
16 16
        const poolId = CodeWhispererConstants.identityPoolID
17 -
        const identityMapJson = globals.context.globalState.get<string>(COGNITO_ID_KEY, '[]')
17 +
        const identityMapJson = globals.context.globalState.get<string>(cognitoIdKey, '[]')
18 18
19 19
        const identityMap = new Map<string, string>(JSON.parse(identityMapJson) as Iterable<[string, string]>)
20 20
        let identityId = identityMap.get(poolId)
@@ -25,7 +25,7 @@
Loading
25 25
26 26
            // save it
27 27
            identityMap.set(poolId, identityId)
28 -
            await globals.context.globalState.update(COGNITO_ID_KEY, JSON.stringify(Array.from(identityMap.entries())))
28 +
            await globals.context.globalState.update(cognitoIdKey, JSON.stringify(Array.from(identityMap.entries())))
29 29
        }
30 30
31 31
        const credentials = new CognitoIdentityCredentials({ IdentityId: identityId }, { region })

@@ -59,7 +59,7 @@
Loading
59 59
    escapedAslJsonStr:
60 60
        | string
61 61
        | {
62 -
              'Fn::Join': any[]
62 +
              'Fn::Join': any[] // eslint-disable-line @typescript-eslint/naming-convention
63 63
          }
64 64
): string {
65 65
    if (typeof escapedAslJsonStr === 'string') {

@@ -56,10 +56,7 @@
Loading
56 56
import { Credentials } from '@aws-sdk/types'
57 57
import { CloudFormation } from '../../cloudformation/cloudformation'
58 58
import { getSamCliContext, getSamCliVersion } from '../cli/samCliContext'
59 -
import {
60 -
    MINIMUM_SAM_CLI_VERSION_INCLUSIVE_FOR_IMAGE_SUPPORT,
61 -
    MINIMUM_SAM_CLI_VERSION_INCLUSIVE_FOR_GO_SUPPORT,
62 -
} from '../cli/samCliValidator'
59 +
import { minSamCliVersionForImageSupport, minSamCliVersionForGoSupport } from '../cli/samCliValidator'
63 60
import { getIdeProperties, isCloud9 } from '../../extensionUtilities'
64 61
import { resolve } from 'path'
65 62
import globals from '../../extensionGlobals'
@@ -339,6 +336,7 @@
Loading
339 336
     * @param config User-provided config (from launch.json)
340 337
     * @param token  Cancellation token
341 338
     */
339 +
    // eslint-disable-next-line id-length
342 340
    public async resolveDebugConfigurationWithSubstitutedVariables(
343 341
        folder: vscode.WorkspaceFolder | undefined,
344 342
        config: AwsSamDebuggerConfiguration,
@@ -489,7 +487,7 @@
Loading
489 487
        // TODO: Remove this when min sam version is > 1.13.0
490 488
        if (!isZip) {
491 489
            const samCliVersion = await getSamCliVersion(this.ctx.samCliContext())
492 -
            if (semver.lt(samCliVersion, MINIMUM_SAM_CLI_VERSION_INCLUSIVE_FOR_IMAGE_SUPPORT)) {
490 +
            if (semver.lt(samCliVersion, minSamCliVersionForImageSupport)) {
493 491
                const message = localize(
494 492
                    'AWS.output.sam.no.image.support',
495 493
                    'Support for Image-based Lambdas requires a minimum SAM CLI version of 1.13.0.'
@@ -513,12 +511,12 @@
Loading
513 511
        // TODO: remove this when min sam version is >= 1.18.1
514 512
        if (goRuntimes.includes(runtime) && !config.noDebug) {
515 513
            const samCliVersion = await getSamCliVersion(this.ctx.samCliContext())
516 -
            if (semver.lt(samCliVersion, MINIMUM_SAM_CLI_VERSION_INCLUSIVE_FOR_GO_SUPPORT)) {
514 +
            if (semver.lt(samCliVersion, minSamCliVersionForGoSupport)) {
517 515
                vscode.window.showWarningMessage(
518 516
                    localize(
519 517
                        'AWS.output.sam.local.no.go.support',
520 518
                        'Debugging go1.x lambdas requires a minimum SAM CLI version of {0}. Function will run locally without debug.',
521 -
                        MINIMUM_SAM_CLI_VERSION_INCLUSIVE_FOR_GO_SUPPORT
519 +
                        minSamCliVersionForGoSupport
522 520
                    )
523 521
                )
524 522
                config.noDebug = true

@@ -19,7 +19,7 @@
Loading
19 19
20 20
export type Ec2MetadataClient = ClassToInterfaceType<DefaultEc2MetadataClient>
21 21
export class DefaultEc2MetadataClient {
22 -
    private static readonly METADATA_SERVICE_TIMEOUT: number = 500
22 +
    private static readonly metadataServiceTimeout: number = 500
23 23
24 24
    public constructor(private metadata: MetadataService = DefaultEc2MetadataClient.getMetadataService()) {}
25 25
@@ -51,8 +51,8 @@
Loading
51 51
    private static getMetadataService() {
52 52
        return new MetadataService({
53 53
            httpOptions: {
54 -
                timeout: DefaultEc2MetadataClient.METADATA_SERVICE_TIMEOUT,
55 -
                connectTimeout: DefaultEc2MetadataClient.METADATA_SERVICE_TIMEOUT,
54 +
                timeout: DefaultEc2MetadataClient.metadataServiceTimeout,
55 +
                connectTimeout: DefaultEc2MetadataClient.metadataServiceTimeout,
56 56
            } as any,
57 57
            // workaround for known bug: https://github.com/aws/aws-sdk-js/issues/3029
58 58
        })

@@ -6,7 +6,7 @@
Loading
6 6
import * as AWS from '@aws-sdk/types'
7 7
import { CredentialSourceId, CredentialType } from '../../shared/telemetry/telemetry'
8 8
9 -
const CREDENTIALS_PROVIDER_ID_SEPARATOR = ':'
9 +
const credentialsProviderIdSeparator = ':'
10 10
11 11
/**
12 12
 * "Fully-qualified" credentials structure (source + name).
@@ -28,11 +28,11 @@
Loading
28 28
 * @param credentials  Value to be formatted.
29 29
 */
30 30
export function asString(credentials: CredentialsId): string {
31 -
    return [credentials.credentialSource, credentials.credentialTypeId].join(CREDENTIALS_PROVIDER_ID_SEPARATOR)
31 +
    return [credentials.credentialSource, credentials.credentialTypeId].join(credentialsProviderIdSeparator)
32 32
}
33 33
34 34
export function fromString(credentials: string): CredentialsId {
35 -
    const separatorPos = credentials.indexOf(CREDENTIALS_PROVIDER_ID_SEPARATOR)
35 +
    const separatorPos = credentials.indexOf(credentialsProviderIdSeparator)
36 36
37 37
    if (separatorPos === -1) {
38 38
        throw new Error(`Unexpected credentialsId format: ${credentials}`)

@@ -20,6 +20,7 @@
Loading
20 20
export const noticeResponseViewSettings = localize('AWS.telemetry.notificationViewSettings', 'Settings')
21 21
export const noticeResponseOk = localize('AWS.telemetry.notificationOk', 'OK')
22 22
23 +
// eslint-disable-next-line @typescript-eslint/naming-convention
23 24
export const TELEMETRY_NOTICE_VERSION_ACKNOWLEDGED = 'awsTelemetryNoticeVersionAck'
24 25
25 26
// Telemetry Notice Versions
@@ -27,7 +28,7 @@
Loading
27 28
// track scenarios when we may need to re-prompt the user about telemetry.
28 29
// Version 1 was the original notice, allowing users to enable/disable/defer telemetry
29 30
// Version 2 states that there is metrics gathering, which can be adjusted in the options
30 -
const CURRENT_TELEMETRY_NOTICE_VERSION = 2
31 +
const CURRENT_TELEMETRY_NOTICE_VERSION = 2 // eslint-disable-line @typescript-eslint/naming-convention
31 32
32 33
/**
33 34
 * Sets up the Metrics system and initializes globals.telemetry

@@ -58,7 +58,7 @@
Loading
58 58
            vsCodeState.isIntelliSenseActive = false
59 59
            RecommendationHandler.instance.isGenerateRecommendationInProgress = true
60 60
            try {
61 -
                RecommendationHandler.instance.reportUserDecisionOfCurrentRecommendation(editor, -1)
61 +
                RecommendationHandler.instance.reportUserDecisionOfRecommendation(editor, -1)
62 62
                RecommendationHandler.instance.clearRecommendations()
63 63
                await RecommendationHandler.instance.getRecommendations(
64 64
                    client,

@@ -7,7 +7,7 @@
Loading
7 7
import * as path from 'path'
8 8
import { getLogger } from '.'
9 9
10 -
const DEFAULT_CLEANUP_PARAMS = {
10 +
const defaultCleanupParams = {
11 11
    maxLogs: 100,
12 12
    maxFileSize: 100000000, // 100 MB
13 13
    maxKeptLogs: 20,
@@ -17,7 +17,7 @@
Loading
17 17
/**
18 18
 * Deletes the older logs when there are too many or are using too much space.
19 19
 */
20 -
export async function cleanLogFiles(logDir: string, params = DEFAULT_CLEANUP_PARAMS): Promise<void> {
20 +
export async function cleanLogFiles(logDir: string, params = defaultCleanupParams): Promise<void> {
21 21
    let files = await fs.readdir(logDir)
22 22
23 23
    if (files.length > params.maxLogs) {

@@ -39,7 +39,7 @@
Loading
39 39
        }
40 40
        this._view.webview.html = this.getHtml(
41 41
            webviewView.webview,
42 -
            CodeWhispererSettings.instance.isIncludeSuggestionsWithCodeReferencesEnabled()
42 +
            CodeWhispererSettings.instance.isSuggestionsWithCodeReferencesEnabled()
43 43
        )
44 44
        this._view.webview.onDidReceiveMessage(data => {
45 45
            vscode.commands.executeCommand('aws.codeWhisperer.configure', 'codewhisperer')
@@ -48,7 +48,7 @@
Loading
48 48
49 49
    public async update() {
50 50
        if (this._view) {
51 -
            const showPrompt = CodeWhispererSettings.instance.isIncludeSuggestionsWithCodeReferencesEnabled()
51 +
            const showPrompt = CodeWhispererSettings.instance.isSuggestionsWithCodeReferencesEnabled()
52 52
            this._view.webview.html = this.getHtml(this._view.webview, showPrompt)
53 53
        }
54 54
    }

@@ -11,11 +11,11 @@
Loading
11 11
import { isReleaseVersion, isAutomation } from '../vscode/env'
12 12
import { getLogger } from '../logger'
13 13
import { MetricDatum } from './clienttelemetry'
14 -
import { DefaultTelemetryClient, REGION_KEY } from './telemetryClient'
14 +
import { DefaultTelemetryClient, regionKey } from './telemetryClient'
15 15
import { DefaultTelemetryPublisher } from './telemetryPublisher'
16 16
import { TelemetryFeedback } from './telemetryClient'
17 17
import { TelemetryPublisher } from './telemetryPublisher'
18 -
import { ACCOUNT_METADATA_KEY, AccountStatus, COMPUTE_REGION_KEY } from './telemetryClient'
18 +
import { accountMetadataKey, AccountStatus, computeRegionKey } from './telemetryClient'
19 19
import { TelemetryLogger } from './telemetryLogger'
20 20
import globals from '../extensionGlobals'
21 21
import { ClassToInterfaceType } from '../utilities/tsUtils'
@@ -25,8 +25,8 @@
Loading
25 25
export type TelemetryService = ClassToInterfaceType<DefaultTelemetryService>
26 26
27 27
export class DefaultTelemetryService {
28 -
    public static readonly TELEMETRY_COGNITO_ID_KEY = 'telemetryId'
29 -
    public static readonly DEFAULT_FLUSH_PERIOD_MILLIS = 1000 * 60 * 5 // 5 minutes in milliseconds
28 +
    public static readonly telemetryCognitoIdKey = 'telemetryId'
29 +
    public static readonly defaultFlushPeriodMillis = 1000 * 60 * 5 // 5 minutes in milliseconds
30 30
31 31
    public startTime: Date
32 32
    public readonly persistFilePath: string
@@ -62,7 +62,7 @@
Loading
62 62
        this.startTime = new globals.clock.Date()
63 63
64 64
        this._eventQueue = []
65 -
        this._flushPeriod = DefaultTelemetryService.DEFAULT_FLUSH_PERIOD_MILLIS
65 +
        this._flushPeriod = DefaultTelemetryService.defaultFlushPeriodMillis
66 66
67 67
        if (publisher !== undefined) {
68 68
            this.publisher = publisher
@@ -177,7 +177,7 @@
Loading
177 177
            // grab our Cognito identityId
178 178
            const poolId = DefaultTelemetryClient.config.identityPool
179 179
            const identityMapJson = this.context.globalState.get<string>(
180 -
                DefaultTelemetryService.TELEMETRY_COGNITO_ID_KEY,
180 +
                DefaultTelemetryService.telemetryCognitoIdKey,
181 181
                '[]'
182 182
            )
183 183
            // Maps don't cleanly de/serialize with JSON.parse/stringify so we need to do it ourselves
@@ -192,7 +192,7 @@
Loading
192 192
                // save it
193 193
                identityMap.set(poolId, identityPublisherTuple.cognitoIdentityId)
194 194
                await this.context.globalState.update(
195 -
                    DefaultTelemetryService.TELEMETRY_COGNITO_ID_KEY,
195 +
                    DefaultTelemetryService.telemetryCognitoIdKey,
196 196
                    JSON.stringify(Array.from(identityMap.entries()))
197 197
                )
198 198
@@ -237,12 +237,12 @@
Loading
237 237
            }
238 238
        }
239 239
240 -
        const commonMetadata = [{ Key: ACCOUNT_METADATA_KEY, Value: accountValue }]
240 +
        const commonMetadata = [{ Key: accountMetadataKey, Value: accountValue }]
241 241
        if (this.computeRegion) {
242 -
            commonMetadata.push({ Key: COMPUTE_REGION_KEY, Value: this.computeRegion })
242 +
            commonMetadata.push({ Key: computeRegionKey, Value: this.computeRegion })
243 243
        }
244 -
        if (!event?.Metadata?.some((m: any) => m?.Key == REGION_KEY)) {
245 -
            commonMetadata.push({ Key: REGION_KEY, Value: globals.regionProvider.guessDefaultRegion() })
244 +
        if (!event?.Metadata?.some((m: any) => m?.Key == regionKey)) {
245 +
            commonMetadata.push({ Key: regionKey, Value: globals.regionProvider.guessDefaultRegion() })
246 246
        }
247 247
248 248
        if (event.Metadata) {

@@ -137,12 +137,12 @@
Loading
137 137
        // "**/…" string patterns watch recursively across _all_ workspace
138 138
        // folders (see documentation for addWatchPattern()).
139 139
        //
140 -
        await registry.addWatchPattern(pyLensProvider.PYTHON_BASE_PATTERN)
141 -
        await registry.addWatchPattern(jsLensProvider.JAVASCRIPT_BASE_PATTERN)
142 -
        await registry.addWatchPattern(csLensProvider.CSHARP_BASE_PATTERN)
143 -
        await registry.addWatchPattern(goLensProvider.GO_BASE_PATTERN)
144 -
        await registry.addWatchPattern(javaLensProvider.GRADLE_BASE_PATTERN)
145 -
        await registry.addWatchPattern(javaLensProvider.MAVEN_BASE_PATTERN)
140 +
        await registry.addWatchPattern(pyLensProvider.pythonBasePattern)
141 +
        await registry.addWatchPattern(jsLensProvider.javascriptBasePattern)
142 +
        await registry.addWatchPattern(csLensProvider.csharpBasePattern)
143 +
        await registry.addWatchPattern(goLensProvider.goBasePattern)
144 +
        await registry.addWatchPattern(javaLensProvider.gradleBasePattern)
145 +
        await registry.addWatchPattern(javaLensProvider.mavenBasePattern)
146 146
    } catch (e) {
147 147
        vscode.window.showErrorMessage(
148 148
            localize(
@@ -179,15 +179,15 @@
Loading
179 179
    const supportedLanguages: {
180 180
        [language: string]: codelensUtils.OverridableCodeLensProvider
181 181
    } = {
182 -
        [jsLensProvider.JAVASCRIPT_LANGUAGE]: tsCodeLensProvider,
183 -
        [pyLensProvider.PYTHON_LANGUAGE]: pyCodeLensProvider,
182 +
        [jsLensProvider.javascriptLanguage]: tsCodeLensProvider,
183 +
        [pyLensProvider.pythonLanguage]: pyCodeLensProvider,
184 184
    }
185 185
186 186
    if (!isCloud9()) {
187 -
        supportedLanguages[javaLensProvider.JAVA_LANGUAGE] = javaCodeLensProvider
188 -
        supportedLanguages[csLensProvider.CSHARP_LANGUAGE] = csCodeLensProvider
189 -
        supportedLanguages[goLensProvider.GO_LANGUAGE] = goCodeLensProvider
190 -
        supportedLanguages[jsLensProvider.TYPESCRIPT_LANGUAGE] = tsCodeLensProvider
187 +
        supportedLanguages[javaLensProvider.javaLanguage] = javaCodeLensProvider
188 +
        supportedLanguages[csLensProvider.csharpLanguage] = csCodeLensProvider
189 +
        supportedLanguages[goLensProvider.goLanguage] = goCodeLensProvider
190 +
        supportedLanguages[jsLensProvider.typescriptLanguage] = tsCodeLensProvider
191 191
    }
192 192
193 193
    disposables.push(
@@ -203,11 +203,11 @@
Loading
203 203
        )
204 204
    )
205 205
206 -
    disposables.push(vscode.languages.registerCodeLensProvider(jsLensProvider.TYPESCRIPT_ALL_FILES, tsCodeLensProvider))
207 -
    disposables.push(vscode.languages.registerCodeLensProvider(pyLensProvider.PYTHON_ALLFILES, pyCodeLensProvider))
208 -
    disposables.push(vscode.languages.registerCodeLensProvider(javaLensProvider.JAVA_ALLFILES, javaCodeLensProvider))
209 -
    disposables.push(vscode.languages.registerCodeLensProvider(csLensProvider.CSHARP_ALLFILES, csCodeLensProvider))
210 -
    disposables.push(vscode.languages.registerCodeLensProvider(goLensProvider.GO_ALLFILES, goCodeLensProvider))
206 +
    disposables.push(vscode.languages.registerCodeLensProvider(jsLensProvider.typescriptAllFiles, tsCodeLensProvider))
207 +
    disposables.push(vscode.languages.registerCodeLensProvider(pyLensProvider.pythonAllfiles, pyCodeLensProvider))
208 +
    disposables.push(vscode.languages.registerCodeLensProvider(javaLensProvider.javaAllfiles, javaCodeLensProvider))
209 +
    disposables.push(vscode.languages.registerCodeLensProvider(csLensProvider.csharpAllfiles, csCodeLensProvider))
210 +
    disposables.push(vscode.languages.registerCodeLensProvider(goLensProvider.goAllfiles, goCodeLensProvider))
211 211
212 212
    disposables.push(
213 213
        Commands.register({ id: 'aws.toggleSamCodeLenses', autoconnect: false }, async () => {

@@ -14,7 +14,7 @@
Loading
14 14
import { ResourcesNode } from './explorer/nodes/resourcesNode'
15 15
import { ResourceNode } from './explorer/nodes/resourceNode'
16 16
import { ResourceTypeNode } from './explorer/nodes/resourceTypeNode'
17 -
import { RESOURCE_FILE_GLOB_PATTERN } from './awsResourceManager'
17 +
import { resourceFileGlobPattern } from './awsResourceManager'
18 18
import { Commands } from '../shared/vscode/commands2'
19 19
import globals from '../shared/extensionGlobals'
20 20
@@ -116,7 +116,7 @@
Loading
116 116
            {
117 117
                language: 'json',
118 118
                scheme: 'file',
119 -
                pattern: RESOURCE_FILE_GLOB_PATTERN,
119 +
                pattern: resourceFileGlobPattern,
120 120
            },
121 121
            new ResourceCodeLensProvider(resourceManager)
122 122
        )

@@ -14,9 +14,9 @@
Loading
14 14
import { loadOr } from '../../shared/utilities/cacheUtils'
15 15
import { isClientFault } from '../../shared/errors'
16 16
17 -
const CLIENT_REGISTRATION_TYPE = 'public'
18 -
const DEVICE_GRANT_TYPE = 'urn:ietf:params:oauth:grant-type:device_code'
19 -
const REFRESH_GRANT_TYPE = 'refresh_token'
17 +
const clientRegistrationType = 'public'
18 +
const deviceGrantType = 'urn:ietf:params:oauth:grant-type:device_code'
19 +
const refreshGrantType = 'refresh_token'
20 20
21 21
/**
22 22
 *  SSO flow (RFC: https://tools.ietf.org/html/rfc8628)
@@ -114,7 +114,7 @@
Loading
114 114
    private async refreshToken(token: RequiredProps<SsoToken, 'refreshToken'>, registration: ClientRegistration) {
115 115
        try {
116 116
            const clientInfo = selectFrom(registration, 'clientId', 'clientSecret')
117 -
            const response = await this.oidc.createToken({ ...clientInfo, ...token, grantType: REFRESH_GRANT_TYPE })
117 +
            const response = await this.oidc.createToken({ ...clientInfo, ...token, grantType: refreshGrantType })
118 118
119 119
            return this.formatToken(response, registration)
120 120
        } catch (err) {
@@ -153,7 +153,7 @@
Loading
153 153
            clientId: registration.clientId,
154 154
            clientSecret: registration.clientSecret,
155 155
            deviceCode: authorization.deviceCode,
156 -
            grantType: DEVICE_GRANT_TYPE,
156 +
            grantType: deviceGrantType,
157 157
        }
158 158
159 159
        const token = await this.oidc.pollForToken(
@@ -168,7 +168,7 @@
Loading
168 168
    private async registerClient(): Promise<ClientRegistration> {
169 169
        return this.oidc.registerClient({
170 170
            clientName: `aws-toolkit-vscode-${globals.clock.Date.now()}`,
171 -
            clientType: CLIENT_REGISTRATION_TYPE,
171 +
            clientType: clientRegistrationType,
172 172
            scopes: this.profile.scopes,
173 173
        })
174 174
    }

@@ -9,14 +9,14 @@
Loading
9 9
import { AWSTreeNodeBase } from '../../shared/treeview/nodes/awsTreeNodeBase'
10 10
import { getIcon } from '../../shared/icons'
11 11
12 -
export const CONTEXT_VALUE_CLOUDWATCH_LOG = 'awsCloudWatchLogNode'
12 +
export const contextValueCloudwatchLog = 'awsCloudWatchLogNode'
13 13
14 14
export class LogGroupNode extends AWSTreeNodeBase implements AWSResourceNode {
15 15
    public constructor(public readonly regionCode: string, public logGroup: CloudWatchLogs.LogGroup) {
16 16
        super('')
17 17
        this.update(logGroup)
18 18
        this.iconPath = getIcon('aws-cloudwatch-log-group')
19 -
        this.contextValue = CONTEXT_VALUE_CLOUDWATCH_LOG
19 +
        this.contextValue = contextValueCloudwatchLog
20 20
    }
21 21
22 22
    public update(logGroup: CloudWatchLogs.LogGroup): void {

@@ -12,12 +12,12 @@
Loading
12 12
import { assertHasProps, InterfaceNoSymbol, isNonNullable, RequiredProps } from '../utilities/tsUtils'
13 13
import { Readable } from 'stream'
14 14
import globals from '../extensionGlobals'
15 -
import { DEFAULT_PARTITION } from '../regions/regionProvider'
15 +
import { defaultPartition } from '../regions/regionProvider'
16 16
import { AsyncCollection, toCollection } from '../utilities/asyncCollection'
17 17
import { toStream } from '../utilities/collectionUtils'
18 18
19 -
export const DEFAULT_MAX_KEYS = 300
20 -
export const DEFAULT_DELIMITER = '/'
19 +
export const DEFAULT_MAX_KEYS = 300 // eslint-disable-line @typescript-eslint/naming-convention
20 +
export const DEFAULT_DELIMITER = '/' // eslint-disable-line @typescript-eslint/naming-convention
21 21
22 22
export type Bucket = InterfaceNoSymbol<DefaultBucket>
23 23
export type Folder = InterfaceNoSymbol<DefaultFolder>
@@ -132,7 +132,7 @@
Loading
132 132
export class DefaultS3Client {
133 133
    public constructor(
134 134
        public readonly regionCode: string,
135 -
        private readonly partitionId = globals.regionProvider.getPartitionId(regionCode) ?? DEFAULT_PARTITION,
135 +
        private readonly partitionId = globals.regionProvider.getPartitionId(regionCode) ?? defaultPartition,
136 136
        private readonly s3Provider: (regionCode: string) => Promise<S3> = createSdkClient,
137 137
        private readonly fileStreams: FileStreams = new DefaultFileStreams()
138 138
    ) {}

@@ -14,9 +14,9 @@
Loading
14 14
import { IotCertsFolderNode } from '../explorer/iotCertFolderNode'
15 15
import { IotNode } from '../explorer/iotNodes'
16 16
17 -
const STATUS_REVOKED = 'REVOKED'
18 -
const STATUS_ACTIVE = 'ACTIVE'
19 -
const STATUS_INACTIVE = 'INACTIVE'
17 +
const statusRevoked = 'REVOKED'
18 +
const statusActive = 'ACTIVE'
19 +
const statusInactive = 'INACTIVE'
20 20
21 21
/**
22 22
 * Deactivates an active certificate.
@@ -53,7 +53,7 @@
Loading
53 53
54 54
    getLogger().info(`Deactivating certificate ${certId}`)
55 55
    try {
56 -
        await node.iot.updateCertificate({ certificateId: certId, newStatus: STATUS_INACTIVE })
56 +
        await node.iot.updateCertificate({ certificateId: certId, newStatus: statusInactive })
57 57
58 58
        getLogger().info(`deactivated certificate: ${certId}`)
59 59
        window.showInformationMessage(
@@ -109,7 +109,7 @@
Loading
109 109
110 110
    getLogger().info(`Activating certificate ${certId}`)
111 111
    try {
112 -
        await node.iot.updateCertificate({ certificateId: certId, newStatus: STATUS_ACTIVE })
112 +
        await node.iot.updateCertificate({ certificateId: certId, newStatus: statusActive })
113 113
114 114
        getLogger().info(`activated certificate: ${certId}`)
115 115
        window.showInformationMessage(localize('AWS.iot.activateCert.success', 'Activated: {0}', node.certificate.id))
@@ -159,7 +159,7 @@
Loading
159 159
160 160
    getLogger().info(`Revoking certificate: ${certId}`)
161 161
    try {
162 -
        await node.iot.updateCertificate({ certificateId: certId, newStatus: STATUS_REVOKED })
162 +
        await node.iot.updateCertificate({ certificateId: certId, newStatus: statusRevoked })
163 163
164 164
        getLogger().info(`revoked certificate: ${certId}`)
165 165
        window.showInformationMessage(localize('AWS.iot.revokeCert.success', 'Revoked: {0}', node.certificate.id))

@@ -321,7 +321,7 @@
Loading
321 321
        templateRelativePath: string,
322 322
        parameterName: string
323 323
    ): TemplatesConfigPopulator {
324 -
        this.ensureTemplateParameterOverridesSectionExists(templateRelativePath)
324 +
        this.ensureTemplateParamOverrideSectionExists(templateRelativePath)
325 325
326 326
        this.ensureJsonPropertyExists(['templates', templateRelativePath, 'parameterOverrides', parameterName], '', [
327 327
            'string',
@@ -383,7 +383,7 @@
Loading
383 383
        return this
384 384
    }
385 385
386 -
    private ensureTemplateParameterOverridesSectionExists(templateRelativePath: string): TemplatesConfigPopulator {
386 +
    private ensureTemplateParamOverrideSectionExists(templateRelativePath: string): TemplatesConfigPopulator {
387 387
        this.ensureTemplateSectionExists(templateRelativePath)
388 388
389 389
        this.ensureJsonPropertyExists(['templates', templateRelativePath, 'parameterOverrides'], {})

@@ -81,9 +81,9 @@
Loading
81 81
}
82 82
83 83
type FormProperty = keyof (FormElement<any, any> & ParentFormElement<any, any>)
84 -
const BIND_PROMPTER: FormProperty = 'bindPrompter'
85 -
const APPLY_FORM: FormProperty = 'applyBoundForm'
86 -
const SET_DEFAULT: FormProperty = 'setDefault'
84 +
const BIND_PROMPTER: FormProperty = 'bindPrompter' // eslint-disable-line @typescript-eslint/naming-convention
85 +
const APPLY_FORM: FormProperty = 'applyBoundForm' // eslint-disable-line @typescript-eslint/naming-convention
86 +
const SET_DEFAULT: FormProperty = 'setDefault' // eslint-disable-line @typescript-eslint/naming-convention
87 87
88 88
/**
89 89
 * Maps individual {@link Prompter prompters} to a desired property of the output interface as defined by

@@ -6,7 +6,7 @@
Loading
6 6
import * as Transport from 'winston-transport'
7 7
import globals from '../extensionGlobals'
8 8
9 -
const MESSAGE = Symbol.for('message')
9 +
const MESSAGE = Symbol.for('message') // eslint-disable-line @typescript-eslint/naming-convention
10 10
11 11
interface LogEntry {
12 12
    level: string

@@ -13,7 +13,7 @@
Loading
13 13
import { EcrNode } from '../ecr/explorer/ecrNode'
14 14
import { IotNode } from '../iot/explorer/iotNodes'
15 15
import { Region } from '../shared/regions/endpoints'
16 -
import { DEFAULT_PARTITION, RegionProvider } from '../shared/regions/regionProvider'
16 +
import { defaultPartition, RegionProvider } from '../shared/regions/regionProvider'
17 17
import { AWSTreeNodeBase } from '../shared/treeview/nodes/awsTreeNodeBase'
18 18
import { StepFunctionsNode } from '../stepFunctions/explorer/stepFunctionsNodes'
19 19
import { SsmDocumentNode } from '../ssmDocument/explorer/ssmDocumentNode'
@@ -104,7 +104,7 @@
Loading
104 104
        //  `serviceId`s are checked against ~/resources/endpoints.json to see whether or not the service is available in the given region.
105 105
        //  If the service is available, we use the `createFn` to generate the node for the region.
106 106
        //  This interface exists so we can add additional nodes to the array (otherwise Typescript types the array to what's already in the array at creation)
107 -
        const partitionId = this.regionProvider.getPartitionId(this.regionCode) ?? DEFAULT_PARTITION
107 +
        const partitionId = this.regionProvider.getPartitionId(this.regionCode) ?? defaultPartition
108 108
        const childNodes: AWSTreeNodeBase[] = []
109 109
        for (const { serviceId, createFn } of serviceCandidates) {
110 110
            if (this.regionProvider.isServiceInRegion(serviceId, this.regionCode)) {

@@ -7,7 +7,7 @@
Loading
7 7
import * as Transport from 'winston-transport'
8 8
import globals from '../extensionGlobals'
9 9
10 -
export const MESSAGE = Symbol.for('message')
10 +
export const MESSAGE = Symbol.for('message') // eslint-disable-line @typescript-eslint/naming-convention
11 11
12 12
interface LogEntry {
13 13
    level: string

@@ -397,10 +397,10 @@
Loading
397 397
    main: vscode.Uri
398 398
}): string {
399 399
    const resolvedParams = { ...params, connectSource: `'none'` }
400 -
    const LOCAL_SERVER = process.env.WEBPACK_DEVELOPER_SERVER
400 +
    const localServer = process.env.WEBPACK_DEVELOPER_SERVER
401 401
402 -
    if (LOCAL_SERVER) {
403 -
        const local = vscode.Uri.parse(LOCAL_SERVER)
402 +
    if (localServer) {
403 +
        const local = vscode.Uri.parse(localServer)
404 404
        resolvedParams.cspSource = `${params.cspSource} ${local.toString()}`
405 405
        resolvedParams.main = local.with({ path: `/${params.webviewJs}` })
406 406
        resolvedParams.connectSource = `'self' ws:`

@@ -8,7 +8,7 @@
Loading
8 8
import globals from '../extensionGlobals'
9 9
import { removeAnsi } from '../utilities/textUtilities'
10 10
11 -
export const MESSAGE = Symbol.for('message')
11 +
export const MESSAGE = Symbol.for('message') // eslint-disable-line @typescript-eslint/naming-convention
12 12
13 13
interface LogEntry {
14 14
    level: string

@@ -81,7 +81,7 @@
Loading
81 81
                    },
82 82
                    request,
83 83
                }),
84 -
            response => convertDescribeLogStreamsToQuickPickItems(response)
84 +
            response => convertDescribeLogToQuickPickItems(response)
85 85
        )
86 86
87 87
        const controller = new picker.IteratingQuickPickController(qp, populator)
@@ -112,7 +112,7 @@
Loading
112 112
    }
113 113
}
114 114
115 -
export function convertDescribeLogStreamsToQuickPickItems(
115 +
export function convertDescribeLogToQuickPickItems(
116 116
    response: CloudWatchLogs.DescribeLogStreamsResponse
117 117
): vscode.QuickPickItem[] {
118 118
    return (response.logStreams ?? []).map<vscode.QuickPickItem>(stream => ({
@@ -141,7 +141,7 @@
Loading
141 141
    }
142 142
143 143
    protected get startStep(): WizardStep {
144 -
        return this.SELECT_STREAM
144 +
        return this.selectStream
145 145
    }
146 146
147 147
    protected getResult(): SelectLogStreamResponse | undefined {
@@ -156,7 +156,7 @@
Loading
156 156
        }
157 157
    }
158 158
159 -
    private readonly SELECT_STREAM: WizardStep = async () => {
159 +
    private readonly selectStream: WizardStep = async () => {
160 160
        const returnVal = await this.context.pickLogStream()
161 161
162 162
        // retry on error

@@ -18,9 +18,9 @@
Loading
18 18
import { AsyncCollection, toCollection } from '../shared/utilities/asyncCollection'
19 19
import { getCodeCatalystSpaceName, getCodeCatalystProjectName } from '../shared/vscode/env'
20 20
import { writeFile } from 'fs-extra'
21 -
import { SSH_AGENT_SOCKET_VARIABLE, startSshAgent, startVscodeRemote } from '../shared/extensions/ssh'
21 +
import { sshAgentSocketVariable, startSshAgent, startVscodeRemote } from '../shared/extensions/ssh'
22 22
import { ChildProcess } from '../shared/utilities/childProcess'
23 -
import { ensureDependencies, HOST_NAME_PREFIX } from './tools'
23 +
import { ensureDependencies, hostNamePrefix } from './tools'
24 24
import { isCodeCatalystVSCode } from './utils'
25 25
import { Timeout } from '../shared/utilities/timeoutUtils'
26 26
import { Commands } from '../shared/vscode/commands2'
@@ -101,7 +101,7 @@
Loading
101 101
        await cacheBearerToken(await client.getBearerToken(), devenv.id)
102 102
        const vars = getCodeCatalystSsmEnv(client.regionCode, ssmPath, devenv)
103 103
104 -
        return useSshAgent ? { [SSH_AGENT_SOCKET_VARIABLE]: await startSshAgent(), ...vars } : vars
104 +
        return useSshAgent ? { [sshAgentSocketVariable]: await startSshAgent(), ...vars } : vars
105 105
    }
106 106
}
107 107
@@ -140,7 +140,7 @@
Loading
140 140
}
141 141
142 142
export function getHostNameFromEnv(env: DevEnvironmentId): string {
143 -
    return `${HOST_NAME_PREFIX}${env.id}`
143 +
    return `${hostNamePrefix}${env.id}`
144 144
}
145 145
146 146
export interface ConnectedDevEnv {
@@ -344,4 +344,4 @@
Loading
344 344
    alias: string | undefined
345 345
}
346 346
347 -
export const CODECATALYST_RECONNECT_KEY = 'CODECATALYST_RECONNECT'
347 +
export const codecatalystReconnectKey = 'CODECATALYST_RECONNECT'

@@ -186,7 +186,7 @@
Loading
186 186
            if (isInlineCompletionEnabled() && e.uri.fsPath !== InlineCompletionService.instance.filePath()) {
187 187
                return
188 188
            }
189 -
            RecommendationHandler.instance.reportUserDecisionOfCurrentRecommendation(vscode.window.activeTextEditor, -1)
189 +
            RecommendationHandler.instance.reportUserDecisionOfRecommendation(vscode.window.activeTextEditor, -1)
190 190
            RecommendationHandler.instance.clearRecommendations()
191 191
        }),
192 192
@@ -246,11 +246,11 @@
Loading
246 246
                ) || false
247 247
            const notificationLastShown: number =
248 248
                context.extensionContext.globalState.get<number | undefined>(
249 -
                    CodeWhispererConstants.accessTokenMigrationDoNotShowAgainLastShown
249 +
                    CodeWhispererConstants.accessTokenMigrationDoNotShowLastShown
250 250
                ) || 1
251 251
252 252
            //Add 7 days to notificationLastShown to determine whether warn message should show
253 -
            if (doNotShowAgain || notificationLastShown + (1000 * 60 * 60 * 24 * 7) >= Date.now()) {
253 +
            if (doNotShowAgain || notificationLastShown + 1000 * 60 * 60 * 24 * 7 >= Date.now()) {
254 254
                return
255 255
            } else if (t <= CodeWhispererConstants.accessTokenCutOffDate) {
256 256
                vscode.window
@@ -275,7 +275,7 @@
Loading
275 275
                        }
276 276
                    })
277 277
                context.extensionContext.globalState.update(
278 -
                    CodeWhispererConstants.accessTokenMigrationDoNotShowAgainLastShown,
278 +
                    CodeWhispererConstants.accessTokenMigrationDoNotShowLastShown,
279 279
                    Date.now()
280 280
                )
281 281
            } else {
@@ -311,7 +311,7 @@
Loading
311 311
312 312
    async function showCodeWhispererWelcomeMessage(): Promise<void> {
313 313
        const filePath = isCloud9()
314 -
            ? context.extensionContext.asAbsolutePath(CodeWhispererConstants.welcomeCodeWhispererCloud9ReadmeFileSource)
314 +
            ? context.extensionContext.asAbsolutePath(CodeWhispererConstants.welcomeCodeWhispererCloud9Readme)
315 315
            : context.extensionContext.asAbsolutePath(CodeWhispererConstants.welcomeCodeWhispererReadmeFileSource)
316 316
        const readmeUri = vscode.Uri.file(filePath)
317 317
        await vscode.commands.executeCommand('markdown.showPreviewToSide', readmeUri)
@@ -330,13 +330,12 @@
Loading
330 330
            vscode.workspace.getConfiguration('editor').get('suggest.showMethods') || false
331 331
        const isAutomatedTriggerEnabled: boolean = getAutoTriggerStatus()
332 332
        const isManualTriggerEnabled: boolean = await getManualTriggerStatus()
333 -
        const isIncludeSuggestionsWithCodeReferencesEnabled =
334 -
            codewhispererSettings.isIncludeSuggestionsWithCodeReferencesEnabled()
333 +
        const isSuggestionsWithCodeReferencesEnabled = codewhispererSettings.isSuggestionsWithCodeReferencesEnabled()
335 334
        return {
336 335
            isShowMethodsEnabled,
337 336
            isManualTriggerEnabled,
338 337
            isAutomatedTriggerEnabled,
339 -
            isIncludeSuggestionsWithCodeReferencesEnabled,
338 +
            isSuggestionsWithCodeReferencesEnabled,
340 339
        }
341 340
    }
342 341
@@ -617,7 +616,7 @@
Loading
617 616
618 617
export async function shutdown() {
619 618
    if (isCloud9()) {
620 -
        RecommendationHandler.instance.reportUserDecisionOfCurrentRecommendation(vscode.window.activeTextEditor, -1)
619 +
        RecommendationHandler.instance.reportUserDecisionOfRecommendation(vscode.window.activeTextEditor, -1)
621 620
        RecommendationHandler.instance.clearRecommendations()
622 621
    }
623 622
    if (isInlineCompletionEnabled()) {

@@ -10,7 +10,7 @@
Loading
10 10
import * as nls from 'vscode-nls'
11 11
import { readFileAsString } from './filesystemUtilities'
12 12
import { getLogger } from './logger'
13 -
import { VSCODE_EXTENSION_ID, EXTENSION_ALPHA_VERSION } from './extensions'
13 +
import { VSCODE_EXTENSION_ID, extensionAlphaVersion } from './extensions'
14 14
import { BaseTemplates } from './templates/baseTemplates'
15 15
import { Ec2MetadataClient } from './clients/ec2MetadataClient'
16 16
import { DefaultEc2MetadataClient } from './clients/ec2MetadataClient'
@@ -19,10 +19,10 @@
Loading
19 19
20 20
const localize = nls.loadMessageBundle()
21 21
22 -
const VSCODE_APPNAME = 'Visual Studio Code'
23 -
const CLOUD9_APPNAME = 'AWS Cloud9'
24 -
const CLOUD9_CN_APPNAME = 'Amazon Cloud9'
25 -
const NOT_INITIALIZED = 'notInitialized'
22 +
const vscodeAppname = 'Visual Studio Code'
23 +
const cloud9Appname = 'AWS Cloud9'
24 +
const cloud9CnAppname = 'Amazon Cloud9'
25 +
const notInitialized = 'notInitialized'
26 26
27 27
export const mostRecentVersionKey: string = 'globalsMostRecentVersion'
28 28
@@ -32,13 +32,13 @@
Loading
32 32
    unknown,
33 33
}
34 34
35 -
let computeRegion: string | undefined = NOT_INITIALIZED
35 +
let computeRegion: string | undefined = notInitialized
36 36
37 37
export function getIdeType(): IDE {
38 38
    const settings = DevSettings.instance
39 39
    if (
40 -
        vscode.env.appName === CLOUD9_APPNAME ||
41 -
        vscode.env.appName === CLOUD9_CN_APPNAME ||
40 +
        vscode.env.appName === cloud9Appname ||
41 +
        vscode.env.appName === cloud9CnAppname ||
42 42
        settings.get('forceCloud9', false)
43 43
    ) {
44 44
        return IDE.cloud9
@@ -46,7 +46,7 @@
Loading
46 46
47 47
    // Theia doesn't necessarily have all env propertie
48 48
    // so we should be defensive and assume appName is nullable.
49 -
    if (vscode.env.appName?.startsWith(VSCODE_APPNAME)) {
49 +
    if (vscode.env.appName?.startsWith(vscodeAppname)) {
50 50
        return IDE.vscode
51 51
    }
52 52
@@ -180,7 +180,7 @@
Loading
180 180
        { enableScripts: true }
181 181
    )
182 182
183 -
    const baseTemplateFn = _.template(BaseTemplates.SIMPLE_HTML)
183 +
    const baseTemplateFn = _.template(BaseTemplates.simpleHtml)
184 184
185 185
    const htmlBody = convertExtensionRootTokensToPath(
186 186
        await readFileAsString(path.join(context.extensionPath, actualPage)),
@@ -274,7 +274,7 @@
Loading
274 274
        return
275 275
    }
276 276
    const version = vscode.extensions.getExtension(VSCODE_EXTENSION_ID.awstoolkit)?.packageJSON.version
277 -
    if (version === EXTENSION_ALPHA_VERSION) {
277 +
    if (version === extensionAlphaVersion) {
278 278
        vscode.window.showWarningMessage(
279 279
            localize(
280 280
                'AWS.startup.toastIfAlpha',
@@ -359,7 +359,7 @@
Loading
359 359
}
360 360
361 361
export function getComputeRegion(): string | undefined {
362 -
    if (computeRegion === NOT_INITIALIZED) {
362 +
    if (computeRegion === notInitialized) {
363 363
        throw new Error('Attempted to get compute region without initializing.')
364 364
    }
365 365

@@ -4,7 +4,7 @@
Loading
4 4
 */
5 5
6 6
export class BaseTemplates {
7 -
    public static readonly SIMPLE_HTML = `
7 +
    public static readonly simpleHtml = `
8 8
        <html>
9 9
        <head>
10 10
            <meta charset="UTF-8">

@@ -11,9 +11,9 @@
Loading
11 11
import path = require('path')
12 12
import { sleep } from '../../../shared/utilities/timeoutUtils'
13 13
14 -
export const IMPORT_REGEX = /^[ \t]*import[ \t]+.+;?$/gm
15 -
export const REQUIRE_REGEX = /^[ \t]*.+require[ \t]*\([ \t]*['"][^'"]+['"][ \t]*\)[ \t]*;?/gm
16 -
export const MODULE_REGEX = /["'][^"'\r\n]+["']/gm
14 +
export const importRegex = /^[ \t]*import[ \t]+.+;?$/gm
15 +
export const requireRegex = /^[ \t]*.+require[ \t]*\([ \t]*['"][^'"]+['"][ \t]*\)[ \t]*;?/gm
16 +
export const moduleRegex = /["'][^"'\r\n]+["']/gm
17 17
18 18
export class JavascriptDependencyGraph extends DependencyGraph {
19 19
    private _generatedDirs: Set<string> = new Set(['node_modules', 'dist', 'build', 'cdk.out'])
@@ -31,7 +31,7 @@
Loading
31 31
    }
32 32
33 33
    getModulePath(modulePathStr: string) {
34 -
        const matches = modulePathStr.match(MODULE_REGEX)
34 +
        const matches = modulePathStr.match(moduleRegex)
35 35
        if (matches) {
36 36
            const extract = matches[0]
37 37
            modulePathStr = extract.substring(1, extract.length - 1)
@@ -105,8 +105,8 @@
Loading
105 105
    async readImports(uri: vscode.Uri) {
106 106
        const content: string = await readFileAsString(uri.fsPath)
107 107
        this._totalLines += content.split(DependencyGraphConstants.newlineRegex).length
108 -
        const importRegExp = new RegExp(IMPORT_REGEX)
109 -
        const requireRegExp = new RegExp(REQUIRE_REGEX)
108 +
        const importRegExp = new RegExp(importRegex)
109 +
        const requireRegExp = new RegExp(requireRegex)
110 110
        const importMatches = content.match(importRegExp)
111 111
        const requireMatches = content.match(requireRegExp)
112 112
        const matches: Set<string> = new Set()

@@ -20,10 +20,10 @@
Loading
20 20
import { Commands } from '../../shared/vscode/commands'
21 21
22 22
//Length of certificate ID. The certificate ID is the last segment of the ARN.
23 -
const CERT_ID_LENGTH = 64
23 +
const certIdLength = 64
24 24
25 25
//Number of digits of the certificate ID to show
26 -
const CERT_PREVIEW_LENGTH = 8
26 +
const certPreviewLength = 8
27 27
28 28
/**
29 29
 * Represents the group of all IoT Policies.
@@ -77,7 +77,7 @@
Loading
77 77
                            this,
78 78
                            this.iot,
79 79
                            (await this.iot.listPolicyTargets({ policyName: policy.policyName! })).map(certId =>
80 -
                                certId.slice(-CERT_ID_LENGTH, -CERT_ID_LENGTH + CERT_PREVIEW_LENGTH)
80 +
                                certId.slice(-certIdLength, -certIdLength + certPreviewLength)
81 81
                            )
82 82
                        )
83 83
                ) ?? []

@@ -15,7 +15,7 @@
Loading
15 15
16 16
const localize = nls.loadMessageBundle()
17 17
18 -
const POLLING_INTERVAL = 20000
18 +
const pollingInterval = 20000
19 19
export class AppRunnerNode extends AWSTreeNodeBase {
20 20
    private readonly serviceNodes: Map<AppRunner.ServiceId, AppRunnerServiceNode> = new Map()
21 21
    private readonly pollingNodes: Set<string> = new Set()
@@ -98,7 +98,7 @@
Loading
98 98
99 99
    public startPolling(id: string): void {
100 100
        this.pollingNodes.add(id)
101 -
        this.pollTimer = this.pollTimer ?? globals.clock.setInterval(this.refresh.bind(this), POLLING_INTERVAL)
101 +
        this.pollTimer = this.pollTimer ?? globals.clock.setInterval(this.refresh.bind(this), pollingInterval)
102 102
    }
103 103
104 104
    public stopPolling(id: string): void {

@@ -31,7 +31,7 @@
Loading
31 31
import { DefaultEcrClient, EcrRepository } from '../../shared/clients/ecrClient'
32 32
import { getSamCliVersion } from '../../shared/sam/cli/samCliContext'
33 33
import * as semver from 'semver'
34 -
import { MINIMUM_SAM_CLI_VERSION_INCLUSIVE_FOR_IMAGE_SUPPORT } from '../../shared/sam/cli/samCliValidator'
34 +
import { minSamCliVersionForImageSupport } from '../../shared/sam/cli/samCliValidator'
35 35
import { ExtContext } from '../../shared/extensions'
36 36
import { validateBucketName } from '../../s3/util'
37 37
import { showViewLogsMessage } from '../../shared/utilities/messages'
@@ -43,7 +43,9 @@
Loading
43 43
import { DefaultS3Client } from '../../shared/clients/s3Client'
44 44
import { telemetry } from '../../shared/telemetry/telemetry'
45 45
46 +
// eslint-disable-next-line @typescript-eslint/naming-convention
46 47
const CREATE_NEW_BUCKET = localize('AWS.command.s3.createBucket', 'Create Bucket...')
48 +
// eslint-disable-next-line @typescript-eslint/naming-convention
47 49
const ENTER_BUCKET = localize('AWS.samcli.deploy.bucket.existingLabel', 'Enter Existing Bucket Name...')
48 50
49 51
export interface SamDeployWizardResponse {
@@ -706,7 +708,7 @@
Loading
<
706 708
        if (this.hasImages) {
707 709
            // TODO: remove check when min version is high enough
708 710
            const samCliVersion = await getSamCliVersion(this.context.extContext.samCliContext())
709 -
            if (semver.lt(samCliVersion, MINIMUM_SAM_CLI_VERSION_INCLUSIVE_FOR_IMAGE_SUPPORT)) {
711 +
            if (semver.lt(samCliVersion, minSamCliVersionForImageSupport)) {
710 712
                vscode.window.showErrorMessage(