Skip to content

Commit 78f6cbd

Browse files
committed
fix:ran prettier on changes files
1 parent 594be03 commit 78f6cbd

3 files changed

Lines changed: 26 additions & 18 deletions

File tree

clean-architecture-visualizer/src/server/routes/analysis.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ router.get('/analysis/violations/:interactionId', async (req, res) => {
7575
);
7676
const controller = new GetViolationsController(interactor);
7777
const presenter = new GetViolationsPresenter(outputData);
78-
78+
7979
await controller.execute();
8080
const result = presenter.getOutputData();
8181
if (!result) {

clean-architecture-visualizer/src/use_case/getViolations/GetViolationsInteractor.ts

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -80,17 +80,19 @@ export class GetViolationsInteractor implements GetViolationsInputBoundary {
8080
useCaseName: string
8181
): string[] {
8282
const fileKeySet = new Set(fileKeys);
83-
83+
8484
return this.db
8585
.getAllNodes()
8686
.filter(
8787
(n) =>
8888
(n.type === from || n.type === to) &&
8989
n.filePath !== undefined &&
9090
((n.filePath.split('/').length > 0
91-
? fileKeySet.has(n.filePath.split('/').at(-1) as string) && n.id.split('/').at(-1)?.match(/-(.*)/)?.includes(useCaseName)
91+
? fileKeySet.has(n.filePath.split('/').at(-1) as string) &&
92+
n.id.split('/').at(-1)?.match(/-(.*)/)?.includes(useCaseName)
9293
: false) ||
93-
fileKeySet.has(n.filePath) && n.id.split('/').at(-1)?.match(/-(.*)/)?.includes(useCaseName))
94+
(fileKeySet.has(n.filePath) &&
95+
n.id.split('/').at(-1)?.match(/-(.*)/)?.includes(useCaseName)))
9496
)
9597
.map((n) => n.id);
9698
}
@@ -107,23 +109,27 @@ export class GetViolationsInteractor implements GetViolationsInputBoundary {
107109
): Promise<FileContext | undefined> {
108110
const fileKeySet = new Set(fileKeys);
109111

110-
const matchingNode = this.db.getAllNodes().find(
111-
(n) =>
112-
n.type === from &&
113-
n.filePath !== undefined &&
114-
((n.filePath.split('/').length > 0
115-
? fileKeySet.has(n.filePath.split('/').at(-1) as string) && n.id.split('/').at(-1)?.match(/-(.*)/)?.includes(useCaseName)
116-
: false) ||
117-
fileKeySet.has(n.filePath) && n.id.split('/').at(-1)?.match(/-(.*)/)?.includes(useCaseName))
118-
);
112+
const matchingNode = this.db
113+
.getAllNodes()
114+
.find(
115+
(n) =>
116+
n.type === from &&
117+
n.filePath !== undefined &&
118+
((n.filePath.split('/').length > 0
119+
? fileKeySet.has(n.filePath.split('/').at(-1) as string) &&
120+
n.id.split('/').at(-1)?.match(/-(.*)/)?.includes(useCaseName)
121+
: false) ||
122+
(fileKeySet.has(n.filePath) &&
123+
n.id.split('/').at(-1)?.match(/-(.*)/)?.includes(useCaseName)))
124+
);
119125
if (!matchingNode?.filePath) return undefined;
120126
const fileName = matchingNode.filePath.split('/').at(-1);
121127
if (!fileName) return undefined;
122128
const [snippet, line_number] = await Promise.all([
123129
this.fileAccess.getFileSnippet(matchingNode.filePath, to),
124130
this.fileAccess.getLineNumber(matchingNode.filePath, to),
125131
]);
126-
132+
127133
return {
128134
file: fileName,
129135
...(snippet && { snippet }),

clean-architecture-visualizer/tests/backend/use_cases/getViolations.test.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ describe('GetViolationsInteractor', () => {
6060
beforeEach(() => {
6161
// Setup a node that belongs to the "from" side of the violation
6262
genericDBAccess.upsertNode({
63-
id: "src/interface_adapters/uc-1/UserController.java-Process User",
63+
id: 'src/interface_adapters/uc-1/UserController.java-Process User',
6464
type: fromNode,
6565
layer: 'interfaceAdapters',
6666
filePath: filePath,
@@ -89,7 +89,9 @@ describe('GetViolationsInteractor', () => {
8989
await interactor.execute();
9090

9191
const violation = outputData.result[0];
92-
expect(violation.related_node_ids).toContain("src/interface_adapters/uc-1/UserController.java-Process User");
92+
expect(violation.related_node_ids).toContain(
93+
'src/interface_adapters/uc-1/UserController.java-Process User'
94+
);
9395
expect(violation.related_edge_id).toBe(`${fromNode}->${toNode}`);
9496
});
9597

@@ -152,7 +154,7 @@ describe('execute — Violation Mapping for differently formatted file path.', (
152154
beforeEach(() => {
153155
genericDBAccess.upsertNode({
154156
// node id's are file paths since they are unique
155-
id: "src/interface_adapters/uc-1/UserController.java-Process User",
157+
id: 'src/interface_adapters/uc-1/UserController.java-Process User',
156158
type: fromNode,
157159
layer: 'interfaceAdapters',
158160
filePath: filePath,
@@ -182,7 +184,7 @@ describe('execute — Violation Mapping for differently formatted file path.', (
182184

183185
const violation = outputData.result[0];
184186
expect(violation.related_node_ids).toContain(
185-
"src/interface_adapters/uc-1/UserController.java-Process User"
187+
'src/interface_adapters/uc-1/UserController.java-Process User'
186188
);
187189
expect(violation.related_edge_id).toBe(`${fromNode}->${toNode}`);
188190
});

0 commit comments

Comments
 (0)