Skip to content

Commit b3c73de

Browse files
committed
Remove File Type filter (DLL/EXE/Config/Resource/Other)
Remove the file type filter controls, getFileTypeCategory() function, __configExts__/__resourceExts__ constants, data-ext attribute from row generation, and all related tests. The diff detail and importance filters remain. Note: dotnet is unavailable in this environment; tests could not be run locally. https://claude.ai/code/session_01VHEe12W2fkQZ7xneXy8Wry
1 parent 8c0fd36 commit b3c73de

8 files changed

Lines changed: 44 additions & 193 deletions

File tree

FolderDiffIL4DotNet.Tests/Services/HtmlReportGenerateServiceTests.cs

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1678,11 +1678,6 @@ public void GenerateDiffReportHtml_ContainsFilterBar()
16781678
Assert.Contains("id=\"filter-imp-high\"", html);
16791679
Assert.Contains("id=\"filter-imp-medium\"", html);
16801680
Assert.Contains("id=\"filter-imp-low\"", html);
1681-
Assert.Contains("id=\"filter-ft-dll\"", html);
1682-
Assert.Contains("id=\"filter-ft-exe\"", html);
1683-
Assert.Contains("id=\"filter-ft-config\"", html);
1684-
Assert.Contains("id=\"filter-ft-resource\"", html);
1685-
Assert.Contains("id=\"filter-ft-other\"", html);
16861681
Assert.Contains("id=\"filter-unchecked\"", html);
16871682
Assert.Contains("id=\"filter-search\"", html);
16881683
Assert.Contains("applyFilters()", html);
@@ -1728,23 +1723,6 @@ public void GenerateDiffReportHtml_FileRowsHaveDataSectionAttribute()
17281723
Assert.Contains("data-section=\"add\"", html);
17291724
}
17301725

