Showing 103 of 237 total issues
Function run
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
run() {
var bagValidator = this;
this.initOpResult();
// Return a failed promise if we get invalid params.
Function read
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
read() {
var fsReader = this;
var stream = readdirp(fsReader.pathToDirectory, OPTS);
fsReader.fileCount = 0;
fsReader.dirCount = 0;
Function _setBagInfoAutoValues
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
_setBagInfoAutoValues() {
var profile = this.job.bagItProfile;
var baggingDate = profile.firstMatchingTag('tagName', 'Bagging-Date');
if (baggingDate) {
baggingDate.userValue = dateFormat(Date.now(), 'isoUtcDateTime');
Function promise
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
var promise = new Promise(function(resolve, reject) {
let lastPercentComplete = 0;
provider.on('start', function(result) {
// Note: percentComplete is -1 because we don't
// yet have a way of getting that info.
Function constructor
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(bagItFile) {
/**
* bagItFile is the file that will be parsed.
* When parsing is complete, bagItFile.keyValueCollection
* will be populated with tag names and values.
Function uploadFiles
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
async uploadFiles() {
// TODO: Retry those that failed due to non-fatal error.
let returnCode = Constants.EXIT_SUCCESS;
if (this.job.uploadOps.length > 0) {
this.assignUploadSources();
- 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 _listBagItSerializations
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
_listBagItSerializations() {
let none = Context.y18n.__('None');
let formats = [{ id: '', name: none }];
let profile = null;
if (this.fields.bagItProfileId.value) {
- 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 _writeManifests
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
async _writeManifests(payloadOrTag) {
var profile = this.job.bagItProfile;
var manifestAlgs = profile.chooseManifestAlgorithms('manifest');
var fileNamePrefix = 'manifest';
if (payloadOrTag == 'tag') {
- 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 add
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
add(bagItFile, cryptoHashes = []) {
super.add(bagItFile, cryptoHashes);
var tarWriter = this;
var header = {
// Don't use path.join because Windows will give us
Function _writeIntoArchive
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
function _writeIntoArchive(data, done) {
if (!fs.existsSync(path.dirname(data.dest))) {
try {
mkdirp.sync(path.dirname(data.dest), { mode: 0o755 });
} catch (err) {
Function _mkdir
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
_mkdir(bagItFile) {
var tarWriter = this;
var header = {
name: bagItFile.relDestPath,
type: 'directory',
Function runJob
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
runJob(jobParams, lineNumber, lastJobNumber) {
let controller = this;
return new Promise((resolve, reject) => {
let job = jobParams.toJob();
// validate job?
Function _upload
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
_upload(xfer) {
var s3Client = this;
var minioClient = s3Client._getClient();
// Metadata works with fPutObject, but not with putObject,
// so this is commented out for now. We can delete it if we
Function postRenderCallback
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
postRenderCallback(fnName) {
let controller = this;
$('#pathToBag').on('change',function(e){
let element = document.getElementById('pathToBag');
if (element && element.files && element.files[0]) {
Function parseFromDOM
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
parseFromDOM() {
// This is required for jest tests.
if ($ === undefined) {
var $ = require('jquery');
}
- 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 _mergeTagSet
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
_mergeTagSet(bagItProfile, tags, profileTags) {
let firstInstanceOfTag = null;
for (let i = 0; i < tags.length; i++) {
let tag = tags[i];
if (profileTags.length > i) {
- 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 guessProfileType
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
static guessProfileType(obj) {
let type = 'unknown';
if (Array.isArray(obj['tags'])) {
type = 'dart';
} else if (Array.isArray(obj['ordered'])) {
- 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 _setBagInfoAutoValues
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
_setBagInfoAutoValues() {
var profile = this.job.bagItProfile;
var baggingDate = profile.firstMatchingTag('tagName', 'Bagging-Date');
if (baggingDate) {
baggingDate.userValue = dateFormat(Date.now(), 'isoUtcDateTime');
- 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 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
validateParams() {
let errors = [];
for (let op of this.job.uploadOps) {
let opErrors = []
if (Util.isEmpty(op.storageServiceId)) {
Function constructor
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(bagItFile) {
/**
* bagItFile is the file that will be parsed.
* When parsing is complete, bagItFile.keyValueCollection
* will be populated with relative file paths and