Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
laurit17 committed Apr 23, 2024
2 parents 962bc90 + 3fe6dc6 commit 02d4abb
Show file tree
Hide file tree
Showing 13 changed files with 86 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/annotate_pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Trunk Check
uses: trunk-io/trunk-action@540e7fe497a45ae76370d26d95cc249059c4ac3a # v1.1.12
uses: trunk-io/trunk-action@da67635060feab46c164bc130690e61864a5d13b # v1.1.13
with:
post-annotations: true
# This job may fail when the PR was not run on a fork, and that's okay
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@df5a14dc28094dc936e103b37d749c6628682b60 # v3.25.0
uses: github/codeql-action/init@c7f9125735019aa87cfc361530512d50ea439c71 # v3.25.1
# Override language selection by uncommenting this and choosing your languages
with:
languages: javascript

# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
# If this step fails, then you should remove it and run the build manually (see below).
- name: Autobuild
uses: github/codeql-action/autobuild@df5a14dc28094dc936e103b37d749c6628682b60 # v3.25.0
uses: github/codeql-action/autobuild@c7f9125735019aa87cfc361530512d50ea439c71 # v3.25.1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
Expand All @@ -56,4 +56,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@df5a14dc28094dc936e103b37d749c6628682b60 # v3.25.0
uses: github/codeql-action/analyze@c7f9125735019aa87cfc361530512d50ea439c71 # v3.25.1
4 changes: 2 additions & 2 deletions .github/workflows/nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ jobs:
- name: Upload Test Outputs for Upload Job
# Only upload results from latest. Always run, except when cancelled.
if: (failure() || success()) && matrix.linter-version == 'Latest'
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
uses: actions/upload-artifact@1746f4ab65b179e0ea60a494b83293b640dd5bba # v4.3.2
with:
name: ${{ matrix.results-file }}-test-results
path: ${{ matrix.results-file }}-res.json
Expand Down Expand Up @@ -238,7 +238,7 @@ jobs:
- name: Upload Test Outputs for Notification Job
# Always run, except when cancelled.
if: (failure() || success())
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
uses: actions/upload-artifact@1746f4ab65b179e0ea60a494b83293b640dd5bba # v4.3.2
with:
name: tools-${{ matrix.results-file }}-test-results
path: ${{ matrix.results-file }}-res.json
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ jobs:
lfs: true

- name: Trunk Check
uses: trunk-io/trunk-action@540e7fe497a45ae76370d26d95cc249059c4ac3a
uses: trunk-io/trunk-action@da67635060feab46c164bc130690e61864a5d13b
env:
TRUNK_GITHUB_CHECK_RUN_TITLE: Trunk Check

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ jobs:
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
# format to the repository Actions tab.
- name: Upload artifact
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
uses: actions/upload-artifact@1746f4ab65b179e0ea60a494b83293b640dd5bba # v4.3.2
with:
name: SARIF file
path: results.sarif
retention-days: 5

# Upload the results to GitHub's code scanning dashboard.
- name: Upload to code-scanning
uses: github/codeql-action/upload-sarif@df5a14dc28094dc936e103b37d749c6628682b60 # v3.25.0
uses: github/codeql-action/upload-sarif@c7f9125735019aa87cfc361530512d50ea439c71 # v3.25.1
with:
sarif_file: results.sarif
2 changes: 1 addition & 1 deletion .github/workflows/upgrade_trunk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
private_key: ${{ secrets.TRUNK_OPEN_PR_APP_PRIVATE_KEY }}

- name: Trunk Upgrade
uses: trunk-io/trunk-action/upgrade@540e7fe497a45ae76370d26d95cc249059c4ac3a
uses: trunk-io/trunk-action/upgrade@da67635060feab46c164bc130690e61864a5d13b
with:
arguments: -n --bleeding-edge
github-token: ${{ steps.generate-token.outputs.token }}
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/upload_results.reusable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,21 +60,21 @@ jobs:

