Function _readPackage
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
_readPackage(packageDir, pkg, isRoot) {
let normalizedPackageDir = path.normalize(packageDir);
// Most of the time, normalizedPackageDir is already a real path (i.e. fs.realpathSync
// will return the same value as normalizedPackageDir if the dir actually exists).
- Read upRead up
- Create a ticketCreate a ticket
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 _readPackage
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
_readPackage(packageDir, pkg, isRoot) {
let normalizedPackageDir = path.normalize(packageDir);
// Most of the time, normalizedPackageDir is already a real path (i.e. fs.realpathSync
// will return the same value as normalizedPackageDir if the dir actually exists).
- Create a ticketCreate a ticket
Function _readNodeModulesList
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
_readNodeModulesList(nodeModulesDir) {
let normalizedNodeModulesDir = path.normalize(nodeModulesDir);
// Much of the time, normalizedNodeModulesDir is already a real path (i.e.
// fs.realpathSync will return the same value as normalizedNodeModulesDir, if
- Create a ticketCreate a ticket
Function _showObjErrors
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
_showObjErrors(obj) {
let errorEntries = obj.hasErrors() ? obj.errors.getErrors() : null;
if (!errorEntries || (errorEntries.length === 1 && errorEntries[0].type === Errors.ERROR_PACKAGE_DIR_MISSING)) {
return;
- Create a ticketCreate a ticket
Function _readNodeModulesList
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
_readNodeModulesList(nodeModulesDir) {
let normalizedNodeModulesDir = path.normalize(nodeModulesDir);
// Much of the time, normalizedNodeModulesDir is already a real path (i.e.
// fs.realpathSync will return the same value as normalizedNodeModulesDir, if
- Read upRead up
- Create a ticketCreate a ticket
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 _showObjErrors
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
_showObjErrors(obj) {
let errorEntries = obj.hasErrors() ? obj.errors.getErrors() : null;
if (!errorEntries || (errorEntries.length === 1 && errorEntries[0].type === Errors.ERROR_PACKAGE_DIR_MISSING)) {
return;
- Read upRead up
- Create a ticketCreate a ticket
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 _findPackage
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
_findPackage(packageName, startPath) {
let parsedPath = path.parse(startPath);
let root = parsedPath.root;
let currPath = startPath;
- Read upRead up
- Create a ticketCreate a ticket
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"