File files.ts
has 1176 lines of code (exceeds 250 allowed). Consider refactoring. Open
///
/// utility functions for files and directories. includes both generic
/// helper functions (such as rm_recursive), and meteor-specific ones
/// (such as testing whether an directory is a meteor app)
///
Function treeHash
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
export function treeHash(root: string, optionsParams: {
ignore?: (path: string) => boolean;
}) {
const options = {
ignore() { return false; },
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function renameDirAlmostAtomically
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Profile("files.renameDirAlmostAtomically", (fromDir: string, toDir: string) => {
const garbageDir = pathJoin(
pathDirname(toDir),
// Begin the base filename with a '.' character so that it can be
// ignored by other directory-scanning code.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function wrapFsFunc
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
function wrapFsFunc<TArgs extends any[], TResult>(
fnName: string,
fn: (...args: TArgs) => TResult,
pathArgIndices: number[],
options?: wrapFsFuncOptions<TArgs, TResult>,
Function treeHash
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function treeHash(root: string, optionsParams: {
ignore?: (path: string) => boolean;
}) {
const options = {
ignore() { return false; },
Function cp_r
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function cp_r(from: string, to: string, options: {
preserveSymlinks?: boolean;
ignore?: RegExp[];
transformFilename?: (f: string) => string;
transformContents?: (
Function renameDirAlmostAtomically
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Profile("files.renameDirAlmostAtomically", (fromDir: string, toDir: string) => {
const garbageDir = pathJoin(
pathDirname(toDir),
// Begin the base filename with a '.' character so that it can be
// ignored by other directory-scanning code.
Function mkdtemp
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function mkdtemp(prefix: string): string {
function make(): string {
prefix = prefix || 'mt-';
// find /tmp
let tmpDir: string | undefined;
Function mkdtemp
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
export function mkdtemp(prefix: string): string {
function make(): string {
prefix = prefix || 'mt-';
// find /tmp
let tmpDir: string | undefined;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function mkdir_p
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
export function mkdir_p(dir: string, mode: number | null = null) {
const p = pathResolve(dir);
const ps = pathNormalize(p).split(pathSep);
const stat = statOrNull(p);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function make
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
function make(): string {
prefix = prefix || 'mt-';
// find /tmp
let tmpDir: string | undefined;
['TMPDIR', 'TMP', 'TEMP'].some(t => {
Function rename
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const rename = isWindowsLikeFilesystem() ? function (from: string, to: string) {
// Retries are necessary only on Windows, because the rename call can
// fail with EBUSY, which means the file is in use.
const osTo = convertToOSPath(to);
const startTimeMs = Date.now();
Function traverse
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function traverse(relativePath: string) {
if (options.ignore(relativePath)) {
return;
}
Function getPathsInDir
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function getPathsInDir(dir: string, options: {
cwd?: string;
output?: string[];
}) {
// Don't let this function yield so that the file system doesn't get changed
Function symlinkWithOverwrite
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Profile("files.symlinkWithOverwrite", function symlinkWithOverwrite(
source: string,
target: string,
) {
const args: [string, string, "junction"?] = [source, target];
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function addToGitignore
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export function addToGitignore(dirPath: string, entry: string) {
const filePath = pathJoin(dirPath, ".gitignore");
if (exists(filePath)) {
let data = readFile(filePath, 'utf8') as string;
const lines = data.split(/\n/);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function cp_r
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export function cp_r(from: string, to: string, options: {
preserveSymlinks?: boolean;
ignore?: RegExp[];
transformFilename?: (f: string) => string;
transformContents?: (
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function findUpwards
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function findUpwards(
predicate: (path: string) => boolean,
startPath: string = cwd(),
): string | null {
let testDir: string | null = startPath;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid too many return
statements within this function. Open
return pathIsDirectory(p);
Function createTarGzStream
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function createTarGzStream(dirPath: string) {
const tar = require("tar-fs");
const zlib = require("zlib");
const basename = pathBasename(dirPath);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function getSettings
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function getSettings(
filename: string,
watchSet: import("./watch").WatchSet,
) {
buildmessage.assertInCapture();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"