- name: Retrieve Test Outputs ubuntu
id: download-ubuntu
uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4
uses: actions/download-artifact@8caf195ad4b1dee92908e23f56eeb0696f1dd42d # v4.1.5
continue-on-error: true
with:
name: ${{ inputs.results-prefix }}ubuntu-latest-test-results

- name: Retrieve Test Outputs macOS
id: download-macos
uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4
uses: actions/download-artifact@8caf195ad4b1dee92908e23f56eeb0696f1dd42d # v4.1.5
continue-on-error: true
with:
name: ${{ inputs.results-prefix }}macos-latest-test-results

- name: Retrieve Test Outputs Windows
id: download-windows
uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4
uses: actions/download-artifact@8caf195ad4b1dee92908e23f56eeb0696f1dd42d # v4.1.5
continue-on-error: true
with:
name: ${{ inputs.results-prefix }}windows-latest-test-results
Expand All @@ -96,7 +96,7 @@ jobs:
echo "::endgroup::"
- name: Slack Notification For Missing Artifacts
uses: slackapi/slack-github-action@6c661ce58804a1a20f6dc5fbee7f0381b469e001 # v1.25.0
uses: slackapi/slack-github-action@70cd7be8e40a46e8b0eced40b0de447bdb42f68e # v1.26.0
if:
steps.download-ubuntu.outcome == 'failure' || steps.download-macos.outcome == 'failure' ||
steps.download-windows.outcome == 'failure'
Expand Down Expand Up @@ -179,7 +179,7 @@ jobs:
# Slack notifications
- name: Slack Notification For Failures
uses: slackapi/slack-github-action@6c661ce58804a1a20f6dc5fbee7f0381b469e001 # v1.25.0
uses: slackapi/slack-github-action@70cd7be8e40a46e8b0eced40b0de447bdb42f68e # v1.26.0
if: always() && steps.parse.outputs.failures == 'true'
with:
channel-id: ${{ env.SLACK_CHANNEL_ID }}
Expand All @@ -188,7 +188,7 @@ jobs:
SLACK_BOT_TOKEN: ${{ secrets.TRUNKBOT_SLACK_BOT_TOKEN }}

- name: Slack Notification For Staging Upload Failure
uses: slackapi/slack-github-action@6c661ce58804a1a20f6dc5fbee7f0381b469e001 # v1.25.0
uses: slackapi/slack-github-action@70cd7be8e40a46e8b0eced40b0de447bdb42f68e # v1.26.0
if: inputs.upload-validated-versions == true && steps.upload-staging.outcome == 'failure'
with:
channel-id: ${{ env.SLACK_CHANNEL_ID }}
Expand All @@ -209,7 +209,7 @@ jobs:
SLACK_BOT_TOKEN: ${{ secrets.TRUNKBOT_SLACK_BOT_TOKEN }}

- name: Slack Notification For Prod Upload Failure
uses: slackapi/slack-github-action@6c661ce58804a1a20f6dc5fbee7f0381b469e001 # v1.25.0
uses: slackapi/slack-github-action@70cd7be8e40a46e8b0eced40b0de447bdb42f68e # v1.26.0
if: inputs.upload-validated-versions == true && steps.upload-prod.outcome == 'failure'
with:
channel-id: ${{ env.SLACK_CHANNEL_ID }}
Expand Down
6 changes: 3 additions & 3 deletions .trunk/trunk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: 0.1

# version used for local trunk runs and testing
cli:
version: 1.21.1-beta.20
version: 1.21.1-beta.43
shell_hooks:
enforce: true

Expand Down Expand Up @@ -79,8 +79,8 @@ actions:
- tool-test-helper
tools:
enabled:
- clangd-indexing-tools@17.0.3
- clangd@17.0.3
- clangd-indexing-tools@18.1.3
- clangd@18.1.3
runtimes:
# expose shims in .trunk/tools
- node
22 changes: 22 additions & 0 deletions linters/eslint/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# eslint

## Migration Guide

