Showing 103 of 237 total issues
Function _ensureDirectories
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
_ensureDirectories(fileHeader) {
let template =
{
relDestPath: '',
mode: 0o755,
Function read
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
read() {
var tarReader = this;
var extract = tar.extract();
tarReader.fileCount = 0;
tarReader.dirCount = 0;
Function _readEntry
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
_readEntry(entry) {
let validator = this;
if (entry.fileStat.isFile()) {
var bagItFile = this._addBagItFile(entry);
if (Context.slowMotionDelay > 0) {
- 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 renderPackageInfo
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
renderPackageInfo(data, dartProcess) {
let [detailDiv, progressBar] = this.getDivs(dartProcess, 'packageInfo');
if (data.action == 'fileAdded') {
let shortName = Util.trimToLength(data.msg, 80, 'middle');
detailDiv.text(Context.y18n.__('Added file %s', shortName));
- 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 chooseManifestAlgorithms
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
chooseManifestAlgorithms(whichType) {
if (whichType != 'manifest' && whichType != 'tagmanifest') {
throw Context.y18n.__("Param whichType must be either 'manifest' or 'tagmanifest'");
}
let required = this.manifestsRequired;
- 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 _getJobOutcomeAndTimestamp
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
_getJobOutcomeAndTimestamp(job) {
// TODO: This code has some overlap with JobController#colorCodeJobs.
let outcome = "Job has not been run.";
let timestamp = null;
if(job.uploadAttempted()) {
- 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 validate
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
validate() {
this.errors = {};
if (typeof this.packageName != 'string' || Util.isEmpty(this.packageName)) {
this.errors['PackageOperation.packageName'] = 'Package name is required.';
}
- 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 run
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async run() {
let returnCode = Constants.EXIT_SUCCESS;
try {
returnCode = await this.createPackage();
if (returnCode == Constants.EXIT_SUCCESS) {
- 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 arrayContentsMatch
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
static arrayContentsMatch(a, b, orderMatters) {
if (!Array.isArray(a) || !Array.isArray(b)) {
return false;
}
if (a === b) {
- 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 deleteRecursive
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
static deleteRecursive(filepath) {
if (filepath.length < 8 || filepath.split(path.sep).length < 3) {
throw `${filepath} does not look safe to delete`;
}
if (fs.existsSync(filepath)) {
- 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 findCommonPathPrefix
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
static findCommonPathPrefix(paths, pathSep = path.sep) {
let i = 0;
let lastPrefix = '';
let prefix = '';
let match = true;
- 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 _tagDefToField
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
_tagDefToField(t) {
var field = new Field(t.id, t.id, t.tagName, t.getValue());
field.help = t.help;
if (t.values && t.values.length > 0) {
field.choices = Choice.makeList(t.values, t.getValue(), true);
- 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 _ensureDirectories
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
_ensureDirectories(fileHeader) {
let template =
{
relDestPath: '',
mode: 0o755,
- 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 updateAPTrustBagItProfiles
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function updateAPTrustBagItProfiles() {
let profile = BagItProfile.find(aptrustProfileId);
let succeeded = true;
if (profile) {
if (!updateProfile(profile)) {
- 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 _getTarOutputWriter
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
_getTarOutputWriter() {
if (this._tarOutputWriter == null) {
if (!this.pathToTarFile.endsWith(".tar")) {
throw new Error(Context.y18n.__(`pathToTarFile '%s' must have .tar extension`, this.pathToTarFile));
}
- 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 getRunErrors
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
getRunErrors() {
let errs = [];
if (this.packageOp && this.packageOp.result) {
errs = errs.concat(this.packageOp.result.errors);
}
- 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 validate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
validate() {
this.errors = {};
if (Util.isEmpty(this.tagFile)) {
this.errors['tagFile'] = "You must specify a tag file.";
}
- 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 findContainingItem
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
findContainingItem(filepath) {
if (Array.isArray(this.job.packageOp.sourceFiles)) {
for (let item of this.job.packageOp.sourceFiles) {
if (item === filepath || (filepath.startsWith(item) && Util.isDirectory(item))) {
return item;
- 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 validate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
validate() {
this.errors = {};
super.validate();
if (Util.isEmptyStringArray(this.acceptBagItVersion)) {
this.errors["acceptBagItVersion"] = Context.y18n.__("Profile must accept at least one BagIt version.");
- 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 loadFixtures
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
static loadFixtures(filenames, type, save = false) {
let types = ['AppSetting', 'InternalSetting', 'Job',
'JobParams', 'RemoteRepository', 'StorageService',
'Workflow'];
if (typeof type.name != 'string' || !types.includes(type.name)) {
- 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"