Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (fs.existsSync(git_path) && fs.lstatSync(git_path).isDirectory()) {
lib.verbose("Commit: " + fs.readFileSync(path.join(__dirname, ".git/refs/heads/master"), "utf8").replace(/\n/, ""));
} else {
lib.verbose("No git folder found.");
}
lib.verbose(`Analyzing ${filename}`, false);
const sampleBuffer = fs.readFileSync(filename);
let encoding;
if (argv.encoding) {
lib.debug("Using argv encoding");
encoding = argv.encoding;
} else {
lib.debug("Using detected encoding");
encoding = require("jschardet").detect(sampleBuffer).encoding;
if (encoding === null) {
lib.warning("jschardet (v" + require("jschardet/package.json").version + ") couldn't detect encoding, using UTF-8");
encoding = "utf8";
} else {
lib.debug("jschardet (v" + require("jschardet/package.json").version + ") detected encoding " + encoding);
}
}
let code = iconv.decode(sampleBuffer, encoding);
if (code.match(".
lib.debug("Sample seems to be WSF");
code = code.replace(/<\??\/?\w+( [\w=\"\']*)*\??>/g, ""); // XML tags
code = code.replace(//g, "");
}
function lacksBinary(name) {