Trunk does not yet support `[email protected]`, which includes substantial config format changes (see their
[migration guide](https://eslint.org/docs/latest/use/migrate-to-9.0.0#flat-config)). If you'd like
to opt-in to `[email protected]` with Trunk before we release official support, you can add the following
override to your `.trunk/trunk.yaml`:

```yaml
version: 0.1
---
lint:
enabled:
- [email protected]
definitions:
- name: eslint
direct_configs:
- eslint.config.js
- eslint.config.mjs
- eslint.config.cjs
```
13 changes: 13 additions & 0 deletions linters/eslint/eslint.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { spawnSync } from "child_process";
import fs from "fs";
import path from "path";
import semver from "semver";
import { customLinterCheckTest } from "tests";
import { TrunkLintDriver } from "tests/driver";
import { osTimeoutMultiplier, TEST_DATA } from "tests/utils";
Expand Down Expand Up @@ -54,6 +55,7 @@ const preCheck = (driver: TrunkLintDriver) => {
cwd: driver.getSandbox(),
timeout: INSTALL_TIMEOUT,
windowsHide: true,
shell: true,
},
);
driver.debug(install);
Expand All @@ -68,12 +70,22 @@ const preCheck = (driver: TrunkLintDriver) => {
}
};

const manualVersionReplacer = (version: string) => {
// NOTE(Tyler): Continue to test eslint pre-9.0.0 and gate until we have a long-term fix.
const parsedVersion = semver.parse(version);
if (parsedVersion && parsedVersion.major >= 9) {
return "8.57.0";
}
return version;
};

// This set of testing is incomplete with regard to failure modes and unicode autofixes with eslint, but it serves as a sampling
// Use upstream=false in order to supply autofixes for committed files.
customLinterCheckTest({
linterName: "eslint",
args: `${TEST_DATA} -y --upstream=false`,
preCheck,
manualVersionReplacer,
pathsToSnapshot: [
path.join(TEST_DATA, "non_ascii.ts"),
path.join(TEST_DATA, "eof_autofix.ts"),
Expand All @@ -86,4 +98,5 @@ customLinterCheckTest({
testName: "bad_install",
args: `${TEST_DATA} -y`,
preCheck: moveConfig,
manualVersionReplacer,
});
30 changes: 29 additions & 1 deletion linters/plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ lint:
leading_delimiter: "{-"
trailing_delimiter: "-}"

- name: brace-slashes-block
leading_delimiter: "{/*"
trailing_delimiter: "*/}"

- name: brace-slashes-block-spaced
leading_delimiter: "{ /*"
trailing_delimiter: "*/ }"

- name: dashes-block
leading_delimiter: --[[
trailing_delimiter: --]]
Expand Down Expand Up @@ -282,11 +290,21 @@ lint:
extensions:
- cjs
- js
- jsx
- mjs
inherit:
- javascript-xml
comments:
- slashes-block
- slashes-inline

- name: javascript-xml
extensions:
- jsx
comments:
- slashes-block
- slashes-inline
- brace-slashes-block
- brace-slashes-block-spaced

- name: json
extensions:
Expand Down Expand Up @@ -572,10 +590,20 @@ lint:
extensions:
- mts
- ts
inherit:
- typescript-xml
comments:
- slashes-block
- slashes-inline

- name: typescript-xml
extensions:
- tsx
comments:
- slashes-block
- slashes-inline
- brace-slashes-block
- brace-slashes-block-spaced

- name: xib
extensions:
Expand Down
3 changes: 2 additions & 1 deletion linters/terrascan/plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ lint:
- name: terrascan
tools: [terrascan]
known_good_version: 1.18.1
suggest_if: files_present
description: A static code analyzer for IaC
# terrascan does not support some modern terraform syntax. Don't auto-recommend.
suggest_if: never
commands:
- name: lint
output: sarif
Expand Down
1 change: 0 additions & 1 deletion tests/repo_tests/config_check.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ describe("Global config health check", () => {
"shfmt",
"svgo",
"taplo",
"terrascan",
"tflint",
"trivy",
"trufflehog",
Expand Down

0 comments on commit 02d4abb

Please sign in to comment.