@shakecodeslikecray/whiterose 1.0.10 → 1.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli/index.js CHANGED
@@ -5445,14 +5445,16 @@ function getRepoName(cwd) {
5445
5445
  }
5446
5446
  return basename(cwd);
5447
5447
  }
5448
- async function countLinesOfCode(cwd, files) {
5448
+ function countLinesOfCode(cwd, files) {
5449
5449
  let total = 0;
5450
5450
  for (const file of files.slice(0, 500)) {
5451
5451
  try {
5452
- const content = readFileSync(join(cwd, file), "utf-8");
5452
+ const filePath = isAbsolute(file) ? file : join(cwd, file);
5453
+ if (!existsSync(filePath)) continue;
5454
+ const content = readFileSync(filePath, "utf-8");
5453
5455
  const lines = content.split("\n").filter((line2) => {
5454
5456
  const trimmed = line2.trim();
5455
- return trimmed.length > 0 && !trimmed.startsWith("//") && !trimmed.startsWith("/*") && !trimmed.startsWith("*");
5457
+ return trimmed.length > 0 && !trimmed.startsWith("//") && !trimmed.startsWith("/*") && !trimmed.startsWith("*") && !trimmed.startsWith("#");
5456
5458
  });
5457
5459
  total += lines.length;
5458
5460
  } catch {
@@ -5753,7 +5755,7 @@ async function scanCommand(paths, options) {
5753
5755
  );
5754
5756
  }
5755
5757
  const allBugs = mergeResult.bugs;
5756
- const linesOfCode = await countLinesOfCode(cwd, filesToScan);
5758
+ const linesOfCode = countLinesOfCode(cwd, filesToScan);
5757
5759
  const scanDuration = Date.now() - scanStartTime;
5758
5760
  const bugItems = allBugs.filter((b) => b.kind === "bug");
5759
5761
  const smellItems = allBugs.filter((b) => b.kind === "smell");