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

Function fileSizeIssues

examples/plugins/src/file-size/src/file-size.plugin.ts:127–145  ·  view source on GitHub ↗
(options: {
  directory: string;
  pattern?: string | RegExp;
  budget?: number;
})

Source from the content-addressed store, hash-verified

125}
126
127export function fileSizeIssues(options: {
128 directory: string;
129 pattern?: string | RegExp;
130 budget?: number;
131}): Promise<Issue[]> {
132 const { directory, pattern, budget } = options;
133
134 return crawlFileSystem({
135 directory,
136 pattern,
137 fileTransform: async (file: string) => {
138 // get size of file
139 // const filePath = path.join(directory, file);
140 const stats = await stat(file);
141
142 return assertFileSize(file, stats.size, budget);
143 },
144 });
145}
146
147export function infoMessage(filePath: string, size: number) {
148 return `File ${path.basename(filePath)} is OK. (size: ${formatBytes(size)})`;

Callers 2

runnerFunctionFunction · 0.85

Calls 2

crawlFileSystemFunction · 0.90
assertFileSizeFunction · 0.85

Tested by

no test coverage detected