CI/CD Integration
Integrate Falcon into your continuous integration pipeline for automated analysis, PR comments, and quality gates.
1. GitHub Actions
Add Falcon to your GitHub Actions workflow. Below is a complete workflow that runs basic analysis, posts PR comments, and tracks AI score.
Create .github/workflows/falcon.yml:
name: Falcon Analysis
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
jobs:
falcon:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-action@stable
- name: Install Falcon
run: cargo install --git https://github.com/viveky259259/falcon
- name: Run Falcon analysis
run: falcon check . --fail-on error
- name: Run AI score
id: ai-score
run: |
falcon score . --json > score.json
SCORE=$(jq -r '.score' score.json)
echo "score=$SCORE" >> $GITHUB_OUTPUT
- name: Post PR comment
if: github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const report = fs.readFileSync('score.json', 'utf8');
const data = JSON.parse(report);
const body = `## Falcon Analysis
**AI Score:** ${data.score}/100 (${data.grade})
**Issues:** ${data.issues || 0} found
`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: body
});
2. GitLab CI
Add Falcon to your GitLab CI pipeline. Example .gitlab-ci.yml with CodeClimate format output:
stages:
- analyze
falcon:
stage: analyze
image: rust:latest
before_script:
- cargo install --git https://github.com/viveky259259/falcon
script:
- falcon check . --format codeclimate --output gl-codeclimate-report.json
artifacts:
reports:
codequality: gl-codeclimate-report.json
3. PR Comment Bot
Use falcon review --format gh to print PR-ready markdown, then pipe it into your CI comment step.
How it works
The command analyzes changed Dart files, formats the output as markdown, and leaves posting to tools such as the GitHub CLI.
Flags
--base-ref— Git ref to diff against--strictness— Review strictness level--semantic— Run dart analyze and defer overlapping Falcon findings--baseline— Only report findings not present in a baseline file
Posting
In GitHub Actions, pipe the rendered markdown into gh pr comment --body-file -.
Example PR comment output
## Falcon Analysis
**AI Score:** 82/100 (B)
| Dimension | Score |
|-----------|-------|
| Maintainability | 78% |
| Testability | 85% |
| Performance | 82% |
| Security | 80% |
| Consistency | 92% |
| Documentation | 62% |
**Issues found:** 4
- 2 errors
- 2 warnings
Run Falcon locally: `falcon check .`
4. Webhook Integration
Use falcon x webhook to send analysis events to external services.
Event types
analysis.complete— Analysis finished successfullyscore.changed— AI score changed (e.g., from previous run)drift.detected— Drift from conventions detected
Example command
$ falcon x webhook --url https://hooks.example.com/falcon --event analysis.complete
Example payload (JSON)
{
"event": "analysis.complete",
"timestamp": "2025-03-18T10:30:00Z",
"project": "/path/to/project",
"results": {
"errors": 2,
"warnings": 5,
"ai_score": 82,
"grade": "B"
}
}
5. Exit Codes
Falcon uses the following exit codes for CI integration:
| Code | Meaning |
|---|---|
0 | Pass — No errors (or no errors above the configured threshold) |
1 | Errors found — One or more issues at error level |
2 | Configuration or runtime error |
Use --fail-on error to fail only on errors; use --fail-on warning to also fail on warnings.
6. Output Formats
Falcon supports multiple output formats for different CI and tooling integrations:
| Format | Use case |
|---|---|
console | Human-readable terminal output (default) |
json | Machine-readable JSON for scripts and pipelines |
html | HTML report for artifact storage or dashboards |
sarif | SARIF format for GitHub Code Scanning |
codeclimate | CodeClimate format for GitLab and other tools |
checkstyle | Checkstyle XML for Jenkins and similar |
sonar | SonarQube/SonarCloud import format |
gitlab | GitLab Code Quality report format |
Example:
falcon check . --format sarif --output falcon-report.sarif