Skip to content

Commit 20c4f76

Browse files
committed
Fix code style issues: remove trailing whitespace and unused imports
- Remove trailing whitespace from harmonizer/visualizer.py (37 lines) - Remove unused imports from check_harmony.py (PythonCodeHarmonizer, ConfigLoader) - Fix unnecessary f-string in check_harmony.py All tests pass (110/110). No functional changes.
1 parent 1b5ad64 commit 20c4f76

File tree

2 files changed

+38
-40
lines changed

2 files changed

+38
-40
lines changed

check_harmony.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77
import sys
88
import os
99
import argparse
10-
from harmonizer.main import PythonCodeHarmonizer
1110
from harmonizer.legacy_mapper import LegacyCodeMapper
12-
from harmonizer.config import ConfigLoader
1311

1412

1513
def check_harmony(
@@ -30,7 +28,7 @@ def check_harmony(
3028
warnings = []
3129

3230
config = mapper.config
33-
print(f"\n--- CONFIGURATION ---")
31+
print("\n--- CONFIGURATION ---")
3432
print(f"Max Disharmony: {config.max_disharmony}")
3533
print(f"Max Imbalance: {config.max_imbalance}")
3634
print(f"Min Density: {config.min_density}")

harmonizer/visualizer.py

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -103,78 +103,78 @@ def _get_html_template(self, data: Dict) -> str:
103103
--power: #ef4444;
104104
--wisdom: #3b82f6;
105105
}}
106-
106+
107107
body {{
108108
font-family: 'Inter', system-ui, sans-serif;
109109
background-color: var(--bg-color);
110110
color: var(--text-primary);
111111
margin: 0;
112112
padding: 20px;
113113
}}
114-
114+
115115
.container {{
116116
max_width: 1400px;
117117
margin: 0 auto;
118118
}}
119-
119+
120120
header {{
121121
margin-bottom: 30px;
122122
border-bottom: 1px solid #334155;
123123
padding-bottom: 20px;
124124
}}
125-
125+
126126
h1 {{ margin: 0; font-size: 2rem; }}
127127
.subtitle {{ color: var(--text-secondary); margin-top: 5px; }}
128-
128+
129129
.grid {{
130130
display: grid;
131131
grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
132132
gap: 20px;
133133
margin-bottom: 30px;
134134
}}
135-
135+
136136
.card {{
137137
background-color: var(--card-bg);
138138
border-radius: 12px;
139139
padding: 20px;
140140
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
141141
}}
142-
142+
143143
.card h2 {{ margin-top: 0; font-size: 1.2rem; color: var(--accent); }}
144-
144+
145145
#galaxy-graph {{
146146
width: 100%;
147147
height: 600px;
148148
background-color: #020617;
149149
border-radius: 8px;
150150
}}
151-
151+
152152
table {{
153153
width: 100%;
154154
border-collapse: collapse;
155155
margin-top: 10px;
156156
}}
157-
157+
158158
th, td {{
159159
text-align: left;
160160
padding: 12px;
161161
border-bottom: 1px solid #334155;
162162
}}
163-
163+
164164
th {{ color: var(--text-secondary); font-weight: 600; }}
165-
165+
166166
.badge {{
167167
padding: 4px 8px;
168168
border-radius: 4px;
169169
font-size: 0.8rem;
170170
font-weight: bold;
171171
}}
172-
172+
173173
.badge-love {{ background: rgba(244, 114, 182, 0.2); color: var(--love); }}
174174
.badge-justice {{ background: rgba(251, 191, 36, 0.2); color: var(--justice); }}
175175
.badge-power {{ background: rgba(239, 68, 68, 0.2); color: var(--power); }}
176176
.badge-wisdom {{ background: rgba(59, 130, 246, 0.2); color: var(--wisdom); }}
177-
177+
178178
</style>
179179
</head>
180180
<body>
@@ -183,7 +183,7 @@ def _get_html_template(self, data: Dict) -> str:
183183
<h1>LJPW Code Harmony Report</h1>
184184
<div class="subtitle">Generated on {datetime.now().strftime("%Y-%m-%d %H:%M")}</div>
185185
</header>
186-
186+
187187
<div class="grid">
188188
<div class="card">
189189
<h2>System Balance (Average)</h2>
@@ -194,16 +194,16 @@ def _get_html_template(self, data: Dict) -> str:
194194
<canvas id="scatterChart"></canvas>
195195
</div>
196196
</div>
197-
197+
198198
<div class="card" style="margin-bottom: 30px;">
199199
<h2>Dependency Galaxy (Gravitational Pull)</h2>
200200
<div id="galaxy-graph"></div>
201201
<p style="color: var(--text-secondary); font-size: 0.9rem; margin-top: 10px;">
202-
Nodes are sized by Mass (Complexity). Links show imports.
202+
Nodes are sized by Mass (Complexity). Links show imports.
203203
Colors represent dominant LJPW dimension.
204204
</p>
205205
</div>
206-
206+
207207
<div class="card">
208208
<h2>File Analysis</h2>
209209
<div style="overflow-x: auto;">
@@ -228,13 +228,13 @@ def _get_html_template(self, data: Dict) -> str:
228228
229229
<script>
230230
const data = {json_data};
231-
231+
232232
// --- 1. Radar Chart ---
233233
const avgL = data.files.reduce((sum, f) => sum + f.l, 0) / data.files.length;
234234
const avgJ = data.files.reduce((sum, f) => sum + f.j, 0) / data.files.length;
235235
const avgP = data.files.reduce((sum, f) => sum + f.p, 0) / data.files.length;
236236
const avgW = data.files.reduce((sum, f) => sum + f.w, 0) / data.files.length;
237-
237+
238238
new Chart(document.getElementById('radarChart'), {{
239239
type: 'radar',
240240
data: {{
@@ -267,7 +267,7 @@ def _get_html_template(self, data: Dict) -> str:
267267
plugins: {{ legend: {{ labels: {{ color: '#cbd5e1' }} }} }}
268268
}}
269269
}});
270-
270+
271271
// --- 2. Scatter Chart (Density vs Complexity) ---
272272
new Chart(document.getElementById('scatterChart'), {{
273273
type: 'scatter',
@@ -286,12 +286,12 @@ def _get_html_template(self, data: Dict) -> str:
286286
}},
287287
options: {{
288288
scales: {{
289-
x: {{
289+
x: {{
290290
title: {{ display: true, text: 'Complexity (Function Count)', color: '#94a3b8' }},
291291
grid: {{ color: '#334155' }},
292292
ticks: {{ color: '#94a3b8' }}
293293
}},
294-
y: {{
294+
y: {{
295295
title: {{ display: true, text: 'Semantic Density (Power/LOC)', color: '#94a3b8' }},
296296
grid: {{ color: '#334155' }},
297297
ticks: {{ color: '#94a3b8' }}
@@ -307,27 +307,27 @@ def _get_html_template(self, data: Dict) -> str:
307307
}}
308308
}}
309309
}});
310-
310+
311311
// --- 3. D3 Force Graph ---
312312
const width = document.getElementById('galaxy-graph').clientWidth;
313313
const height = 600;
314-
314+
315315
const svg = d3.select("#galaxy-graph").append("svg")
316316
.attr("width", width)
317317
.attr("height", height);
318-
318+
319319
const simulation = d3.forceSimulation(data.graph.nodes)
320320
.force("link", d3.forceLink(data.graph.links).id(d => d.id).distance(100))
321321
.force("charge", d3.forceManyBody().strength(-300))
322322
.force("center", d3.forceCenter(width / 2, height / 2));
323-
323+
324324
const link = svg.append("g")
325325
.selectAll("line")
326326
.data(data.graph.links)
327327
.enter().append("line")
328328
.attr("stroke", "#475569")
329329
.attr("stroke-width", 1);
330-
330+
331331
const node = svg.append("g")
332332
.selectAll("circle")
333333
.data(data.graph.nodes)
@@ -348,51 +348,51 @@ def _get_html_template(self, data: Dict) -> str:
348348
.on("start", dragstarted)
349349
.on("drag", dragged)
350350
.on("end", dragended));
351-
351+
352352
node.append("title").text(d => d.id);
353-
353+
354354
simulation.on("tick", () => {{
355355
link
356356
.attr("x1", d => d.source.x)
357357
.attr("y1", d => d.source.y)
358358
.attr("x2", d => d.target.x)
359359
.attr("y2", d => d.target.y);
360-
360+
361361
node
362362
.attr("cx", d => d.x)
363363
.attr("cy", d => d.y);
364364
}});
365-
365+
366366
function dragstarted(event, d) {{
367367
if (!event.active) simulation.alphaTarget(0.3).restart();
368368
d.fx = d.x;
369369
d.fy = d.y;
370370
}}
371-
371+
372372
function dragged(event, d) {{
373373
d.fx = event.x;
374374
d.fy = event.y;
375375
}}
376-
376+
377377
function dragended(event, d) {{
378378
if (!event.active) simulation.alphaTarget(0);
379379
d.fx = null;
380380
d.fy = null;
381381
}}
382-
382+
383383
// --- 4. Populate Table ---
384384
const tbody = document.querySelector('#fileTable tbody');
385385
data.files.forEach(f => {{
386386
const tr = document.createElement('tr');
387-
387+
388388
const max = Math.max(f.l, f.j, f.p, f.w);
389389
let domClass = '';
390390
let domName = '';
391391
if (max === f.l) {{ domClass = 'badge-love'; domName = 'Love'; }}
392392
else if (max === f.j) {{ domClass = 'badge-justice'; domName = 'Justice'; }}
393393
else if (max === f.p) {{ domClass = 'badge-power'; domName = 'Power'; }}
394394
else {{ domClass = 'badge-wisdom'; domName = 'Wisdom'; }}
395-
395+
396396
tr.innerHTML = `
397397
<td>${{f.name}}</td>
398398
<td><span class="badge ${{domClass}}">${{domName}}</span></td>

0 commit comments

Comments
 (0)