Skip to content

Conversation

@RembrandtK
Copy link
Contributor

Now that lint issues were cleaned update, it has became apparent the lint workflow had two issues:

  1. Did not fail on warnings: The workflow used continue-on-error with exit code capture via $?, but $? was always 0 because continue-on-error prevents failures. Fixed by checking step outcomes in a final verification step.

  2. Different results than local linting: CI ran linters from repo root while local 'pnpm lint' runs per-package scripts from package directories. This caused Solhint's import-path-check rule to produce false warnings in CI. Fixed by running Solhint from each package directory using 'pnpm -r exec'.

Additional improvements:

  • Use git ls-files instead of globs to only lint tracked files (much faster)
  • Exclude Ignition/build artifacts from JSON linting (939 → 102 files, 89% reduction)
  • Add --no-warn-ignored to ESLint to suppress ignore pattern warnings
  • Add --no-error-on-unmatched-pattern to Prettier to handle symlinks gracefully
  • Simplify workflow structure with fewer, clearer steps

Also fixed YAML syntax warning in build-test.yml (removed redundant branches filter).

Adding fixes for linting issues introduced on main in interim period prior to globalling fixing lint issues.

…on warnings

The lint workflow had two critical issues:

1. **Did not fail on warnings**: The workflow used continue-on-error with exit
   code capture via $?, but $? was always 0 because continue-on-error prevents
   failures. Fixed by checking step outcomes in a final verification step.

2. **Different results than local linting**: CI ran linters from repo root while
   local 'pnpm lint' runs per-package scripts from package directories. This
   caused Solhint's import-path-check rule to produce false warnings in CI.
   Fixed by running Solhint from each package directory using 'pnpm -r exec'.

Additional improvements:
- Use git ls-files instead of globs to only lint tracked files (much faster)
- Exclude Ignition/build artifacts from JSON linting (939 → 102 files, 89% reduction)
- Add --no-warn-ignored to ESLint to suppress ignore pattern warnings
- Add --no-error-on-unmatched-pattern to Prettier to handle symlinks gracefully
- Simplify workflow structure with fewer, clearer steps

Also fixed YAML syntax warning in build-test.yml (removed redundant branches filter).
@RembrandtK RembrandtK requested a review from Copilot November 14, 2025 18:14
Copilot finished reviewing on behalf of RembrandtK November 14, 2025 18:16
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes critical issues in the lint workflow that prevented it from properly failing on errors and caused inconsistent results between CI and local linting. The main improvements are:

  • Fixed the continue-on-error mechanism by checking step outcomes instead of exit codes
  • Aligned CI linting with local behavior by running Solhint from package directories using pnpm -r exec
  • Improved performance by using git ls-files instead of globs and excluding build artifacts from JSON linting (89% reduction in files checked)

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 8 comments.

File Description
.github/workflows/lint.yml Refactored workflow to consolidate linting steps, fix failure detection via step outcomes, run Solhint from package directories to match local behavior, and optimize file discovery with git ls-files
.github/workflows/build-test.yml Removed redundant branches: '*' filter to fix YAML syntax warning

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

… scripts

- Add proper interfaces for artifact structure in decode-creation-args.ts
- Replace any[] with typed tuple for event args in read-immutables-from-event.ts
- Fixes all pnpm lint:ts warnings
- Add -r flag to all xargs commands to handle empty input gracefully
- Add || true to grep commands to prevent exit code 1 when no matches
- Add error handling when no package.json found for Solidity files
- Ensures workflow doesn't fail on edge cases with empty file lists
- Fails with error if package.json not found (unexpected condition)
@RembrandtK RembrandtK self-assigned this Nov 14, 2025
@RembrandtK RembrandtK requested a review from Copilot November 14, 2025 18:31
Copilot finished reviewing on behalf of RembrandtK November 14, 2025 18:32
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

# Run solhint in each workspace package that has contracts (check mode)
pnpm -r exec bash -c 'if [ -d "contracts" ]; then npx solhint --max-warnings=0 --noPrompt --noPoster "contracts/**/*.sol" 2>/dev/null || exit 1; fi'
# Check formatting with prettier
git ls-files '*.sol' | xargs -r npx prettier --check --cache --log-level warn
Copy link

Copilot AI Nov 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The -r flag for xargs is a GNU extension and may not be available on all systems (macOS uses BSD xargs). Consider using xargs with a conditional check or find -print0 | xargs -0 pattern for better portability. This same issue affects lines 144, 145, 148, 149, 158, 159, 162, 163, 173, 176, 185, 186, 189, and 190.

Copilot uses AI. Check for mistakes.
Comment on lines +147 to +149
echo "Linting changed TypeScript/JavaScript files..."
cat changed_ts_js.txt | xargs -r npx eslint --max-warnings=0 --no-warn-ignored
cat changed_ts_js.txt | xargs -r npx prettier --check --cache --log-level warn --no-error-on-unmatched-pattern
Copy link

Copilot AI Nov 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Missing else clause to skip linting when no files have changed. Without this, if ts_js_count is 0, the step will succeed but won't echo any message. While not critical, this is inconsistent with the 'all' mode branch which explicitly handles all cases. For consistency and clarity, add an else clause with echo 'No TypeScript/JavaScript files to lint.' This same pattern affects the Markdown (lines 160-164), JSON (lines 174-177), and YAML (lines 187-191) linting steps.

Copilot uses AI. Check for mistakes.
@codecov
Copy link

codecov bot commented Nov 14, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.06%. Comparing base (380f6ad) to head (77b2c34).
⚠️ Report is 7 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1254   +/-   ##
=======================================
  Coverage   84.05%   84.06%           
=======================================
  Files          42       42           
  Lines        2070     2071    +1     
  Branches      615      615           
=======================================
+ Hits         1740     1741    +1     
  Misses        330      330           
Flag Coverage Δ
unittests 84.06% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants