Skip to content

Commit 0ba37d8

Browse files
committed
Merge 'public/master' into feature/cwltail
2 parents ed15bbc + b80529e commit 0ba37d8

File tree

276 files changed

+17860
-2164
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

276 files changed

+17860
-2164
lines changed

.eslintrc.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module.exports = {
1212
mocha: true,
1313
es2024: true,
1414
},
15-
plugins: ['@typescript-eslint', 'unicorn', 'header', 'security-node', 'aws-toolkits'],
15+
plugins: ['@typescript-eslint', '@stylistic', 'unicorn', 'header', 'security-node', 'aws-toolkits'],
1616
extends: [
1717
'eslint:recommended',
1818
'plugin:@typescript-eslint/eslint-recommended',
@@ -113,6 +113,20 @@ module.exports = {
113113
'no-constant-condition': ['error', { checkLoops: false }],
114114
'no-empty': 'off',
115115

116+
// https://eslint.style/rules/default/spaced-comment
117+
// Require space after // comment.
118+
'@stylistic/spaced-comment': [
119+
'error',
120+
'always',
121+
{
122+
block: {
123+
markers: ['!'], // Allow the /*!…*/ license header.
124+
// exceptions: ['*'],
125+
// balanced: true
126+
},
127+
},
128+
],
129+
116130
// Rules from https://github.com/sindresorhus/eslint-plugin-unicorn
117131
// TODO: 'unicorn/no-useless-promise-resolve-reject': 'error',
118132
// TODO: 'unicorn/prefer-at': 'error',

.github/CODEOWNERS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
* @aws/aws-ides-team
22
packages/core/src/codewhisperer/ @aws/codewhisperer-team
33
packages/core/src/amazonqFeatureDev/ @aws/earlybird
4-
packages/core/src/codewhispererChat/ @aws/dexp
5-
packages/core/src/amazonq/ @aws/dexp
4+
packages/core/src/codewhispererChat/ @aws/flare
5+
packages/core/src/amazonq/ @aws/flare
66
packages/core/src/awsService/accessanalyzer/ @aws/access-analyzer

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
---
88

9-
<!--- REMINDER: Ensure that your PR meets the guidelines in CONTRIBUTING.md -->
9+
- Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time.
10+
- Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines).
1011

1112
License: I confirm that my contribution is made under the terms of the Apache 2.0 license.

.github/workflows/copyPasteDetection.yml

Lines changed: 0 additions & 86 deletions
This file was deleted.

.github/workflows/lintbranch.js

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
// Check that branch name conforms to GitHub naming convention:
2+
// https://docs.github.com/en/get-started/using-git/dealing-with-special-characters-in-branch-and-tag-names#naming-branches-and-tags
3+
4+
// To run self-tests,
5+
// node lintbranch.js test
6+
// TODO: deduplicate code from lintbranch.js and lintcommit.js.
7+
8+
function isValid(branchName) {
9+
const branchNameRegex = /^[a-zA-Z][a-zA-Z0-9._/-]*$/
10+
11+
return branchNameRegex.test(branchName)
12+
}
13+
14+
function run(branchName) {
15+
if (isValid(branchName)) {
16+
console.log(`Branch name "${branchName}" is valid.`)
17+
process.exit(0)
18+
} else {
19+
const helpUrl =
20+
'https://docs.github.com/en/get-started/using-git/dealing-with-special-characters-in-branch-and-tag-names#naming-branches-and-tags'
21+
console.log(`Branch name "${branchName}" is invalid see ${helpUrl} for more information.`)
22+
process.exit(1)
23+
}
24+
}
25+
26+
function _test() {
27+
const tests = {
28+
'feature/branch-name': true,
29+
feature_123: true,
30+
'my-branch': true,
31+
'123invalid-start': false,
32+
'!invalid@start': false,
33+
'': false,
34+
'another/valid-name134': true,
35+
'feature/123";id;{echo,Y2F0IC9ldGMvcGFzc3dk}|{base64,-d}|{bash,-i};#': false,
36+
}
37+
38+
let passed = 0
39+
let failed = 0
40+
41+
for (const [branchName, expected] of Object.entries(tests)) {
42+
const result = isValid(branchName)
43+
if (result === expected) {
44+
console.log(`✅ Test passed for "${branchName}"`)
45+
passed++
46+
} else {
47+
console.log(`❌ Test failed for "${branchName}" (expected "${expected}", got "${result}")`)
48+
failed++
49+
}
50+
}
51+
52+
console.log(`\n${passed} tests passed, ${failed} tests failed`)
53+
}
54+
55+
function main() {
56+
const mode = process.argv[2]
57+
58+
if (mode === 'test') {
59+
_test()
60+
} else if (mode === 'run') {
61+
run(process.argv[3])
62+
} else {
63+
throw new Error(`Unknown mode: ${mode}`)
64+
}
65+
}
66+
67+
main()

.github/workflows/node.js.yml

Lines changed: 90 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ jobs:
3232
- uses: actions/setup-node@v4
3333
with:
3434
node-version: '20'
35+
- name: Validate Branch name
36+
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref != ''}}
37+
env:
38+
BRANCH_NAME: ${{ github.event.pull_request.head.ref }}
39+
run: |
40+
node "$GITHUB_WORKSPACE/.github/workflows/lintbranch.js" run "$BRANCH_NAME"
3541
- name: Check PR title
3642
run: |
3743
node "$GITHUB_WORKSPACE/.github/workflows/lintcommit.js"
@@ -55,6 +61,87 @@ jobs:
5561
- run: npm run testCompile
5662
- run: npm run lint
5763

64+
jscpd:
65+
needs: lint-commits
66+
if: ${{ github.event_name == 'pull_request'}}
67+
runs-on: ubuntu-latest
68+
strategy:
69+
matrix:
70+
node-version: [18.x]
71+
env:
72+
NODE_OPTIONS: '--max-old-space-size=8192'
73+
74+
steps:
75+
- uses: actions/checkout@v4
76+
with:
77+
fetch-depth: 0
78+
79+
- name: Use Node.js ${{ matrix.node-version }}
80+
uses: actions/setup-node@v4
81+
with:
82+
node-version: ${{ matrix.node-version }}
83+
84+
- name: Fetch fork upstream
85+
env:
86+
REPO_NAME: ${{ github.event.pull_request.head.repo.full_name }}
87+
run: |
88+
git remote add forkUpstream https://github.com/$REPO_NAME # URL of the fork
89+
git fetch forkUpstream # Fetch fork
90+
91+
- name: Compute git diff
92+
env:
93+
CURRENT_BRANCH: ${{ github.head_ref }}
94+
TARGET_BRANCH: ${{ github.event.pull_request.base.ref }}
95+
run: git diff --name-only origin/$TARGET_BRANCH forkUpstream/$CURRENT_BRANCH > diff_output.txt
96+
97+
- run: npm install -g jscpd
98+
99+
- run: jscpd --config "$GITHUB_WORKSPACE/.github/workflows/jscpd.json"
100+
101+
- if: always()
102+
uses: actions/upload-artifact@v4
103+
with:
104+
name: unfiltered-jscpd-report
105+
path: ./jscpd-report.json
106+
107+
- name: Filter jscpd report for changed files
108+
run: |
109+
if [ ! -f ./jscpd-report.json ]; then
110+
echo "jscpd-report.json not found"
111+
exit 1
112+
fi
113+
echo "Filtering jscpd report for changed files..."
114+
CHANGED_FILES=$(jq -R -s -c 'split("\n")[:-1]' diff_output.txt)
115+
echo "Changed files: $CHANGED_FILES"
116+
jq --argjson changed_files "$CHANGED_FILES" '
117+
.duplicates | map(select(
118+
(.firstFile?.name as $fname | $changed_files | any(. == $fname)) or
119+
(.secondFile?.name as $sname | $changed_files | any(. == $sname))
120+
))
121+
' ./jscpd-report.json > filtered-jscpd-report.json
122+
cat filtered-jscpd-report.json
123+
124+
- name: Check for duplicates
125+
run: |
126+
if [ $(wc -l < ./filtered-jscpd-report.json) -gt 1 ]; then
127+
echo "filtered_report_exists=true" >> $GITHUB_ENV
128+
else
129+
echo "filtered_report_exists=false" >> $GITHUB_ENV
130+
fi
131+
- name: upload filtered report (if applicable)
132+
if: env.filtered_report_exists == 'true'
133+
uses: actions/upload-artifact@v4
134+
with:
135+
name: filtered-jscpd-report
136+
path: ./filtered-jscpd-report.json
137+
138+
- name: Fail and log found duplicates.
139+
if: env.filtered_report_exists == 'true'
140+
run: |
141+
cat ./filtered-jscpd-report.json
142+
echo "Duplications found, failing the check."
143+
exit 1
144+
58145
macos:
59146
needs: lint-commits
60147
name: test macOS
@@ -84,7 +171,7 @@ jobs:
84171
env:
85172
# Unset NODE_OPTIONS because of https://github.com/codecov/uploader/issues/475
86173
NODE_OPTIONS: ''
87-
if: ${{ github.repository == 'aws/aws-toolkit-vscode' && github.ref == 'master' }}
174+
if: ${{ github.repository == 'aws/aws-toolkit-vscode' && github.event_name == 'pull_request' && github.base_ref == 'master' }}
88175
uses: codecov/codecov-action@v5
89176
with:
90177
flags: macos-toolkit-unittests
@@ -95,7 +182,7 @@ jobs:
95182
env:
96183
# Unset NODE_OPTIONS because of https://github.com/codecov/uploader/issues/475
97184
NODE_OPTIONS: ''
98-
if: ${{ github.repository == 'aws/aws-toolkit-vscode' && github.ref == 'master' }}
185+
if: ${{ github.repository == 'aws/aws-toolkit-vscode' && github.event_name == 'pull_request' && github.base_ref == 'master' }}
99186
uses: codecov/codecov-action@v5
100187
with:
101188
flags: macos-amazonq-unittests
@@ -154,7 +241,7 @@ jobs:
154241
env:
155242
# Unset NODE_OPTIONS because of https://github.com/codecov/uploader/issues/475
156243
NODE_OPTIONS: ''
157-
if: ${{ github.repository == 'aws/aws-toolkit-vscode' && github.ref == 'master' }}
244+
if: ${{ github.repository == 'aws/aws-toolkit-vscode' && github.event_name == 'pull_request' && github.base_ref == 'master' }}
158245
uses: codecov/codecov-action@v5
159246
with:
160247
flags: windows-unittests

