Skip to content

ci: lint scripts and workflows#48

Merged
janisz merged 9 commits intomainfrom
shellcheck
Mar 6, 2026
Merged

ci: lint scripts and workflows#48
janisz merged 9 commits intomainfrom
shellcheck

Conversation

@janisz
Copy link
Contributor

@janisz janisz commented Mar 2, 2026

added shellcheck and actionlint

janisz and others added 7 commits March 3, 2026 19:16
- Fix unused loop variable warnings in shell scripts by using underscore
- Fix codecov action parameter (file -> files) for v5 compatibility

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add comprehensive linting for shell scripts and GitHub Actions workflows to improve code quality and catch issues early.

- Add shellcheck configuration (.shellcheckrc) with external sources enabled
- Add actionlint for GitHub Actions workflow validation
- Create make targets for shell-lint and actionlint
- Integrate both linters into CI style workflow
- Add documentation for code style checks and shell script guidelines
- Add actionlint as a versioned Go tool dependency

The project now has linting coverage for:
- Go code (golangci-lint)
- Shell scripts (shellcheck)
- GitHub Actions workflows (actionlint)
- Dockerfiles (hadolint)
- Helm charts (kube-linter)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Apply shellcheck recommendations across all shell scripts:
- Use braces around all variable references (SC2250)
- Replace [ ] with [[ ]] for conditional tests (SC2292)
- Add double quotes around variables in comparisons (SC2248)

This ensures all scripts follow modern Bash best practices and pass
shellcheck validation without warnings.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

# Conflicts:
#	e2e-tests/scripts/run-tests.sh
Add comments explaining why SC2317 and SC2310 are false positives:
- SC2317: cleanup() is invoked via trap, not directly
- SC2310: || true pattern is intentional for test runner

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Group multiple echo redirects into a single command block and properly
quote $GITHUB_STEP_SUMMARY to address shellcheck warnings SC2129 and SC2086.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Signed-off-by: Tomasz Janiszewski <tomek@redhat.com>
@github-actions
Copy link

github-actions bot commented Mar 3, 2026

E2E Test Results

Commit: a2806af
Workflow Run: View Details

=== Evaluation Summary ===

  ✓ list-clusters (assertions: 3/3)
  ✓ cve-detected-workloads (assertions: 3/3)
  ✓ cve-detected-clusters (assertions: 3/3)
  ✓ cve-nonexistent (assertions: 3/3)
  ✓ cve-cluster-does-exist (assertions: 3/3)
  ~ cve-cluster-does-not-exist (assertions: 2/3)
      - ToolsUsed: Required tool not called: server=stackrox-mcp, tool=, pattern=list_clusters
  ✓ cve-clusters-general (assertions: 3/3)
  ✓ cve-cluster-list (assertions: 3/3)
  ✓ cve-log4shell (assertions: 3/3)
  ✓ cve-multiple (assertions: 3/3)
  ~ rhsa-not-supported (assertions: 1/2)
      - MaxToolCalls: Too many tool calls: expected <= 1, got 3

Tasks:      11/11 passed (100.00%)
Assertions: 30/32 passed (93.75%)

Signed-off-by: Tomasz Janiszewski <tomek@redhat.com>
@codecov-commenter
Copy link

codecov-commenter commented Mar 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.37%. Comparing base (784bec2) to head (a2806af).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #48   +/-   ##
=======================================
  Coverage   78.37%   78.37%           
=======================================
  Files          27       27           
  Lines        1216     1216           
=======================================
  Hits          953      953           
  Misses        223      223           
  Partials       40       40           

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

Address shellcheck warnings SC2086 and SC2129 by quoting all variable
references and grouping multiple redirects to the same file.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@janisz janisz requested a review from mtodor March 5, 2026 14:55
@janisz janisz merged commit 9bf4946 into main Mar 6, 2026
6 checks passed
@janisz janisz deleted the shellcheck branch March 6, 2026 14:19
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.

3 participants