Skip to content

Commit 38ed349

Browse files
authored
Merge pull request #1046 from dddjava/agent/remove-unused-functions
refactor: 未使用関数の削除
2 parents e4fb123 + 8ef15d6 commit 38ed349

2 files changed

Lines changed: 0 additions & 77 deletions

File tree

jig-core/src/main/resources/templates/assets/package.js

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -153,29 +153,6 @@ function buildAggregationStats(packages, relations, maxDepth) {
153153
return stats;
154154
}
155155

156-
function buildAggregationStatsForPackageFilter(packages, relations, packageFilterFqn, maxDepth) {
157-
const filterPrefix = packageFilterFqn ? `${packageFilterFqn}.` : null;
158-
const withinFilter = fqn => !packageFilterFqn || fqn === packageFilterFqn || fqn.startsWith(filterPrefix);
159-
const filteredPackages = packages.filter(item => withinFilter(item.fqn));
160-
const filteredRelations = relations.filter(relation => withinFilter(relation.from) && withinFilter(relation.to));
161-
return buildAggregationStats(filteredPackages, filteredRelations, maxDepth);
162-
}
163-
164-
function buildAggregationStatsForRelated(packages, relations, rootFqn, maxDepth, aggregationDepth, relatedFilterMode) {
165-
if (!rootFqn) {
166-
return buildAggregationStats(packages, relations, maxDepth);
167-
}
168-
const aggregatedRoot = getAggregatedFqn(rootFqn, aggregationDepth);
169-
const relatedSet = collectRelatedSet(aggregatedRoot, relations, aggregationDepth, relatedFilterMode);
170-
const relatedPackages = packages.filter(item => relatedSet.has(getAggregatedFqn(item.fqn, aggregationDepth)));
171-
const relatedRelations = relations.filter(relation => {
172-
const from = getAggregatedFqn(relation.from, aggregationDepth);
173-
const to = getAggregatedFqn(relation.to, aggregationDepth);
174-
return relatedSet.has(from) && relatedSet.has(to);
175-
});
176-
return buildAggregationStats(relatedPackages, relatedRelations, maxDepth);
177-
}
178-
179156
function buildAggregationStatsForFilters(packages, relations, packageFilterFqn, relatedFilterFqn, maxDepth, aggregationDepth, relatedFilterMode) {
180157
const withinPackageFilter = fqn => {
181158
if (!packageFilterFqn) return true;
@@ -516,18 +493,6 @@ function renderPackageTable(context) {
516493
});
517494
}
518495

519-
function filterPackageTableRows(packageFilterFqn) {
520-
const rows = dom.getPackageTableRows();
521-
const rowFqns = Array.from(rows, row => {
522-
const fqnCell = row.querySelector('td.fqn');
523-
return fqnCell ? fqnCell.textContent : '';
524-
});
525-
const visibility = buildPackageRowVisibility(rowFqns, packageFilterFqn);
526-
rows.forEach((row, index) => {
527-
row.classList.toggle('hidden', !visibility[index]);
528-
});
529-
}
530-
531496
function filterRelatedTableRows(fqn, context) {
532497
const rows = dom.getPackageTableRows();
533498
const {relations} = getPackageSummaryData(context);
@@ -1252,8 +1217,6 @@ if (typeof module !== 'undefined' && module.exports) {
12521217
getCommonPrefixDepth,
12531218
getPackageFqnFromTypeFqn,
12541219
buildAggregationStats,
1255-
buildAggregationStatsForPackageFilter,
1256-
buildAggregationStatsForRelated,
12571220
buildAggregationStatsForFilters,
12581221
normalizePackageFilterValue,
12591222
normalizeAggregationDepthValue,
@@ -1269,7 +1232,6 @@ if (typeof module !== 'undefined' && module.exports) {
12691232
buildPackageTableActionSpecs,
12701233
buildPackageTableRowElement,
12711234
renderPackageTable,
1272-
filterPackageTableRows,
12731235
filterRelatedTableRows,
12741236
renderRelatedFilterLabel,
12751237
setRelatedFilterAndRender,

jig-core/src/test/js/package.test.js

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -319,45 +319,6 @@ test.describe('package.js', () => {
319319

320320
test.describe('集計', () => {
321321
test.describe('ロジック', () => {
322-
test('buildAggregationStatsForPackageFilter: 対象のみ数える', () => {
323-
testContext.aggregationDepth = 0;
324-
const packages = [
325-
{fqn: 'app.domain.a'},
326-
{fqn: 'app.domain.b'},
327-
{fqn: 'app.other.c'},
328-
];
329-
const relations = [
330-
{from: 'app.domain.a', to: 'app.domain.b'},
331-
{from: 'app.other.c', to: 'app.domain.a'},
332-
];
333-
334-
const stats = pkg.buildAggregationStatsForPackageFilter(packages, relations, 'app.domain', 0);
335-
const depth0 = stats.get(0);
336-
337-
assert.equal(depth0.packageCount, 2);
338-
assert.equal(depth0.relationCount, 1);
339-
});
340-
341-
test('buildAggregationStatsForRelated: 集計深さを反映する', () => {
342-
const aggregationDepth = 1;
343-
const relatedFilterMode = 'all';
344-
const packages = [
345-
{fqn: 'app.domain.a'},
346-
{fqn: 'app.domain.b'},
347-
{fqn: 'app.other.c'},
348-
];
349-
const relations = [
350-
{from: 'app.domain.a', to: 'app.domain.b'},
351-
{from: 'app.domain.b', to: 'app.other.c'},
352-
];
353-
354-
const stats = pkg.buildAggregationStatsForRelated(packages, relations, 'app.domain.a', 1, aggregationDepth, relatedFilterMode);
355-
const depth1 = stats.get(1);
356-
357-
assert.equal(depth1.packageCount, 1);
358-
assert.equal(depth1.relationCount, 0);
359-
});
360-
361322
test('buildAggregationStatsForFilters: directモードの複合集計を行う', () => {
362323
const packages = [
363324
{fqn: 'app.domain.a'},

0 commit comments

Comments
 (0)