CONTRIBUTING.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,12 @@ You can find documentation to create VSCode IDE settings for CodeCatalyst bluepr
238238
239239
Before sending a pull request:
240240
241+
1. Treat all work as PUBLIC. Private `feature/x` branches will _not_ be squash-merged at release time. This has several benefits:
242+
- Avoids mistakes (accidental exposure to public)!
243+
- Avoids needing to erase (squash-merge) history.
241244
1. Check that you are working against the latest source on the `master` branch.
242-
2. Check existing open, and recently merged, pull requests to make sure someone else hasn't addressed the problem already.
243-
3. Open an issue to discuss any significant work.
245+
1. Check existing open, and recently merged, pull requests to make sure someone else hasn't addressed the problem already.
246+
1. Open an issue to discuss any significant work.
244247
245248
To send a pull request:
246249

buildspec/shared/common.sh

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,9 @@
66

77
# Ignore these patterns when deciding if the build should fail.
88
# - "waiting for browser": from `ssoAccessTokenProvider.test.ts`, unclear how to fix it.
9-
# - "Webview is disposed": only happens on vscode "minimum" (1.68.0)
109
# - "HTTPError: Response code …": caused by github rate-limiting.
1110
# - "npm WARN deprecated querystring": transitive dep of aws sdk v2 (check `npm ls querystring`), so that's blocked until we migrate to v3.
12-
_ignore_pat='Timed-out waiting for browser login flow\|HTTPError: Response code 403\|HTTPError: Response code 404\|npm WARN deprecated querystring\|npm WARN deprecated'
13-
if [ "$VSCODE_TEST_VERSION" = 'minimum' ]; then
14-
_ignore_pat="$_ignore_pat"'\|Webview is disposed'
15-
fi
11+
_ignore_pat='HTTPError: Response code 403\|HTTPError: Response code 404\|npm WARN deprecated querystring\|npm WARN deprecated'
1612

1713
# Do not print (noisy) lines matching these patterns.
1814
# - "ERROR:bus… Failed to connect to the bus": noise related to "xvfb". https://github.com/cypress-io/cypress/issues/19299

0 commit comments

Comments
 (0)