This directory contains automated workflows for Lucent code analysis and CI/CD.
Trigger: Pull requests to main, master, or develop
What it does:
- Runs full codebase analysis with Lucent
- Generates markdown and JSON reports
- Posts analysis results as PR comment
- Checks quality gate thresholds
- Uploads analysis artifacts
Quality Gates:
- ❌ Fails if average complexity > 20.0
- ❌ Fails if average nesting depth > 5.0
⚠️ Warns if comment quality < 30%
Outputs:
- PR comment with full Lucent analysis
lucent-report.md- Markdown reportlucent-metrics.json- JSON metrics- GitHub Actions job summary
Example PR Comment:
## 💎 Lucent Code Analysis Report
### 📊 Summary
| Metric | Value |
|--------|-------|
| Total Files | 10 |
| Total Lines | 310 |
| Average Complexity | 4.4 |
...Trigger: Pull requests to main, master, or develop
What it does:
- Analyzes only files changed in the PR
- Provides focused analysis on modifications
- Posts per-file metrics as PR comment
- More efficient for large codebases
Supported file extensions:
.rs, .py, .js, .ts, .go, .java, .cpp, .c, .cs, .rb, .php, .swift, .kt, .dart, .scala, .ex, .hs, .clj, .lua, .sh, .sql
Outputs:
- PR comment with diff analysis
diff-report.md- Per-file analysischanged_files.txt- List of analyzed files
Trigger: Pull requests to main, master, or develop
What it does:
- Compares PR metrics with base branch
- Calculates metric deltas and trends
- Provides quality score based on changes
- Shows improvement or regression indicators
- Tracks long-term code quality evolution
Metrics Compared:
- Files, Lines, Functions (size metrics)
- Cyclomatic Complexity (trend tracking)
- Nesting Depth (structure quality)
- Comment Quality (documentation)
Quality Score:
- 90-100: ✅ Excellent - Quality improved or maintained
- 70-89:
⚠️ Good - Minor concerns - < 70: ❌ Needs improvement - Significant issues
Trend Indicators:
- ✅ Green: Metric improved
- ➡️ Neutral: No significant change (< 0.1)
- ❌ Red: Metric regressed
Example Output:
## 📈 Lucent Trend Analysis
### 📊 Metric Changes
| Metric | Base | Current | Change | Trend |
|--------|------|---------|--------|-------|
| Avg Complexity | 10.5 | 8.2 | -2.3 (-21.9%) | ✅ |
| Avg Nesting | 3.0 | 2.5 | -0.5 (-16.7%) | ✅ |
| Comment Quality | 40% | 52% | +12% (+30.0%) | ✅ |
### Quality Score
**Score: 95/100** ✅ Excellent - Code quality improvedOutputs:
- PR comment with trend analysis
pr-metrics.json- Current branch metricsbase-metrics.json- Base branch metricstrend-report.md- Detailed comparison- 90-day artifact retention for historical tracking
Trigger:
- Push to
main,master, ordevelop - All pull requests
What it does:
- Runs on Linux, macOS, and Windows
- Checks code formatting (
cargo fmt) - Runs Clippy lints
- Executes all tests
- Builds release binary
- Self-analyzes with Lucent
- Generates code coverage
- Builds platform-specific binaries (on main branch)
Matrix:
- OS: Ubuntu, macOS, Windows
- Rust: stable
Outputs:
- Test results
- Release binaries (main branch only)
- Self-analysis JSON
- Code coverage report (Codecov)
Artifacts:
lucent-linux-x86_64.tar.gzlucent-macos-x86_64.tar.gzlucent-macos-aarch64.tar.gzlucent-windows-x86_64.exe.zip
-
Push workflows to your repository:
git add .github/workflows/ git commit -m "Add Lucent GitHub Actions workflows" git push -
Workflows are enabled automatically for your repository
-
Create a pull request to see Lucent in action!
Edit the quality gate section in lucent-pr-analysis.yml:
# Default thresholds
COMPLEXITY_THRESHOLD=20.0
NESTING_THRESHOLD=5.0
COMMENT_QUALITY_THRESHOLD=0.3Adjust these values based on your project's requirements.
- < 5.0: ✅ Simple, easy to maintain
- 5.0 - 10.0: ✅ Moderate complexity
- 10.0 - 20.0:
⚠️ Consider refactoring - > 20.0: ❌ FAILS - Urgent refactoring needed
- < 2.0: ✅ Flat, readable code
- 2.0 - 4.0: ✅ Acceptable nesting
- 4.0 - 5.0:
⚠️ Deep nesting - > 5.0: ❌ FAILS - Reduce nesting
- < 0.3:
⚠️ WARNING - Improve documentation - 0.3 - 0.5: ✅ Adequate documentation
- > 0.7: ✅ Excellent documentation
COMPLEXITY_THRESHOLD=10.0
NESTING_THRESHOLD=3.0
COMMENT_QUALITY_THRESHOLD=0.5COMPLEXITY_THRESHOLD=30.0
NESTING_THRESHOLD=6.0
COMMENT_QUALITY_THRESHOLD=0.2COMPLEXITY_THRESHOLD=15.0
NESTING_THRESHOLD=4.0
COMMENT_QUALITY_THRESHOLD=0.4The workflows require the following permissions:
permissions:
contents: read # Read repository contents
pull-requests: write # Post PR comments
issues: write # Create issue commentsThese are automatically granted by GitHub Actions.
-
Use both workflows together:
lucent-pr-analysis.ymlfor full codebase healthlucent-diff-analysis.ymlfor focused PR changes
-
Set appropriate thresholds:
- Start with relaxed thresholds
- Gradually tighten as code quality improves
-
Review analysis reports:
- Check PR comments after each push
- Address quality issues before merging
-
Track trends over time:
- Download and archive
lucent-metrics.json - Compare metrics across releases
- Download and archive
-
Integrate with branch protection:
- Require quality gates to pass before merge
- Settings → Branches → Add rule
Solution: Ensure Rust toolchain is properly cached
- uses: actions/cache@v3
with:
path: ~/.cargo/Solution: The diff workflow limits comments to 65,000 characters. For very large PRs, check the uploaded artifacts instead.
Solution: Adjust thresholds in the workflow file or use --continue-on-error:
- name: 🚦 Quality Gate Check
continue-on-error: trueSolution: Ubuntu runners have jq pre-installed. For other OS:
- name: Install jq
run: |
# macOS
brew install jq
# Windows
choco install jqTo add new workflows or improve existing ones:
- Test locally with act
- Document changes in this README
- Submit a pull request
Last Updated: 2025-11-23 Version: 0.1.0-alpha