feat(FN-4956): complete Step 1 — add scope partition helper
Fusion-Task-Id: FN-4956 Fusion-Task-Lineage: 7105cd5e-27f4-4e84-b2ae-e811a183803f
This commit is contained in:
committed by
gsxdsm
parent
9f22bf3ca3
commit
863fbeac0f
@@ -3927,6 +3927,27 @@ export function matchesScope(filePath: string, scopePatterns: string[]): boolean
|
||||
return false;
|
||||
}
|
||||
|
||||
export function partitionConflictsByFileScope(params: {
|
||||
conflictFiles: string[];
|
||||
declaredScope: string[];
|
||||
}): { inScope: string[]; outOfScope: string[] } {
|
||||
const { conflictFiles, declaredScope } = params;
|
||||
if (declaredScope.length === 0) {
|
||||
return { inScope: [...conflictFiles], outOfScope: [] };
|
||||
}
|
||||
|
||||
const inScope: string[] = [];
|
||||
const outOfScope: string[] = [];
|
||||
for (const file of conflictFiles) {
|
||||
if (matchesScope(file, declaredScope)) {
|
||||
inScope.push(file);
|
||||
} else {
|
||||
outOfScope.push(file);
|
||||
}
|
||||
}
|
||||
return { inScope, outOfScope };
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate that the diff stays within the task's declared File Scope.
|
||||
* Returns warnings for out-of-scope changes, especially large deletions.
|
||||
|
||||
Reference in New Issue
Block a user