1731-
[Fact]
1732-
public void GenerateDiffReportHtml_FileRowsHaveDataExtAttribute()
1733-
{
1734-
// Arrange / テスト準備
1735-
var (oldDir, newDir, reportDir) = MakeDirs("data-ext");
1736-
File.WriteAllText(Path.Combine(newDir, "new.dll"), "new-content");
1737-
var config = CreateConfig();
1738-
_resultLists.AddAddedFileAbsolutePath(Path.Combine(newDir, "new.dll"));
1739-
1740-
_service.GenerateDiffReportHtml(CreateReportContext(oldDir, newDir, reportDir, config));
1741-
var html = File.ReadAllText(Path.Combine(reportDir, HtmlReportGenerateService.DIFF_REPORT_HTML_FILE_NAME));
1742-
1743-
// Assert: data-ext attribute with correct extension
1744-
// 正しい拡張子の data-ext 属性を検証
1745-
Assert.Contains("data-ext=\".dll\"", html);
1746-
}
1747-
17481726
[Fact]
17491727
public void GenerateDiffReportHtml_ModifiedRowsWithImportance_HaveDataImportanceAttribute()
17501728
{

JsTests/diff_report.test.js

Lines changed: 12 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ describe('collectState', () => {
106106
loadScript({
107107
bodyHtml: `
108108
<input type="checkbox" id="filter-imp-high" checked>
109-
<input type="checkbox" id="filter-ft-dll" checked>
110109
<input type="text" id="filter-search" value="test">
111110
<input type="checkbox" id="chk-real" checked>
112111
`,
@@ -115,7 +114,6 @@ describe('collectState', () => {
115114

116115
const state = window.collectState();
117116
expect(state).not.toHaveProperty('filter-imp-high');
118-
expect(state).not.toHaveProperty('filter-ft-dll');
119117
expect(state).not.toHaveProperty('filter-search');
120118
expect(state['chk-real']).toBe(true);
121119
});
@@ -162,57 +160,20 @@ describe('autoSave', () => {
162160
});
163161
});
164162

165-
// ─── getFileTypeCategory ─────────────────────────────────────────────────────
166-
describe('getFileTypeCategory', () => {
167-
beforeEach(() => loadScript());
168-
169-
const cases = [
170-
['.dll', 'dll'],
171-
['.DLL', 'dll'],
172-
['.exe', 'exe'],
173-
['.EXE', 'exe'],
174-
['.json', 'config'],
175-
['.xml', 'config'],
176-
['.config', 'config'],
177-
['.yaml', 'config'],
178-
['.yml', 'config'],
179-
['.csproj', 'config'],
180-
['.sln', 'config'],
181-
['.resx', 'resource'],
182-
['.png', 'resource'],
183-
['.ico', 'resource'],
184-
['.ttf', 'resource'],
185-
['.txt', 'other'],
186-
['.cs', 'other'],
187-
['', 'other'],
188-
[null, 'other'],
189-
[undefined, 'other'],
190-
];
191-
192-
test.each(cases)('getFileTypeCategory(%s) returns %s', (ext, expected) => {
193-
expect(window.getFileTypeCategory(ext)).toBe(expected);
194-
});
195-
});
196-
197163
// ─── applyFilters ────────────────────────────────────────────────────────────
198164
describe('applyFilters', () => {
199165
function loadFilterEnv(rows) {
200166
const filterBar = `
201167
<input type="checkbox" id="filter-imp-high" checked>
202168
<input type="checkbox" id="filter-imp-medium" checked>
203169
<input type="checkbox" id="filter-imp-low" checked>
204-
<input type="checkbox" id="filter-ft-dll" checked>
205-
<input type="checkbox" id="filter-ft-exe" checked>
206-
<input type="checkbox" id="filter-ft-config" checked>
207-
<input type="checkbox" id="filter-ft-resource" checked>
208-
<input type="checkbox" id="filter-ft-other" checked>
209170
<input type="checkbox" id="filter-unchecked">
210171
<input type="text" id="filter-search" value="">
211172
<span id="save-status"></span>
212173
`;
213174

214175
const tableRows = rows.map(r =>
215-
`<tr data-section="${r.section}" data-ext="${r.ext}" ${r.importance ? 'data-importance="' + r.importance + '"' : ''}>
176+
`<tr data-section="${r.section}" ${r.importance ? 'data-importance="' + r.importance + '"' : ''} ${r.diff ? 'data-diff="' + r.diff + '"' : ''}>
216177
<td><input type="checkbox" id="chk-${r.id}" ${r.checked ? 'checked' : ''}></td>
217178
<td><span class="path-text">${r.path}</span></td>
218179
</tr>`
@@ -224,26 +185,10 @@ describe('applyFilters', () => {
224185
fireDOMContentLoaded();
225186
}
226187

227-
test('hides rows by file type when filter unchecked', () => {
228-
loadFilterEnv([
229-
{ id: '1', section: 'modified', ext: '.dll', path: 'lib/a.dll' },
230-
{ id: '2', section: 'modified', ext: '.exe', path: 'bin/b.exe' },
231-
{ id: '3', section: 'modified', ext: '.json', path: 'cfg/c.json' },
232-
]);
233-
234-
document.getElementById('filter-ft-dll').checked = false;
235-
window.applyFilters();
236-
237-
const rows = document.querySelectorAll('tr[data-section]');
238-
expect(rows[0].classList.contains('filter-hidden')).toBe(true);
239-
expect(rows[1].classList.contains('filter-hidden')).toBe(false);
240-
expect(rows[2].classList.contains('filter-hidden')).toBe(false);
241-
});
242-
243188
test('hides rows by importance when filter unchecked', () => {
244189
loadFilterEnv([
245-
{ id: '1', section: 'modified', ext: '.dll', importance: 'High', path: 'a.dll' },
246-
{ id: '2', section: 'modified', ext: '.dll', importance: 'Low', path: 'b.dll' },
190+
{ id: '1', section: 'modified', importance: 'High', path: 'a.dll' },
191+
{ id: '2', section: 'modified', importance: 'Low', path: 'b.dll' },
247192
]);
248193

249194
document.getElementById('filter-imp-low').checked = false;
@@ -256,7 +201,7 @@ describe('applyFilters', () => {
256201

257202
test('importance filter does not hide rows without data-importance', () => {
258203
loadFilterEnv([
259-
{ id: '1', section: 'unchanged', ext: '.dll', path: 'unchanged.dll' },
204+
{ id: '1', section: 'unchanged', path: 'unchanged.dll' },
260205
]);
261206

262207
// Uncheck all importance filters
@@ -272,8 +217,8 @@ describe('applyFilters', () => {
272217

273218
test('filters by search text against path (case-insensitive)', () => {
274219
loadFilterEnv([
275-
{ id: '1', section: 'modified', ext: '.dll', path: 'src/MyApp.dll' },
276-
{ id: '2', section: 'modified', ext: '.dll', path: 'src/Other.dll' },
220+
{ id: '1', section: 'modified', path: 'src/MyApp.dll' },
221+
{ id: '2', section: 'modified', path: 'src/Other.dll' },
277222
]);
278223

279224
document.getElementById('filter-search').value = 'myapp';
@@ -286,8 +231,8 @@ describe('applyFilters', () => {
286231

287232
test('unchecked-only filter shows only unchecked rows', () => {
288233
loadFilterEnv([
289-
{ id: '1', section: 'modified', ext: '.dll', path: 'a.dll', checked: true },
290-
{ id: '2', section: 'modified', ext: '.dll', path: 'b.dll', checked: false },
234+
{ id: '1', section: 'modified', path: 'a.dll', checked: true },
235+
{ id: '2', section: 'modified', path: 'b.dll', checked: false },
291236
]);
292237

293238
document.getElementById('filter-unchecked').checked = true;
@@ -304,16 +249,11 @@ describe('applyFilters', () => {
304249
<input type="checkbox" id="filter-imp-high" checked>
305250
<input type="checkbox" id="filter-imp-medium" checked>
306251
<input type="checkbox" id="filter-imp-low" checked>
307-
<input type="checkbox" id="filter-ft-dll" checked>
308-
<input type="checkbox" id="filter-ft-exe" checked>
309-
<input type="checkbox" id="filter-ft-config" checked>
310-
<input type="checkbox" id="filter-ft-resource" checked>
311-
<input type="checkbox" id="filter-ft-other">
312252
<input type="checkbox" id="filter-unchecked">
313253
<input type="text" id="filter-search">
314254
<span id="save-status"></span>
315255
<table><tbody>
316-
<tr data-section="modified" data-ext=".txt"><td><span class="path-text">readme.txt</span></td></tr>
256+
<tr data-section="modified"><td><span class="path-text">readme.txt</span></td></tr>
317257
<tr class="diff-row"><td>diff content here</td></tr>
318258
</tbody></table>
319259
`,
@@ -328,9 +268,9 @@ describe('applyFilters', () => {
328268

329269
test('when all filters checked, no rows are hidden', () => {
330270
loadFilterEnv([
331-
{ id: '1', section: 'modified', ext: '.dll', importance: 'High', path: 'a.dll' },
332-
{ id: '2', section: 'modified', ext: '.exe', importance: 'Low', path: 'b.exe' },
333-
{ id: '3', section: 'unchanged', ext: '.json', path: 'c.json' },
271+
{ id: '1', section: 'modified', importance: 'High', path: 'a.dll' },
272+
{ id: '2', section: 'modified', importance: 'Low', path: 'b.exe' },
273+
{ id: '3', section: 'unchanged', path: 'c.json' },
334274
]);
335275

336276
window.applyFilters();
@@ -348,11 +288,6 @@ describe('resetFilters', () => {
348288
<input type="checkbox" id="filter-imp-high">
349289
<input type="checkbox" id="filter-imp-medium" checked>
350290
<input type="checkbox" id="filter-imp-low" checked>
351-
<input type="checkbox" id="filter-ft-dll">
352-
<input type="checkbox" id="filter-ft-exe" checked>
353-
<input type="checkbox" id="filter-ft-config" checked>
354-
<input type="checkbox" id="filter-ft-resource" checked>
355-
<input type="checkbox" id="filter-ft-other" checked>
356291
<input type="checkbox" id="filter-unchecked" checked>
357292
<input type="text" id="filter-search" value="some query">
358293
<span id="save-status"></span>
@@ -363,7 +298,6 @@ describe('resetFilters', () => {
363298
window.resetFilters();
364299

365300
expect(document.getElementById('filter-imp-high').checked).toBe(true);
366-
expect(document.getElementById('filter-ft-dll').checked).toBe(true);
367301
expect(document.getElementById('filter-unchecked').checked).toBe(false);
368302
expect(document.getElementById('filter-search').value).toBe('');
369303
});

Services/HtmlReport/HtmlReportGenerateService.Helpers.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,11 @@ private static void AppendFileRow(
5757
string reasonId = $"reason_{sectionPrefix}_{idx}";
5858
string notesId = $"notes_{sectionPrefix}_{idx}";
5959
int recordNo = idx + 1;
60-
string ext = System.IO.Path.GetExtension(path).ToLowerInvariant();
6160
string impAttr = string.IsNullOrEmpty(importance) ? "" : $" data-importance=\"{HtmlEncode(importance)}\"";
6261
// Normalize diff detail to category for filtering / フィルタリング用に diff detail をカテゴリに正規化
6362
string diffCat = NormalizeDiffCategory(col6);
6463
string diffAttr = string.IsNullOrEmpty(diffCat) ? "" : $" data-diff=\"{diffCat}\"";
65-
sb.AppendLine($"<tr data-section=\"{sectionPrefix}\" data-ext=\"{HtmlEncode(ext)}\"{impAttr}{diffAttr}>");
64+
sb.AppendLine($"<tr data-section=\"{sectionPrefix}\"{impAttr}{diffAttr}>");
6665
sb.AppendLine($" <td class=\"col-no\">{recordNo}</td>");
6766
sb.AppendLine($" <td class=\"col-cb\"><input type=\"checkbox\" id=\"{cbId}\"></td>");
6867
sb.AppendLine($" <td class=\"col-reason\"><input type=\"text\" id=\"{reasonId}\"></td>");

Services/HtmlReport/diff_report.js

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
document.body.appendChild(vi);
4949
});
5050

51-
var __filterIds__ = ['filter-diff-sha256match','filter-diff-sha256mismatch','filter-diff-ilmatch','filter-diff-ilmismatch','filter-diff-textmatch','filter-diff-textmismatch','filter-imp-high','filter-imp-medium','filter-imp-low','filter-ft-dll','filter-ft-exe','filter-ft-config','filter-ft-resource','filter-ft-other','filter-unchecked','filter-search'];
51+
var __filterIds__ = ['filter-diff-sha256match','filter-diff-sha256mismatch','filter-diff-ilmatch','filter-diff-ilmismatch','filter-diff-textmatch','filter-diff-textmismatch','filter-imp-high','filter-imp-medium','filter-imp-low','filter-unchecked','filter-search'];
5252
function collectState() {
5353
var s = {};
5454
document.querySelectorAll('input[id], textarea[id]').forEach(function(el) {
@@ -349,20 +349,9 @@
349349
}
350350

351351
// ── Filtering ──────────────────────────────────────────────────────────
352-
var __configExts__ = ['.json','.xml','.config','.yaml','.yml','.ini','.toml','.env','.props','.targets','.csproj','.vbproj','.fsproj','.sln'];
353-
var __resourceExts__ = ['.resx','.resources','.png','.jpg','.jpeg','.ico','.svg','.gif','.bmp','.wav','.mp3','.ttf','.woff','.woff2','.eot'];
354-
function getFileTypeCategory(ext) {
355-
if (!ext) return 'other';
356-
ext = ext.toLowerCase();
357-
if (ext === '.dll') return 'dll';
358-
if (ext === '.exe') return 'exe';
359-
if (__configExts__.indexOf(ext) >= 0) return 'config';
360-
if (__resourceExts__.indexOf(ext) >= 0) return 'resource';
361-
return 'other';
362-
}
363352
function applyFilters() {
364353
var impHigh = document.getElementById('filter-imp-high');
365-
// If any element is missing (e.g. reviewed mode), skip
354+
// If any element is missing (e.g. reviewed mode), skip / 要素がない場合(レビュー済みモード等)スキップ
366355
if (!impHigh) return;
367356

368357
// Diff detail filter (6 individual values) / Diff Detail フィルター(6個別値)
@@ -375,16 +364,13 @@
375364
TextMismatch: document.getElementById('filter-diff-textmismatch').checked
376365
};
377366
var impFilter = { High: impHigh.checked, Medium: document.getElementById('filter-imp-medium').checked, Low: document.getElementById('filter-imp-low').checked };
378-
var ftDll = document.getElementById('filter-ft-dll');
379-
var ftFilter = { dll: ftDll.checked, exe: document.getElementById('filter-ft-exe').checked, config: document.getElementById('filter-ft-config').checked, resource: document.getElementById('filter-ft-resource').checked, other: document.getElementById('filter-ft-other').checked };
380367
var onlyUnchecked = document.getElementById('filter-unchecked').checked;
381368
var searchEl = document.getElementById('filter-search');
382369
var searchText = (searchEl.value || '').toLowerCase().trim();
383370

384-
// All checked = no filtering for that category
371+
// All checked = no filtering for that category / 全チェック時はフィルタリングなし
385372
var diffActive = !(diffFilter.SHA256Match && diffFilter.SHA256Mismatch && diffFilter.ILMatch && diffFilter.ILMismatch && diffFilter.TextMatch && diffFilter.TextMismatch);
386373
var impActive = !(impFilter.High && impFilter.Medium && impFilter.Low);
387-
var ftActive = !(ftFilter.dll && ftFilter.exe && ftFilter.config && ftFilter.resource && ftFilter.other);
388374

389375
document.querySelectorAll('tbody > tr[data-section]').forEach(function(tr) {
390376
var show = true;
@@ -395,12 +381,6 @@
395381
if (!diffFilter[diff]) show = false;
396382
}
397383
}
398-
// File type filter
399-
if (show && ftActive) {
400-
var ext = tr.getAttribute('data-ext') || '';
401-
var cat = getFileTypeCategory(ext);
402-
if (!ftFilter[cat]) show = false;
403-
}
404384
// Importance filter (only for rows with importance)
405385
if (show && impActive) {
406386
var imp = tr.getAttribute('data-importance');

Services/HtmlReportGenerateService.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -140,16 +140,6 @@ private string BuildHtml(
140140
sb.AppendLine("</div>");
141141
sb.AppendLine("</div>"); // end .filter-tables
142142

143-
// File Type filter row / File Type フィルター行
144-
sb.AppendLine("<div class=\"ctrl-filter-row\">");
145-
sb.AppendLine(" <label class=\"filter-label\">" + HtmlEncode("File Type") + ":</label>");
146-
sb.AppendLine(" <label class=\"filter-chip\"><input type=\"checkbox\" id=\"filter-ft-dll\" checked onchange=\"applyFilters()\"> DLL</label>");
147-
sb.AppendLine(" <label class=\"filter-chip\"><input type=\"checkbox\" id=\"filter-ft-exe\" checked onchange=\"applyFilters()\"> EXE</label>");
148-
sb.AppendLine(" <label class=\"filter-chip\"><input type=\"checkbox\" id=\"filter-ft-config\" checked onchange=\"applyFilters()\"> Config</label>");
149-
sb.AppendLine(" <label class=\"filter-chip\"><input type=\"checkbox\" id=\"filter-ft-resource\" checked onchange=\"applyFilters()\"> Resource</label>");
150-
sb.AppendLine(" <label class=\"filter-chip\"><input type=\"checkbox\" id=\"filter-ft-other\" checked onchange=\"applyFilters()\"> " + HtmlEncode("Other") + "</label>");
151-
sb.AppendLine("</div>");
152-
153143
// Search + Unchecked only row / 検索 + 未チェックのみ行
154144
sb.AppendLine("<div class=\"ctrl-filter-row\">");
155145
sb.AppendLine(" <label class=\"filter-chip\"><input type=\"checkbox\" id=\"filter-unchecked\" onchange=\"applyFilters()\"> " + HtmlEncode("Unchecked only") + "</label>");

doc/DEVELOPER_GUIDE.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,6 @@ The HTML report includes a client-side filter bar that allows users to narrow do
155155

156156
### JavaScript ([`diff_report.js`](../Services/HtmlReport/diff_report.js))
157157

158-
- `getFileTypeCategory(ext)` — maps file extensions to categories (`dll`, `exe`, `config`, `resource`, `other`).
159158
- `applyFilters()` — reads all filter controls and applies `filter-hidden` / `filter-hidden-parent` CSS classes to rows.
160159
- `resetFilters()` — restores all checkboxes and clears the search box.
161160
- `__filterIds__` — array of filter input IDs excluded from `collectState()` / localStorage auto-save.
@@ -951,7 +950,6 @@ HTML レポートには、複数の条件でファイル行を絞り込めるク
951950

952951
### JavaScript([`diff_report.js`](../Services/HtmlReport/diff_report.js)
953952

954-
- `getFileTypeCategory(ext)` — ファイル拡張子をカテゴリ(`dll``exe``config``resource``other`)にマッピング。
955953
- `applyFilters()` — すべてのフィルタコントロールを読み取り、行に `filter-hidden` / `filter-hidden-parent` CSS クラスを適用。
956954
- `resetFilters()` — すべてのチェックボックスを復元し、検索ボックスをクリア。
957955
- `__filterIds__``collectState()` / localStorage 自動保存から除外されるフィルタ入力 ID の配列。

0 commit comments

Comments
 (0)