Skip to content

Commit 901bfbe

Browse files
authored
Merge pull request #6024 from witness-me/wfs-invalid-json
feat(stepfunctions): Prevent launching Workflow Studio with invalid JSON + save metric refactoring
2 parents f48080f + 1701d49 commit 901bfbe

File tree

919 files changed

+82512
-23695
lines changed

Some content is hidden

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

919 files changed

+82512
-23695
lines changed

.eslintrc.js

Lines changed: 34 additions & 8 deletions
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',
@@ -162,7 +176,8 @@ module.exports = {
162176
'aws-toolkits/no-incorrect-once-usage': 'error',
163177
'aws-toolkits/no-string-exec-for-child-process': 'error',
164178
'aws-toolkits/no-console-log': 'error',
165-
179+
'aws-toolkits/no-json-stringify-in-log': 'error',
180+
'aws-toolkits/no-printf-mismatch': 'error',
166181
'no-restricted-imports': [
167182
'error',
168183
{
@@ -173,13 +188,24 @@ module.exports = {
173188
"Avoid importing from the core lib's dist/ folders; please use directly from the core lib defined exports.",
174189
},
175190
],
191+
// The following will place an error on the `fs-extra` import since we do not want it to be used for browser compatibility reasons.
192+
paths: [
193+
{
194+
name: 'fs-extra',
195+
message:
196+
'Avoid fs-extra, use shared/fs/fs.ts. Notify the Toolkit team if your required functionality is not available.',
197+
},
198+
{
199+
name: 'fs',
200+
message: 'Avoid node:fs and use shared/fs/fs.ts when possible.',
201+
},
202+
{
203+
name: 'child_process',
204+
message:
205+
'Avoid child_process, use ChildProcess from `shared/utilities/processUtils.ts` instead.',
206+
},
207+
],
176208
},
177-
// The following will place an error on the `fs-extra` import since we do not want it to be used for browser compatibility reasons.
178-
// {
179-
// name: 'fs-extra',
180-
// message:
181-
// 'Avoid fs-extra, use shared/fs/fs.ts. Notify the Toolkit team if your required functionality is not available.',
182-
// },
183209
],
184210
},
185211
}

.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
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
name: unreliable test
3+
about: Help us monitor our test suite by reporting flaky tests.
4+
labels: tests-ci-cd
5+
---
6+
7+
## Test Details
8+
9+
- Name of test:
10+
- OS of failure:
11+
- VSCode version of failure (minimum/insider/stable):
12+
- Link to failing run:
13+
- Link to failing test:
14+
15+
## Log of Test Failure
16+
17+
## Additional Information

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66

77
---
88

9-
<!--- REMINDER: Ensure that your PR meets the guidelines in CONTRIBUTING.md -->
10-
11-
License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
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).
11+
- License: I confirm that my contribution is made under the terms of the Apache 2.0 license.

.github/workflows/jscpd.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"pattern": "packages/**/*.ts",
3+
"ignore": ["**node_modules**", "**dist**", "**/scripts/**"],
4+
"gitignore": true,
5+
"threshold": 3.0,
6+
"minLines": 10,
7+
"output": "./",
8+
"reporters": ["json"]
9+
}

.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/lintcommit.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ Invalid pull request title: \`${title}\`
130130
* scope: lowercase, <30 chars
131131
* subject: must be <100 chars
132132
* documentation: https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#pull-request-title
133+
* Hint: *close and re-open the PR* to re-trigger CI (after fixing the PR title).
133134
`
134135
: `Pull request title matches the [expected format](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#pull-request-title).`
135136

0 commit comments

Comments
 (0)