How to Add a Quality Gate to Your AI-Assisted Pipeline in 5 Minutes
The easiest way to keep quality from drifting is to check it on every push. Here's how to set that up.
GitHub Actions
Add this to .github/workflows/quality.yml:
name: Code Quality
on: [push, pull_request]
jobs:
scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- run: npx aislop ci --fail-below 70 That's it. The ci command exits with code 1 if the score drops below 70.
GitLab CI
code-quality:
image: node:22
script:
- npx aislop ci --fail-below 70 Picking a threshold
Start low. If your codebase currently scores 55, don't set the threshold at 80. You'll just disable the check on day one. Set it at 50, fix the worst stuff, bump it to 60. Ratchet up over time.
Rough guide: 70+ means no critical issues. 80+ is a well-maintained codebase. 90+ is very clean.
Only scan changed files
On large repos, scanning everything on every PR is slow. Use --changes to only check files modified in the current diff:
npx aislop ci --changes --fail-below 70 Auto-fix before commit
Some teams run aislop fix as a pre-commit hook so formatting and dead imports never make it into a PR. Reviewers see clean diffs and can focus on logic instead of style.
# .husky/pre-commit
npx aislop fix --staged