From 7ed8dd86cb2b501ee68e9f26535f93c1e563eeef Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 1 Nov 2025 02:06:07 +0000 Subject: [PATCH 1/2] fix: Correct YAML syntax in harmony-check workflow with proper heredoc indentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed critical YAML syntax error in harmony-check.yml caused by incorrect heredoc indentation: **Problem:** - Python heredoc content and terminators were unindented (column 0) - This broke YAML's literal block (run: |) parsing - YAML parser failed with "could not find expected ':'" error - GitHub Actions workflows would not run **Root Cause:** In YAML literal blocks (|), all lines must maintain consistent base indentation. The heredoc pattern `python3 << 'EOF'` with unindented Python code and EOF terminator violated this requirement. **Solution:** 1. Changed `<< 'PYTHON_SCRIPT'` to `<<'PYTHON_SCRIPT'` (no space) 2. Indented all Python code to match surrounding bash code (10 spaces) 3. Indented PYTHON_SCRIPT terminators to match (10 spaces) This preserves YAML structure while bash correctly strips the indentation when processing the heredoc. **Files Fixed:** - Job 2 (harmony-json-report), Step 3: Generate JSON Harmony Report - Job 2 (harmony-json-report), Step 5: Display Top 5 Disharmonious Functions **Testing:** - ✅ YAML validates with Python yaml.safe_load() - ✅ Extracted bash script executes correctly - ✅ JSON parsing works as expected - ✅ All heredoc syntax functional This resolves the CI workflow failures reported by the user. --- .github/workflows/harmony-check.yml | 84 ++++++++++++++--------------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/.github/workflows/harmony-check.yml b/.github/workflows/harmony-check.yml index c0ca4ea..d52279c 100644 --- a/.github/workflows/harmony-check.yml +++ b/.github/workflows/harmony-check.yml @@ -82,23 +82,23 @@ jobs: if [ -f harmony-report.json ] && [ -s harmony-report.json ]; then echo "" echo "📊 Harmony Summary:" - python3 << 'PYTHON_SCRIPT' -import json -try: - with open('harmony-report.json') as f: - data = json.load(f) - summary = data.get('summary', {}) - print(f" Total files: {summary.get('total_files', 0)}") - print(f" Total functions: {summary.get('total_functions', 0)}") - print(" Severity breakdown:") - for sev, count in summary.get('severity_counts', {}).items(): - if count > 0: - emoji = {'critical': '🔴', 'high': '🟠', 'medium': '🟡', 'low': '🔵', 'excellent': '🟢'}.get(sev, '⚪') - print(f" {emoji} {sev.capitalize()}: {count}") - print(f" Highest severity: {summary.get('highest_severity', 'unknown')}") -except Exception as e: - print(f"Error parsing report: {e}") -PYTHON_SCRIPT + python3 <<'PYTHON_SCRIPT' + import json + try: + with open('harmony-report.json') as f: + data = json.load(f) + summary = data.get('summary', {}) + print(f" Total files: {summary.get('total_files', 0)}") + print(f" Total functions: {summary.get('total_functions', 0)}") + print(" Severity breakdown:") + for sev, count in summary.get('severity_counts', {}).items(): + if count > 0: + emoji = {'critical': '🔴', 'high': '🟠', 'medium': '🟡', 'low': '🔵', 'excellent': '🟢'}.get(sev, '⚪') + print(f" {emoji} {sev.capitalize()}: {count}") + print(f" Highest severity: {summary.get('highest_severity', 'unknown')}") + except Exception as e: + print(f"Error parsing report: {e}") + PYTHON_SCRIPT else echo "⚠️ No harmony report generated" fi @@ -116,31 +116,31 @@ PYTHON_SCRIPT if [ -f harmony-report.json ] && [ -s harmony-report.json ]; then echo "" echo "🎯 Top 5 Functions to Refactor:" - python3 << 'PYTHON_SCRIPT' -import json -try: - with open('harmony-report.json') as f: - data = json.load(f) - funcs = [] - for file_data in data.get('files', []): - for func in file_data.get('functions', []): - if func.get('disharmonious'): - funcs.append(( - func.get('score', 0), - func.get('name', 'unknown'), - file_data.get('file', 'unknown'), - func.get('severity', 'unknown') - )) - funcs.sort(reverse=True) - if funcs: - for i, (score, name, filepath, sev) in enumerate(funcs[:5], 1): - emoji = {'critical': '🔴', 'high': '🟠', 'medium': '🟡'}.get(sev, '⚪') - print(f" {i}. {emoji} {name} ({score:.2f}) in {filepath}") - else: - print(' 🎉 No disharmonious functions found!') -except Exception as e: - print(f"Error parsing report: {e}") -PYTHON_SCRIPT + python3 <<'PYTHON_SCRIPT' + import json + try: + with open('harmony-report.json') as f: + data = json.load(f) + funcs = [] + for file_data in data.get('files', []): + for func in file_data.get('functions', []): + if func.get('disharmonious'): + funcs.append(( + func.get('score', 0), + func.get('name', 'unknown'), + file_data.get('file', 'unknown'), + func.get('severity', 'unknown') + )) + funcs.sort(reverse=True) + if funcs: + for i, (score, name, filepath, sev) in enumerate(funcs[:5], 1): + emoji = {'critical': '🔴', 'high': '🟠', 'medium': '🟡'}.get(sev, '⚪') + print(f" {i}. {emoji} {name} ({score:.2f}) in {filepath}") + else: + print(' 🎉 No disharmonious functions found!') + except Exception as e: + print(f"Error parsing report: {e}") + PYTHON_SCRIPT fi if: success() || failure() From d5e636cc660ac6b680d03a556fcef0f95f2e0619 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 1 Nov 2025 02:07:29 +0000 Subject: [PATCH 2/2] chore: Add harmony-report.json to .gitignore The harmony-report.json file is a generated artifact from CI workflows and testing. It should not be tracked in version control. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 9c882b7..c9c1af1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ __pycache__/ *.egg-info/ +harmony-report.json