File project-context.js
has 1257 lines of code (exceeds 250 allowed). Consider refactoring. Open
var assert = require("assert");
var _ = require('underscore');
var archinfo = require('./utils/archinfo');
`` has 35 functions (exceeds 20 allowed). Consider refactoring. Open
Object.assign(ProjectContext.prototype, {
reset: function (moreOptions, resetOptions) {
var self = this;
// Allow overriding some options until the next call to reset;
var options = Object.assign({}, self.originalOptions, moreOptions);
Function reset
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
reset: function (moreOptions, resetOptions) {
var self = this;
// Allow overriding some options until the next call to reset;
var options = Object.assign({}, self.originalOptions, moreOptions);
// This is options that are actually directed at reset itself.
Function _resolveConstraints
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
_resolveConstraints: Profile('_resolveConstraints', function () {
var self = this;
buildmessage.assertInJob();
var depsAndConstraints = self._getRootDepsAndConstraints();
Function _readFile
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
_readFile: function () {
var self = this;
buildmessage.assertInCapture();
self.watchSet = new watch.WatchSet;
Function _readProjectMetadata
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
_readProjectMetadata: Profile('_readProjectMetadata', function () {
var self = this;
buildmessage.assertInCapture();
buildmessage.enterJob('reading project metadata', function () {
Function reset
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
reset: function (moreOptions, resetOptions) {
var self = this;
// Allow overriding some options until the next call to reset;
var options = Object.assign({}, self.originalOptions, moreOptions);
// This is options that are actually directed at reset itself.
- 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 getNodeModulesToRecompileByArch
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
getNodeModulesToRecompileByArch() {
const packageNamesByArch = Object.create(null);
const recompile = this.get("nodeModules", "recompile");
if (recompile && typeof recompile === "object") {
Function _getEntryModule
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
_getEntryModule(
arch,
entryModulesByArch,
) {
const entryMatch = archinfo.mostSpecificMatch(
Function _localPackageSearchDirs
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
_localPackageSearchDirs: function () {
const self = this;
let searchDirs = [
files.pathJoin(self._projectDirForLocalPackages, 'packages'),
];
Function _initializeCatalog
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
_initializeCatalog: Profile('_initializeCatalog', function () {
var self = this;
buildmessage.assertInJob();
catalog.runAndRetryWithRefreshIfHelpful(function () {
Function _readFile
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
_readFile: function () {
var self = this;
buildmessage.assertInCapture();
self.watchSet = new watch.WatchSet;
Function ensureDevBundleLink
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
ensureDevBundleLink() {
import { makeLink, readLink } from "./cli/dev-bundle-links.js";
const dotMeteorDir = files.pathDirname(this.filename);
const localDir = files.pathJoin(dotMeteorDir, "local");
Function _buildLocalPackages
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
_buildLocalPackages: Profile('_buildLocalPackages', function () {
var self = this;
buildmessage.assertInCapture();
Function _write
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
_write: function () {
var self = this;
var lines = _.map(self._constraintLines, function (lineRecord) {
// Don't write packages that were not loaded from .meteor/packages
if (lineRecord.skipOnWrite)
- 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 _getEntryModule
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
_getEntryModule(
arch,
entryModulesByArch,
) {
const entryMatch = archinfo.mostSpecificMatch(
- 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 getNodeModulesToRecompileByArch
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
getNodeModulesToRecompileByArch() {
const packageNamesByArch = Object.create(null);
const recompile = this.get("nodeModules", "recompile");
if (recompile && typeof recompile === "object") {
- 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
Consider simplifying this complex logical expression. Open
if (! self._neverWritePackageMap &&
(self._alwaysWritePackageMap ||
(release.current.isCheckout() && self.releaseFile.isCheckout()) ||
(! release.current.isCheckout() &&
release.current.name === self.releaseFile.fullReleaseName))) {
Function ensureDevBundleLink
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
ensureDevBundleLink() {
import { makeLink, readLink } from "./cli/dev-bundle-links.js";
const dotMeteorDir = files.pathDirname(this.filename);
const localDir = files.pathJoin(dotMeteorDir, "local");
- 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 _saveChangedMetadata
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
_saveChangedMetadata: Profile('_saveChangedMetadata', function () {
var self = this;
// Save any changes to .meteor/packages.
if (! self._neverWriteProjectConstraintsFile)
- 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;
Avoid too many return
statements within this function. Open
return;
Avoid too many return
statements within this function. Open
return;
Avoid too many return
statements within this function. Open
return;
Avoid too many return
statements within this function. Open
return;
Function appendUpgraders
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
appendUpgraders: function (upgraders) {
var self = this;
var current = null;
try {
- 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 _readResolverResultCache
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
_readResolverResultCache() {
if (! this._resolverResultCache) {
try {
this._resolverResultCache =
JSON.parse(files.readFile(files.pathJoin(
- 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 getDevBundle
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
getDevBundle() {
let devBundle = files.getDevBundle();
const devBundleParts = devBundle.split(files.pathSep);
const meteorToolIndex = devBundleParts.lastIndexOf("meteor-tool");
- 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"