Commit 5da8232
committed
feat: Add v1.2 features - Exit codes, JSON output, and enhanced badges
Implemented three major quick wins for v1.2:
1. EXIT CODES FOR CI/CD 🚀
- Returns meaningful exit codes based on severity:
* 0 = All harmonious (excellent or low severity)
* 1 = Medium severity found (0.5-0.8)
* 2 = High severity found (0.8-1.2)
* 3 = Critical severity found (≥ 1.2)
- Enables automated quality gates in CI/CD pipelines
- Build fails automatically on high/critical disharmony
- Perfect for GitHub Actions, GitLab CI, Jenkins, etc.
2. JSON OUTPUT FORMAT 📊
- New --format json option for machine-readable output
- Structured data includes:
* Version and threshold information
* Per-file function analysis with scores
* Severity levels (excellent, low, medium, high, critical)
* Summary statistics across all files
- Enables tool integration (IDEs, dashboards, analytics)
- Quiet mode automatically enabled for JSON output
3. ENHANCED COMMAND-LINE INTERFACE
- Added argparse for professional CLI experience
- New flags:
* --format {text,json} - Choose output format
* --threshold FLOAT - Custom disharmony threshold
* --version - Show version number
* --help - Comprehensive help with examples
- Improved help text with usage examples
- Better error messages
4. ENHANCED README BADGES
- Added CI status badge (links to Actions)
- Added version badge (links to CHANGELOG)
- Added test pass rate badge (20 tests passing)
- Added harmony score badge (meta - tool analyzing itself!)
- All badges clickable with relevant links
Technical Implementation:
- get_severity() method maps scores to severity levels
- get_highest_severity_code() returns appropriate exit code
- print_json_report() generates structured JSON output
- Quiet mode suppresses text output when using JSON
- All changes backward compatible with existing usage
Documentation Updates:
- CHANGELOG.md: Added v1.2.0 release notes
- QUICK_REFERENCE.md: Added Advanced Options section with:
* JSON output examples
* Exit code reference table
* CI/CD usage examples
- README.md: Enhanced badge section
Testing:
- All 20 existing tests still pass
- Manual testing confirms:
* Exit codes work correctly (tested with examples/test_code.py → exit 3)
* JSON output is valid and well-structured
* Text output unchanged and working
* --version and --help flags work
- Black formatting applied
Breaking Changes: None
- Existing usage (harmonizer file.py) works unchanged
- Default behavior is text output, exit code 0 for harmonious code
- Fully backward compatible
This release makes Harmonizer production-ready for CI/CD integration
and enables tool ecosystem development. 💛⚓1 parent 6e73ce4 commit 5da8232
File tree
4 files changed
+328
-30
lines changed- docs
- src/harmonizer
4 files changed
+328
-30
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
12 | 60 | | |
13 | 61 | | |
14 | 62 | | |
15 | 63 | | |
16 | 64 | | |
17 | 65 | | |
18 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
19 | 80 | | |
20 | 81 | | |
21 | 82 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
5 | 7 | | |
| 8 | + | |
| 9 | + | |
6 | 10 | | |
7 | 11 | | |
8 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
36 | 93 | | |
37 | 94 | | |
38 | 95 | | |
| |||
0 commit comments