Repository navigation
chore: fix the oxlint violations in the reporting and release helper scripts #336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
09ea6aa
chore: fix the oxlint violations in the reporting and release helper …
cryptodev-2s b261d29
chore: merge main and resolve the conflicts
cryptodev-2s af3e045
chore: restore the package version that the merge overwrote
cryptodev-2s 5c8f1ec
chore: merge main and resolve the conflicts
cryptodev-2s 7276e88
chore: move the skip empty lines comment above the if
cryptodev-2s 3b767f7
Merge branch 'main' into chore/fix-oxlint-reporting-scripts
cryptodev-2s File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
1 change: 0 additions & 1 deletion
1
.github/actions/playwright-test-health-report/create-playwright-test-health-report.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,4 @@ | ||
| #!/usr/bin/env node | ||
|
|
||
| import { Octokit } from '@octokit/rest'; | ||
|
|
||
| import { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,18 +26,18 @@ async function getTeam(repository, prNumber) { | |
|
|
||
| const topologyJsonUrl = | ||
| 'https://raw.githubusercontent.com/MetaMask/MetaMask-planning/refs/heads/main/topology.json'; | ||
| const githubToken = process.env.GITHUB_TOKEN; | ||
| const topologyToken = process.env.GITHUB_TOKEN; | ||
|
|
||
| const response = await axios.get(topologyJsonUrl, { | ||
| headers: { Authorization: `token ${githubToken}` }, | ||
| headers: { Authorization: `token ${topologyToken}` }, | ||
| }); | ||
|
|
||
| // Check if the response is successful and contains data | ||
| if (response.status !== 200 || !response.data) { | ||
| console.error( | ||
| `Invalid response when fetching topology.json: ${response.status}`, | ||
| ); | ||
| return undefined; | ||
| return; | ||
| } | ||
|
|
||
| const topologyJson = response.data; | ||
|
|
@@ -59,13 +59,11 @@ async function getTeam(repository, prNumber) { | |
| } | ||
|
|
||
| // Return undefined if author not found in any team | ||
| return undefined; | ||
| } catch (error) { | ||
| console.error( | ||
| `Error fetching team for PR #${prNumber}:`, | ||
| error.message || error, | ||
| ); | ||
| return undefined; | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -75,7 +73,7 @@ async function filterCommitsByTeam(platform, refA, refB) { | |
| const MAX_COMMITS = 500; // Limit the number of commits to process | ||
| console.log('Filtering commits by team...'); | ||
|
|
||
| var repository = ''; | ||
| let repository = ''; | ||
|
|
||
| switch (platform) { | ||
| case 'mobile': | ||
|
|
@@ -163,7 +161,7 @@ function formatAsCSV(commitsByTeam) { | |
| stripDelimiter(commit.author, ','), | ||
| commit.prLink, | ||
| stripDelimiter(team, ','), | ||
| , | ||
| '', | ||
| assignChangeType(commit.message), | ||
| ]; | ||
| csvContent.push(row.join(',')); | ||
|
|
@@ -177,35 +175,31 @@ function formatAsCSV(commitsByTeam) { | |
| // Helper function to strip delimiter from CSV fields so they can be properly imported automatically later | ||
| function stripDelimiter(inputString, delimiter) { | ||
| // Create a regex dynamically based on the provided delimiter | ||
| const regex = new RegExp(delimiter, 'g'); | ||
| const regex = new RegExp(delimiter, 'gu'); | ||
| return inputString.replace(regex, ''); | ||
| } | ||
|
|
||
| // Helper function to escape CSV fields | ||
| function escapeCSV(field) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Was this unused?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes unused |
||
| if (field.includes(',') || field.includes('"') || field.includes('\n')) { | ||
| return `"${field.replace(/"/g, '""')}"`; // Encapsulate in double quotes and escape existing quotes | ||
| } | ||
| return field; | ||
| } | ||
| // Helper function to create change type | ||
| function assignChangeType(field) { | ||
| if (field.includes('feat')) return 'Added'; | ||
| else if ( | ||
| if (field.includes('feat')) { | ||
| return 'Added'; | ||
| } else if ( | ||
| field.includes('cherry') || | ||
| field.includes('bump') || | ||
| field.includes('release') | ||
| ) | ||
| ) { | ||
| return 'Ops'; | ||
| else if ( | ||
| } else if ( | ||
| field.includes('chore') || | ||
| field.includes('test') || | ||
| field.includes('ci') || | ||
| field.includes('docs') || | ||
| field.includes('refactor') | ||
| ) | ||
| ) { | ||
| return 'Changed'; | ||
| else if (field.includes('fix')) return 'Fixed'; | ||
| } else if (field.includes('fix')) { | ||
| return 'Fixed'; | ||
| } | ||
|
|
||
| return 'Unknown'; | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What lint violation does this fix? 😅
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
None I left it in purpose because its just more readable which token is this. I can rename it back if we prefer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's fine, was just curious.