-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
1079 lines (966 loc) · 34.2 KB
/
Copy pathindex.html
File metadata and controls
1079 lines (966 loc) · 34.2 KB
1
2
3
4
5
6
7
8
9
10
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
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>DiffLint — Lint your git diff before you push</title>
<meta name="description" content="Paste a git diff and instantly catch merge conflict markers, hardcoded secrets, debug statements, and TODO comments. Free, browser-side.">
<meta name="keywords" content="git diff checker, diff linter, check git diff, find console.log in diff, git patch linter, diff secret checker, pre-push diff check">
<meta property="og:title" content="DiffLint — Lint your git diff before you push">
<meta property="og:description" content="Paste a git diff and instantly catch merge conflict markers, hardcoded secrets, debug statements, and TODO comments. Free, browser-side, no signup.">
<meta property="og:type" content="website">
<meta property="og:url" content="https://difflint.radicchio.page">
<meta property="og:image" content="https://difflint.radicchio.page/og.png">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="DiffLint — Lint your git diff before you push">
<meta name="twitter:description" content="Paste a git diff and instantly catch merge conflict markers, hardcoded secrets, debug statements, and TODO comments.">
<meta name="twitter:image" content="https://difflint.radicchio.page/og.png">
<link rel="canonical" href="https://difflint.radicchio.page">
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-Q4XHRW8CJ9"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-Q4XHRW8CJ9');
</script>
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "WebApplication",
"name": "DiffLint",
"url": "https://difflint.radicchio.page",
"description": "Browser-side git diff linter. Paste a unified diff and instantly catch merge conflict markers, hardcoded secrets, debug statements, and TODO comments.",
"applicationCategory": "DeveloperApplication",
"operatingSystem": "Any",
"offers": {
"@type": "Offer",
"price": "0",
"priceCurrency": "USD"
},
"featureList": [
"Merge conflict marker detection",
"Hardcoded secret scanning",
"Debug statement detection (console.log, debugger, binding.pry)",
"TODO and FIXME comment detection",
"AWS access key detection",
"Private key detection",
"Runs entirely in browser — no server, no signup"
]
}
</script>
<style>
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
--bg: #111;
--surface: #1a1a1a;
--border: #2a2a2a;
--text: #e0d8c8;
--muted: #6b6459;
--accent: #c8a84e;
--error: #e05c5c;
--warning: #d4924a;
--info: #5c8de0;
--success: #5aab6e;
--font: 'SF Mono', 'Cascadia Code', 'Fira Code', 'JetBrains Mono', 'Consolas', monospace;
}
html, body { height: 100%; }
body {
background: var(--bg);
color: var(--text);
font-family: var(--font);
font-size: 14px;
line-height: 1.6;
display: flex;
flex-direction: column;
min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
/* Header */
header {
border-bottom: 1px solid var(--border);
padding: 18px 24px;
display: flex;
align-items: center;
gap: 16px;
flex-wrap: wrap;
}
.logo {
font-size: 18px;
font-weight: 700;
color: var(--text);
letter-spacing: -0.02em;
}
.logo span {
color: var(--accent);
}
.tagline {
color: var(--muted);
font-size: 13px;
}
.badge {
margin-left: auto;
font-size: 11px;
color: var(--muted);
border: 1px solid var(--border);
padding: 3px 8px;
border-radius: 3px;
}
/* Main layout */
main {
flex: 1;
display: flex;
flex-direction: column;
}
.workspace {
display: grid;
grid-template-columns: 1fr 1fr;
flex: 1;
min-height: 0;
}
/* Input pane */
.input-pane {
border-right: 1px solid var(--border);
display: flex;
flex-direction: column;
}
.pane-header {
padding: 10px 16px;
border-bottom: 1px solid var(--border);
display: flex;
align-items: center;
justify-content: space-between;
background: var(--surface);
}
.pane-title {
font-size: 11px;
text-transform: uppercase;
letter-spacing: 0.08em;
color: var(--muted);
}
.pane-actions {
display: flex;
gap: 8px;
align-items: center;
}
.btn {
font-family: var(--font);
font-size: 12px;
padding: 5px 12px;
border-radius: 3px;
border: 1px solid var(--border);
cursor: pointer;
transition: all 0.1s;
background: transparent;
color: var(--muted);
}
.btn:hover {
color: var(--text);
border-color: var(--muted);
}
.btn-primary {
background: var(--accent);
border-color: var(--accent);
color: #111;
font-weight: 600;
}
.btn-primary:hover {
background: #d4b45a;
border-color: #d4b45a;
color: #111;
}
#diff-input {
flex: 1;
background: var(--bg);
color: var(--text);
border: none;
outline: none;
resize: none;
padding: 16px;
font-family: var(--font);
font-size: 13px;
line-height: 1.7;
tab-size: 2;
min-height: 400px;
}
#diff-input::placeholder {
color: var(--muted);
}
/* Results pane */
.results-pane {
display: flex;
flex-direction: column;
background: var(--bg);
}
.results-summary {
padding: 10px 16px;
border-bottom: 1px solid var(--border);
background: var(--surface);
display: flex;
align-items: center;
gap: 12px;
flex-wrap: wrap;
}
.summary-count {
font-size: 11px;
display: flex;
align-items: center;
gap: 5px;
}
.count-dot {
width: 8px;
height: 8px;
border-radius: 50%;
display: inline-block;
}
.dot-error { background: var(--error); }
.dot-warning { background: var(--warning); }
.dot-info { background: var(--info); }
#results-list {
flex: 1;
overflow-y: auto;
padding: 0;
}
.results-empty {
padding: 40px 24px;
color: var(--muted);
text-align: center;
font-size: 13px;
line-height: 2;
}
.results-empty .emoji {
font-size: 28px;
display: block;
margin-bottom: 8px;
}
.results-clean {
padding: 40px 24px;
text-align: center;
}
.results-clean .icon {
font-size: 32px;
display: block;
margin-bottom: 12px;
}
.results-clean .clean-title {
color: var(--success);
font-size: 15px;
font-weight: 600;
margin-bottom: 6px;
}
.results-clean .clean-sub {
color: var(--muted);
font-size: 12px;
}
.finding {
border-bottom: 1px solid var(--border);
padding: 12px 16px;
transition: background 0.1s;
}
.finding:hover {
background: var(--surface);
}
.finding-header {
display: flex;
align-items: center;
gap: 8px;
margin-bottom: 6px;
}
.severity-badge {
font-size: 10px;
text-transform: uppercase;
letter-spacing: 0.06em;
padding: 2px 6px;
border-radius: 2px;
font-weight: 700;
}
.severity-error {
background: rgba(224, 92, 92, 0.15);
color: var(--error);
border: 1px solid rgba(224, 92, 92, 0.3);
}
.severity-warning {
background: rgba(212, 146, 74, 0.15);
color: var(--warning);
border: 1px solid rgba(212, 146, 74, 0.3);
}
.severity-info {
background: rgba(92, 141, 224, 0.15);
color: var(--info);
border: 1px solid rgba(92, 141, 224, 0.3);
}
.finding-label {
font-size: 13px;
font-weight: 600;
color: var(--text);
}
.finding-location {
font-size: 11px;
color: var(--muted);
margin-left: auto;
}
.finding-detail {
font-size: 12px;
color: var(--muted);
margin-bottom: 6px;
}
.finding-snippet {
font-size: 12px;
background: var(--surface);
border: 1px solid var(--border);
border-radius: 3px;
padding: 6px 10px;
overflow-x: auto;
white-space: pre;
color: #e05c5c;
border-left: 3px solid var(--error);
}
.finding-snippet.warning {
color: var(--warning);
border-left-color: var(--warning);
}
.finding-snippet.info {
color: var(--info);
border-left-color: var(--info);
}
/* Stats bar */
.stats-bar {
padding: 8px 16px;
border-top: 1px solid var(--border);
background: var(--surface);
font-size: 11px;
color: var(--muted);
display: flex;
gap: 16px;
}
/* Description section */
.description {
border-top: 1px solid var(--border);
padding: 40px 24px;
max-width: 800px;
margin: 0 auto;
width: 100%;
}
.description h1 {
font-size: 20px;
color: var(--text);
margin-bottom: 12px;
font-weight: 700;
}
.description p {
color: var(--muted);
margin-bottom: 16px;
line-height: 1.8;
font-size: 13px;
}
.description h2 {
font-size: 15px;
color: var(--text);
margin-top: 28px;
margin-bottom: 10px;
}
.rules-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
gap: 12px;
margin-bottom: 24px;
}
.rule-card {
background: var(--surface);
border: 1px solid var(--border);
border-radius: 4px;
padding: 12px 14px;
}
.rule-card-header {
display: flex;
align-items: center;
gap: 8px;
margin-bottom: 4px;
}
.rule-card-name {
font-size: 12px;
font-weight: 600;
color: var(--text);
}
.rule-card-detail {
font-size: 11px;
color: var(--muted);
}
/* FAQ */
.faq { margin-top: 8px; }
.faq-item {
border-top: 1px solid var(--border);
padding: 16px 0;
}
.faq-q {
font-size: 13px;
font-weight: 600;
color: var(--text);
margin-bottom: 8px;
}
.faq-a {
font-size: 13px;
color: var(--muted);
line-height: 1.7;
}
code {
background: var(--surface);
border: 1px solid var(--border);
padding: 1px 5px;
border-radius: 3px;
font-family: var(--font);
font-size: 12px;
}
/* Sibling tools */
.sibling-tools {
display: flex;
flex-wrap: wrap;
gap: 10px;
margin-top: 8px;
}
.tool-link {
font-size: 12px;
background: var(--surface);
border: 1px solid var(--border);
padding: 6px 12px;
border-radius: 3px;
color: var(--muted);
transition: all 0.1s;
}
.tool-link:hover {
color: var(--text);
border-color: var(--muted);
text-decoration: none;
}
/* Footer */
footer {
border-top: 1px solid var(--border);
padding: 16px 24px;
font-size: 11px;
color: var(--muted);
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
gap: 8px;
}
footer a { color: var(--muted); }
footer a:hover { color: var(--text); text-decoration: none; }
/* Mobile */
@media (max-width: 720px) {
.workspace {
grid-template-columns: 1fr;
}
.input-pane {
border-right: none;
border-bottom: 1px solid var(--border);
}
#diff-input {
min-height: 250px;
}
}
</style>
</head>
<body>
<header>
<div class="logo">diff<span>lint</span></div>
<div class="tagline">lint your git diff before you push</div>
<div class="badge">browser-side · no signup</div>
</header>
<main>
<div class="workspace">
<!-- Input pane -->
<div class="input-pane">
<div class="pane-header">
<span class="pane-title">Paste diff</span>
<div class="pane-actions">
<button class="btn" id="load-sample-btn">load sample</button>
<button class="btn" id="clear-btn">clear</button>
<button class="btn btn-primary" id="lint-btn">Lint It ↵</button>
</div>
</div>
<textarea
id="diff-input"
placeholder="Paste the output of `git diff` or `git diff --staged` here...
Example:
diff --git a/src/app.js b/src/app.js
--- a/src/app.js
+++ b/src/app.js
@@ -10,6 +10,7 @@
function fetchData() {
+ console.log('fetching data');
return fetch('/api/data');
}"
spellcheck="false"
autocomplete="off"
></textarea>
</div>
<!-- Results pane -->
<div class="results-pane">
<div class="pane-header results-summary" id="summary-bar">
<span class="pane-title">Findings</span>
<div id="summary-counts" style="display:flex;gap:12px"></div>
</div>
<div id="results-list">
<div class="results-empty">
<span class="emoji">🔍</span>
Paste a <code>git diff</code> and click <strong>Lint It</strong><br>
to scan for issues before you push.
</div>
</div>
<div class="stats-bar" id="stats-bar" style="display:none">
<span id="stat-files">— files</span>
<span id="stat-additions">— additions</span>
<span id="stat-findings">— findings</span>
</div>
</div>
</div>
<!-- Description + FAQ -->
<div class="description">
<h1>Git diff linter — catch issues before code review</h1>
<p>
DiffLint scans your unified diff for the mistakes that slip past a visual scan: debug statements you forgot to remove,
merge conflict markers that will break your build, hardcoded credentials that shouldn't leave your machine,
and TODO comments that shouldn't go out in a PR. Paste the output of <code>git diff</code> or <code>git diff --staged</code>
and get a categorized report in under a second. Everything runs in your browser — your code never leaves your machine.
</p>
<p>
DiffLint is especially useful as a habit before opening a pull request, pushing to a shared branch, or reviewing
your own changes one last time. It complements your linter and CI pipeline by catching the human-layer mistakes
those tools miss: the <code>console.log</code> added for a debugging session, the <code>binding.pry</code>
that snuck into a Ruby controller, the API key that got pasted directly into a config file.
</p>
<h2>What DiffLint checks</h2>
<div class="rules-grid">
<div class="rule-card">
<div class="rule-card-header">
<span class="severity-badge severity-error">error</span>
<span class="rule-card-name">Merge conflict markers</span>
</div>
<div class="rule-card-detail"><code><<<<<<<</code>, <code>=======</code>, <code>>>>>>>></code> — breaks the build</div>
</div>
<div class="rule-card">
<div class="rule-card-header">
<span class="severity-badge severity-error">error</span>
<span class="rule-card-name">Hardcoded secrets</span>
</div>
<div class="rule-card-detail">Passwords, API keys, tokens assigned to literals</div>
</div>
<div class="rule-card">
<div class="rule-card-header">
<span class="severity-badge severity-error">error</span>
<span class="rule-card-name">AWS access keys</span>
</div>
<div class="rule-card-detail"><code>AKIA...</code> pattern — rotate immediately if found</div>
</div>
<div class="rule-card">
<div class="rule-card-header">
<span class="severity-badge severity-error">error</span>
<span class="rule-card-name">Private key material</span>
</div>
<div class="rule-card-detail"><code>-----BEGIN PRIVATE KEY-----</code> and variants</div>
</div>
<div class="rule-card">
<div class="rule-card-header">
<span class="severity-badge severity-error">error</span>
<span class="rule-card-name">DO NOT COMMIT marker</span>
</div>
<div class="rule-card-detail">Explicit markers added to prevent this exact situation</div>
</div>
<div class="rule-card">
<div class="rule-card-header">
<span class="severity-badge severity-warning">warning</span>
<span class="rule-card-name">Debug statements</span>
</div>
<div class="rule-card-detail"><code>console.log</code>, <code>debugger</code>, <code>binding.pry</code>, <code>var_dump</code>, <code>dd(</code></div>
</div>
<div class="rule-card">
<div class="rule-card-header">
<span class="severity-badge severity-warning">warning</span>
<span class="rule-card-name">TODO / FIXME comments</span>
</div>
<div class="rule-card-detail">TODO, FIXME, HACK, XXX, NOCOMMIT in added lines</div>
</div>
<div class="rule-card">
<div class="rule-card-header">
<span class="severity-badge severity-info">info</span>
<span class="rule-card-name">Focused test skips</span>
</div>
<div class="rule-card-detail"><code>fdescribe</code>, <code>fit(</code>, <code>xit(</code>, <code>xdescribe</code> — tests focused or skipped</div>
</div>
</div>
<h2>How to use</h2>
<p>
Run <code>git diff</code> (for unstaged changes), <code>git diff --staged</code> (for staged changes),
or <code>git show HEAD</code> (to check your last commit) in your terminal.
Copy the output and paste it into DiffLint. Click <strong>Lint It</strong> or press <kbd>Ctrl+Enter</kbd>.
</p>
<p>
DiffLint understands unified diff format — the standard format used by git, GitHub, GitLab, and Bitbucket.
It works with output from <code>git diff</code>, <code>git stash show -p</code>, <code>git show</code>,
and <code>.patch</code> files. Multi-file diffs are fully supported.
</p>
<h2>Frequently asked questions</h2>
<div class="faq">
<div class="faq-item">
<h3 class="faq-q">Does my code leave my browser?</h3>
<div class="faq-a">
No. DiffLint runs entirely in your browser using JavaScript. Your diff is parsed and scanned locally
using regular expressions — nothing is sent to any server. This makes it safe to use with
proprietary code, sensitive diffs, or diffs that might contain the very secrets you're scanning for.
</div>
</div>
<div class="faq-item">
<h3 class="faq-q">What diff format does DiffLint support?</h3>
<div class="faq-a">
DiffLint parses unified diff format — the output of <code>git diff</code>, <code>git show</code>,
<code>git diff --staged</code>, <code>git stash show -p</code>, and <code>.patch</code> files.
It correctly handles multi-file diffs and tracks which file each finding belongs to.
</div>
</div>
<div class="faq-item">
<h3 class="faq-q">Why does DiffLint only scan added lines?</h3>
<div class="faq-a">
DiffLint focuses on lines you're <em>adding</em> to the codebase (lines starting with <code>+</code>
in the diff). Checking deleted lines for issues would create noise — you want to know what's going
<em>in</em>, not what's leaving. Lines without a <code>+</code> prefix are context lines from the
diff and are ignored.
</div>
</div>
<div class="faq-item">
<h3 class="faq-q">Can I use DiffLint in my terminal or CI pipeline?</h3>
<div class="faq-a">
The browser tool is free and designed for manual use. A CI integration is planned — a webhook that
scans pull requests automatically and posts a comment with findings. For now, DiffLint works best as
a pre-push habit alongside <code>git diff --staged</code>.
</div>
</div>
<div class="faq-item">
<h3 class="faq-q">DiffLint flagged something that's intentional. What do I do?</h3>
<div class="faq-a">
Warnings and info findings are advisory — you're the one who decides what belongs in the commit.
If you're intentionally leaving a TODO comment or a test-skip marker, that's your call. DiffLint
just surfaces it so the decision is conscious, not accidental.
</div>
</div>
</div>
<h2>More free developer tools</h2>
<p>From the same linting cluster:</p>
<div class="sibling-tools">
<a class="tool-link" href="https://envlint.com">EnvLint — validate .env files</a>
<a class="tool-link" href="https://feedlint.radicchio.page">FeedLint — validate RSS/Atom feeds</a>
<a class="tool-link" href="https://cronfig.radicchio.page">Cronfig — test cron expressions</a>
<a class="tool-link" href="https://linkscrub.radicchio.page">LinkScrub — strip tracking params from URLs</a>
<a class="tool-link" href="https://qrnch.radicchio.page">qrnch — QR code generator</a>
<a class="tool-link" href="https://hashchop.radicchio.page">hashchop — SHA-256/SHA-512 hash generator</a>
<a class="tool-link" href="https://jwtchop.radicchio.page">jwtchop — JWT decoder</a>
<a class="tool-link" href="https://epochop.radicchio.page">epochop — Unix timestamp</a>
<a class="tool-link" href="https://b64chop.radicchio.page">b64chop — Base64 encoder</a>
<a class="tool-link" href="https://csvchop.radicchio.page">csvchop — CSV to JSON</a>
<a class="tool-link" href="https://uuidchop.radicchio.page">uuidchop — UUID generator</a>
<a class="tool-link" href="https://radish.radicchio.page">radish — stack trace analyzer</a>
<a class="tool-link" href="https://pxicons.com">pxicons — pixel favicon editor</a>
<a class="tool-link" href="https://yamlchop.radicchio.page">yamlchop — YAML validator</a>
<a class="tool-link" href="https://sqlchop.radicchio.page">sqlchop — SQL formatter</a>
<a class="tool-link" href="https://www.freetakuzu.com">freetakuzu — Takuzu puzzle</a>
<a class="tool-link" href="https://ruedoku.com">ruedoku — Sudoku</a>
<a class="tool-link" href="https://freekakuro.com">freekakuro — Kakuro puzzle</a>
<a class="tool-link" href="https://freenonograms.com">freenonograms — Nonogram puzzle</a>
<a class="tool-link" href="https://freereversi.com">freereversi — Reversi game</a>
<a class="tool-link" href="https://siliconbench.radicchio.page">SiliconBench — Apple Silicon LLM benchmarks</a>
<a class="tool-link" href="https://disco.radicchio.page">Disco — opportunity discovery engine</a>
<a class="tool-link" href="https://niacin.io">Niacin — niacin research directory</a>
<a class="tool-link" href="https://aidatacenterindex.com">AI Data Center Index — AI infrastructure map</a>
<a class="tool-link" href="https://bankofpapa.com">Bank of Papa — family savings app</a>
</div>
</div>
</main>
<footer>
<span>DiffLint — free, browser-side git diff linter</span>
<span>
<a href="https://bitterdesk.com/s/difflint/">support</a> ·
<a href="https://bitterdesk.com/privacy">privacy</a> ·
built with <a href="https://bitter.sh">Bitter</a>
</span>
</footer>
<script>
(function() {
'use strict';
// --- Lint rules ---
const RULES = [
{
id: 'conflict_marker',
severity: 'error',
label: 'Merge conflict marker',
test: (line) => /^\+(<{7}|={7}|>{7})/.test(line),
detail: () => 'Merge conflict marker — this will break the build'
},
{
id: 'private_key',
severity: 'error',
label: 'Private key material',
test: (line) => /\+.*-----BEGIN (RSA |EC |DSA |OPENSSH |PGP )?PRIVATE KEY/.test(line),
detail: () => 'Private key detected — remove and rotate the key immediately'
},
{
id: 'aws_key',
severity: 'error',
label: 'AWS access key',
test: (line) => /\+.*\bAKIA[A-Z0-9]{16}\b/.test(line),
detail: () => 'AWS access key pattern detected — rotate immediately'
},
{
id: 'hardcoded_secret',
severity: 'error',
label: 'Hardcoded credential',
test: (line) => {
const content = line.slice(1);
if (!/(?:password|passwd|secret|api_key|apikey|private_key|auth_token|access_token|client_secret)\s*[=:]\s*["'][^"']{4,}["']/i.test(content)) return false;
if (/(?:placeholder|example|changeme|your[-_]|xxx|todo|fake|test|mock|dummy|sample|template)/i.test(content)) return false;
return true;
},
detail: () => 'Hardcoded credential value — use environment variables instead'
},
{
id: 'nocommit',
severity: 'error',
label: 'DO NOT COMMIT marker',
test: (line) => /^\+.*\bDO[_\s]?NOT[_\s]?COMMIT\b/i.test(line),
detail: () => 'Explicit DO NOT COMMIT marker found in added lines'
},
{
id: 'console_log',
severity: 'warning',
label: 'Debug statement',
test: (line) => /^\+(?!\s*\/\/).*\b(console\.(log|error|warn|debug|info|trace|dir|table|group|time)\s*\()/.test(line) ||
/^\+(?!\s*\/\/).*\bdebugger\b/.test(line),
detail: (line) => {
const m = line.match(/\b(console\.\w+|debugger)/);
return `${m ? m[1] : 'Debug statement'} — remove before merging`;
}
},
{
id: 'lang_debug',
severity: 'warning',
label: 'Language debug tool',
test: (line) => /^\+.*\b(binding\.pry|binding\.irb|byebug|pry\.start|require\s+['"]pry['"]|var_dump\s*\(|dd\s*\(|dump\s*\(|ray\s*\(|xdebug_break\s*\(|raise\s+["']debug|print_r\s*\()\b/.test(line),
detail: () => 'Language-specific debug tool — remove before merging'
},
{
id: 'todo',
severity: 'warning',
label: 'TODO comment',
test: (line) => /^\+.*\b(TODO|FIXME|HACK|XXX|TEMP|NOCOMMIT)\b/.test(line),
detail: (line) => {
const m = line.match(/\b(TODO|FIXME|HACK|XXX|TEMP|NOCOMMIT)\b/);
return `${m ? m[1] : 'TODO'} comment in added lines — intended to commit this?`;
}
},
{
id: 'focused_test',
severity: 'info',
label: 'Focused or skipped test',
test: (line) => /^\+.*\b(fdescribe|fcontext|fit\s*\(|ftest\s*\(|xit\s*\(|xdescribe\s*\(|xcontext\s*\(|xtest\s*\(|test\.only\s*\(|describe\.only\s*\(|it\.only\s*\(|it\.skip\s*\(|test\.skip\s*\()\b/.test(line),
detail: () => 'Focused or skipped test — other tests may not run in CI'
}
];
// --- Diff parser ---
function parseDiff(text) {
const lines = text.split('\n');
const findings = [];
let currentFile = null;
let newLineNum = 0;
let additionCount = 0;
const files = new Set();
for (let i = 0; i < lines.length; i++) {
const raw = lines[i];
// File header
if (raw.startsWith('+++ ')) {
const m = raw.match(/^\+\+\+ [ab]\/(.*)/);
currentFile = m ? m[1] : raw.slice(4);
if (currentFile !== '/dev/null') files.add(currentFile);
continue;
}
// Hunk header
if (raw.startsWith('@@ ')) {
const m = raw.match(/@@ -\d+(?:,\d+)? \+(\d+)/);
if (m) newLineNum = parseInt(m[1], 10) - 1;
continue;
}
// Skip meta lines
if (raw.startsWith('diff ') || raw.startsWith('--- ') ||
raw.startsWith('index ') || raw.startsWith('old mode') ||
raw.startsWith('new mode') || raw.startsWith('new file') ||
raw.startsWith('deleted file') || raw.startsWith('Binary')) {
continue;
}
// Context line
if (!raw.startsWith('+') && !raw.startsWith('-')) {
if (raw !== '\\ No newline at end of file') newLineNum++;
continue;
}
// Deleted line
if (raw.startsWith('-') && !raw.startsWith('---')) {
continue;
}
// Added line
if (raw.startsWith('+') && !raw.startsWith('+++')) {
newLineNum++;
additionCount++;
for (const rule of RULES) {
if (rule.test(raw)) {
findings.push({
severity: rule.severity,
label: rule.label,
detail: rule.detail(raw),
file: currentFile || '(unknown)',
lineNum: newLineNum,
snippet: raw
});
}
}
}
}
return { findings, files: Array.from(files), additionCount };
}
// --- Render ---
function severityOrder(s) {
return s === 'error' ? 0 : s === 'warning' ? 1 : 2;
}
function escapeHtml(str) {
return str
.replace(/&/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(/"/g, '"');
}
function renderResults(parsed) {
const list = document.getElementById('results-list');
const statsBar = document.getElementById('stats-bar');
const summaryBar = document.getElementById('summary-counts');
const statFiles = document.getElementById('stat-files');
const statAdditions = document.getElementById('stat-additions');
const statFindings = document.getElementById('stat-findings');
const { findings, files, additionCount } = parsed;
// Stats
statsBar.style.display = 'flex';
statFiles.textContent = `${files.length} file${files.length !== 1 ? 's' : ''}`;
statAdditions.textContent = `${additionCount} addition${additionCount !== 1 ? 's' : ''}`;
statFindings.textContent = `${findings.length} finding${findings.length !== 1 ? 's' : ''}`;
// Summary counts
const errors = findings.filter(f => f.severity === 'error').length;
const warnings = findings.filter(f => f.severity === 'warning').length;
const infos = findings.filter(f => f.severity === 'info').length;
summaryBar.innerHTML = '';
if (errors > 0) summaryBar.innerHTML += `<span class="summary-count"><span class="count-dot dot-error"></span>${errors} error${errors !== 1 ? 's' : ''}</span>`;
if (warnings > 0) summaryBar.innerHTML += `<span class="summary-count"><span class="count-dot dot-warning"></span>${warnings} warning${warnings !== 1 ? 's' : ''}</span>`;
if (infos > 0) summaryBar.innerHTML += `<span class="summary-count"><span class="count-dot dot-info"></span>${infos} info</span>`;
if (findings.length === 0) summaryBar.innerHTML = `<span class="summary-count" style="color:var(--success)">✓ clean</span>`;
if (findings.length === 0) {
list.innerHTML = `
<div class="results-clean">
<span class="icon">✓</span>
<div class="clean-title">No issues found</div>
<div class="clean-sub">
Checked ${additionCount} addition${additionCount !== 1 ? 's' : ''} across ${files.length} file${files.length !== 1 ? 's' : ''}.
<br>No debug code, secrets, or conflict markers detected.
</div>
</div>
`;
return;
}
// Sort: errors first, then warnings, then info
const sorted = [...findings].sort((a, b) => severityOrder(a.severity) - severityOrder(b.severity));
list.innerHTML = sorted.map(f => `
<div class="finding">
<div class="finding-header">
<span class="severity-badge severity-${f.severity}">${f.severity}</span>
<span class="finding-label">${escapeHtml(f.label)}</span>
<span class="finding-location">${escapeHtml(f.file)}:${f.lineNum}</span>
</div>
<div class="finding-detail">${escapeHtml(f.detail)}</div>
<div class="finding-snippet ${f.severity}">${escapeHtml(f.snippet.length > 120 ? f.snippet.slice(0, 120) + '…' : f.snippet)}</div>
</div>
`).join('');
}
// --- Sample diff ---
const SAMPLE_DIFF = `diff --git a/src/api/users.js b/src/api/users.js
index 4a2f1b3..8c9d0e2 100644
--- a/src/api/users.js
+++ b/src/api/users.js
@@ -8,12 +8,15 @@ const express = require('express');
router.get('/users/:id', async (req, res) => {
+ console.log('fetching user', req.params.id);
const user = await db.users.find(req.params.id);