code-complexity
Advanced tools
Comparing version
{ | ||
"name": "code-complexity", | ||
"version": "4.2.1", | ||
"version": "4.2.2", | ||
"description": "Measure the churn/complexity score. Higher values mean hotspots where refactorings should happen.", | ||
@@ -5,0 +5,0 @@ "author": { |
@@ -90,3 +90,3 @@ "use strict"; | ||
function executeGitLogCommand(gitLogCommand) { | ||
return (0, child_process_1.execSync)(gitLogCommand, { encoding: "utf8" }); | ||
return (0, child_process_1.execSync)(gitLogCommand, { encoding: "utf8", maxBuffer: 32000000 }); | ||
} | ||
@@ -93,0 +93,0 @@ function assertGitIsInstalled() { |
@@ -105,4 +105,6 @@ "use strict"; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var count; | ||
var ASCII_FOR_NEW_LINE, ASCII_FOR_CARRIAGE_RETURN, count; | ||
return __generator(this, function (_a) { | ||
ASCII_FOR_NEW_LINE = "10"; | ||
ASCII_FOR_CARRIAGE_RETURN = "13"; | ||
count = 0; | ||
@@ -112,5 +114,9 @@ return [2 /*return*/, new Promise(function (resolve) { | ||
.on("data", function (chunk) { | ||
for (var i = 0; i < chunk.length; ++i) | ||
if (chunk[i] == 10) | ||
count++; | ||
for (var i = 0; i < chunk.length; ++i) { | ||
var char = chunk[i]; | ||
// Use "==" instead of "===" to use type coercion | ||
if (char == ASCII_FOR_NEW_LINE || char == ASCII_FOR_CARRIAGE_RETURN) { | ||
count += 1; | ||
} | ||
} | ||
}) | ||
@@ -117,0 +123,0 @@ .on("end", function () { |
{ | ||
"name": "code-complexity", | ||
"version": "4.2.1", | ||
"version": "4.2.2", | ||
"description": "Measure the churn/complexity score. Higher values mean hotspots where refactorings should happen.", | ||
@@ -5,0 +5,0 @@ "author": { |
@@ -63,3 +63,3 @@ import { execSync } from "child_process"; | ||
function executeGitLogCommand(gitLogCommand: string): string { | ||
return execSync(gitLogCommand, { encoding: "utf8" }); | ||
return execSync(gitLogCommand, { encoding: "utf8", maxBuffer: 32_000_000 }); | ||
} | ||
@@ -66,0 +66,0 @@ |
@@ -48,2 +48,5 @@ import * as sloc from "node-sloc"; | ||
async function countLineNumber(absolutePath: string): Promise<number> { | ||
const ASCII_FOR_NEW_LINE = "10"; | ||
const ASCII_FOR_CARRIAGE_RETURN = "13"; | ||
let count = 0; | ||
@@ -53,3 +56,9 @@ return new Promise((resolve) => { | ||
.on("data", function (chunk) { | ||
for (let i = 0; i < chunk.length; ++i) if (chunk[i] == 10) count++; | ||
for (let i = 0; i < chunk.length; ++i) { | ||
const char = chunk[i]; | ||
// Use "==" instead of "===" to use type coercion | ||
if (char == ASCII_FOR_NEW_LINE || char == ASCII_FOR_CARRIAGE_RETURN) { | ||
count += 1; | ||
} | ||
} | ||
}) | ||
@@ -56,0 +65,0 @@ .on("end", function () { |
72264
0.96%1648
0.86%