MCPcopy Index your code
hub / github.com/code-pushup/cli / parseFileRename

Function parseFileRename

packages/ci/src/lib/git.ts:90–107  ·  view source on GitHub ↗
(file: string)

Source from the content-addressed store, hash-verified

88}
89
90function parseFileRename(file: string): { prev: string; curr: string } | null {
91 const partialRenameMatch = file.match(/^(.*){(.*) => (.*)}(.*)$/);
92 if (partialRenameMatch) {
93 const [, prefix = '', prev, curr, suffix] = partialRenameMatch;
94 return {
95 prev: prefix + prev + suffix,
96 curr: prefix + curr + suffix,
97 };
98 }
99
100 const fullRenameMatch = file.match(/^(.*) => (.*)$/);
101 if (fullRenameMatch) {
102 const [, prev = '', curr = ''] = fullRenameMatch;
103 return { prev, curr };
104 }
105
106 return null;
107}
108
109function parseDiff(diff: string): LineChange[] {
110 const changeSummaries = diff.match(/@@ [ \d,+-]+ @@/g);

Callers 1

listChangedFilesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected