Showing 103 of 237 total issues
Function upload
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
upload(filepathOrBuffer, keyname) {
let sftp = this;
if (!filepathOrBuffer) {
throw new Error('Param filepathOrBuffer is required for upload.');
}
Function _checkTagsRequiredByProfile
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
_checkTagsRequiredByProfile(profile, jobParamsArray) {
// Get a list of required tags whose values must appear in the CSV file.
for (let i=0; i < jobParamsArray.length; i++) {
let params = jobParamsArray[i];
for (let tag of profile.tags) {
- 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
BagItProfileController
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class BagItProfileController extends BaseController {
constructor(params) {
super(params, 'Settings');
/**
Function doUpload
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
doUpload(uploadOp) {
let uploader = this;
// Clear prior upload results. They may cause the UI to
// report successful upload as failed, or vice-versa.
uploadOp.results = [];
Function _validateSerialization
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
_validateSerialization() {
var validFormat = true;
if (!this.disableSerializationCheck) {
var checkSerializationFormat = true;
var bagIsDirectory = fs.statSync(this.pathToBag).isDirectory();
- 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 validateParams
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
validateParams() {
let errors = [];
for (let op of this.job.uploadOps) {
let opErrors = []
if (Util.isEmpty(op.storageServiceId)) {
- 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 colorCodeJobs
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
colorCodeJobs(jobs) {
// TODO: This code has some overlap with DashboardController#formatJobOutcome.
for(let i=0; i < jobs.length; i++) {
let job = Job.inflateFrom(jobs[i]);
job.pkgDate = '-';
- 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 _validateAllowedTagFiles
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
_validateAllowedTagFiles() {
let allowed = this.profile.tagFilesAllowed || [];
let tagFiles = this.tagFiles();
for (let file of tagFiles) {
if (file.relDestPath == 'bagit.txt') {
- 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 profileFromStandardObject
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
static profileFromStandardObject(obj) {
if (BagItUtil.guessProfileType(obj) != 'bagit_profiles') {
throw Context.y18n.__("Object does not look like a BagIt profile");
}
var p = new BagItProfile();
Function _addObjType
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
_addObjType() {
let objType = `objType_${this.rowCount}`
let question = this.obj.questions[this.rowCount];
let value = question ? question.objType : "";
this.fields[objType] = new Field(
Function _validateTagsInFile
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
_validateTagsInFile(filename, tagFile) {
var requiredTags = this.profile.tagsGroupedByFile();
for (var tagDef of requiredTags[filename]) {
var parsedTagValues = tagFile.keyValueCollection.all(tagDef.tagName);
if (parsedTagValues == null) {
- 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 uploadSucceeded
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
uploadSucceeded() {
let anyAttempted = false;
let allSucceeded = true;
if (this.uploadOps) {
for (let op of this.uploadOps) {
- 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 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
run() {
var creator = this;
if (!this.job.packageOp.validate()) {
return new Promise(function(resolve, reject) {
let errors = Object.values(creator.job.packageOp.errors);
Function _importProfileObject
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
_importProfileObject(json, profileUrl) {
let obj;
try {
obj = JSON.parse(json);
} catch (ex) {
Function profileToStandardObject
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
static profileToStandardObject(p) {
var obj = {};
obj["Accept-BagIt-Version"] = p.acceptBagItVersion;
obj["Accept-Serialization"] = p.acceptSerialization;
obj["Allow-Fetch.txt"] = p.allowFetchTxt;
- 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 _updatePackaging
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
_updatePackaging(withValidation) {
let form = this._parseJobPackagingForm();
if (withValidation) {
if (this.job.packageOp.packageFormat == Context.y18n.__('Choose One')) {
form.obj.errors['packageFormat'] = Context.y18n.__("You must specify a package format.");
- 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 _validatePayloadOxum
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
_validatePayloadOxum() {
//Context.logger.info(`Validator: Validating Payload-Oxum in ${this.pathToBag}`);
let found = false;
let bagInfo = this.files["bag-info.txt"];
if (bagInfo && bagInfo.keyValueCollection) {
- 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 attachDragAndDropEvents
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
attachDragAndDropEvents() {
let controller = this;
$('#dropZone').on('drop', function(e) {
e.preventDefault();
e.stopPropagation();
Function profileToStandardObject
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
static profileToStandardObject(p) {
var obj = {};
obj["Accept-BagIt-Version"] = p.acceptBagItVersion;
obj["Accept-Serialization"] = p.acceptSerialization;
obj["Allow-Fetch.txt"] = p.allowFetchTxt;
Function create
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
async create() {
var packOp = this.job.packageOp;
this.emit('packageStart', `Starting to build ${packOp.packageName}`);
packOp.result = new OperationResult('bagging', 'DART bagger');
packOp.result.filepath = packOp.outputPath;