Skip to content

ci: add Credo static analysis and mix_audit dep security (CRY-57) - #145

Merged
bougyman merged 4 commits into
mainfrom
CRY-57-static-analysis-and-dep-security
Aug 18, 2026
Merged

ci: add Credo static analysis and mix_audit dep security (CRY-57)#145
bougyman merged 4 commits into
mainfrom
CRY-57-static-analysis-and-dep-security

Conversation

@bougyman

Copy link
Copy Markdown
Member

Summary

  • Adds credo ~> 1.7 and mix_audit ~> 2.1 to app/mix.exs
  • Creates app/.credo.exs with a project-appropriate baseline config:
    • AliasUsage disabled (codebase intentionally uses full paths in Ash DSL contexts)
    • SpecWithStruct disabled (follow-up ticket to migrate @specs to proper t() types)
    • Nesting threshold raised to 3 (anonymous-function/case nesting is idiomatic Elixir here)
  • Adds elixirc_options: [warnings_as_errors: Mix.env() == :test] to prevent new compiler-warning regressions in CI
  • Wires mix deps.audit (step 3) and mix credo --strict (step 5) into the mix ci quality gate, before mix test for fail-fast behaviour
  • Fixes all pre-existing Credo findings to establish a clean baseline:
    • Three "..." strings with 4+ escaped quotes converted to ~s[...] sigils
    • Four single-condition cond do blocks in tests converted to if/else

Test plan

  • mix ci runs all 7 steps and mix credo --strict exits 0
  • mix deps.audit exits 0 (no known vulnerabilities)
  • 248/254 tests pass (6 pre-existing git worktree failures unrelated to this change)
  • All commits pass conventional-commit format

Closes CRY-57.

🤖 Generated with Claude Code

Copilot AI lite review requested due to automatic review settings August 18, 2026 14:26

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

bougyman and others added 3 commits August 18, 2026 13:02
Adds:
- {:credo, "~> 1.7"} for Elixir static analysis
- {:mix_audit, "~> 2.1"} for dependency security advisory scanning
- app/.credo.exs with baseline configuration:
  - AliasUsage disabled (codebase uses full paths intentionally in Ash DSL)
  - SpecWithStruct disabled (follow-up to migrate @specs to t() types)
  - Nesting threshold raised to 3 (fn/case nesting is idiomatic here)
- elixirc_options: [warnings_as_errors: true] in test env to prevent
  compiler-warning regressions

Part of CRY-57.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Fix all Credo findings in the existing codebase:
- Replace escaped-quote strings with ~s[] sigils in favorites.ex,
  oban_repo.ex, and rollover.ex (StringSigils check)
- Convert single-condition cond do blocks to if/else in
  profile_defaults_test.exs (CondStatements check)

Part of CRY-57.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Extends the mix ci task (and the ci.yaml comment that documents it)
with two new steps:
- Step 3: mix deps.audit — checks Mix deps against the Elixir security
  advisory database (complementary to hex.audit's retirement checks)
- Step 5: mix credo --strict — static analysis across all source files

Steps run before mix test to fail fast on analysis before the slower
test suite. Closes CRY-57.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@bougyman
bougyman force-pushed the CRY-57-static-analysis-and-dep-security branch from b643186 to 060a10e Compare August 18, 2026 17:04
The rebase onto main pulled in CRY-58's normalization which collapsed
a two-clause with into a single-clause with/else. Credo WithSingleClause
flags single-clause with + else blocks; convert to case to satisfy it.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@bougyman
bougyman merged commit b43baa2 into main Aug 18, 2026
2 checks passed
@bougyman
bougyman deleted the CRY-57-static-analysis-and-dep-security branch August 18, 2026 17:07
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