Showing 103 of 237 total issues
Function constructor
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(name, writeFn) {
super();
if (typeof writeFn != 'function') {
throw new Error(Context.y18n.__('Param %s must be a function', 'writeFn'));
Function _writeManifests
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
async _writeManifests(payloadOrTag) {
var profile = this.job.bagItProfile;
var manifestAlgs = profile.chooseManifestAlgorithms('manifest');
var fileNamePrefix = 'manifest';
if (payloadOrTag == 'tag') {
Function chooseManifestAlgorithms
has 29 lines of code (exceeds 25 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;
Function _listBagItSerializations
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
_listBagItSerializations() {
let none = Context.y18n.__('None');
let formats = [{ id: '', name: none }];
let profile = null;
if (this.fields.bagItProfileId.value) {
Function run
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function run() {
process.on('uncaughtException', function (error) {
console.error(error);
Context.logger.error(error);
});
Function createWindow
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createWindow() {
// Create the browser window.
win = new BrowserWindow({
width: 1200,
height: 900,
Function list
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
list() {
var tarReader = this;
var extract = tar.extract();
tarReader.fileCount = 0;
tarReader.dirCount = 0;
Function parseFromDOM
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
parseFromDOM() {
// This is required for jest tests.
if ($ === undefined) {
var $ = require('jquery');
}
Function profileFromStandardObject
has a Cognitive Complexity of 10 (exceeds 5 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();
- 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 _validateManifestEntries
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
_validateManifestEntries(manifestType) {
var manifests = this.payloadManifests();
if (manifestType === Constants.TAG_MANIFEST) {
manifests = this.tagManifests();
}
- 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 uploadedAt
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
uploadedAt() {
var uploadedAt = null;
if (this.uploadOps.length > 0) {
for (let uploadOp of this.uploadOps) {
for (let result of uploadOp.results) {
- 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 _writeIntoArchive
has a Cognitive Complexity of 10 (exceeds 5 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) {
- 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 title
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
get title() {
// Try to get the name of the file that was created or uploaded.
var name = null;
if (!name && this.packageOp && this.packageOp.packageName) {
name = path.basename(this.packageOp.packageName);
- 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 uploadAttempted
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
uploadAttempted() {
if (this.uploadOps) {
for (let op of this.uploadOps) {
for (let result of op.results) {
if (result.attempt > 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 writeFile
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function writeFile(data, done) {
try {
var reader = fs.createReadStream(data.bagItFile.absSourcePath);
reader.on('error', function(err) {
Function _validateSerialization
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
_validateSerialization() {
var validFormat = true;
if (!this.disableSerializationCheck) {
var checkSerializationFormat = true;
var bagIsDirectory = fs.statSync(this.pathToBag).isDirectory();
Function _init
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
_init() {
var profiles = BagItProfile.list(null, {
limit: 0,
offset: 0,
orderBy: 'name',
Function _processResponses
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
_processResponses(controller) {
let form = new SettingsResponseForm(importedSettings);
let responses = form.getResponses();
let hasEmptyAnswers = false;
let errors = '';
Function _validatePayloadOxum
has 26 lines of code (exceeds 25 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) {
Function list
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
list() {
var fsReader = this;
var stream = readdirp(fsReader.pathToDirectory, OPTS);
fsReader.fileCount = 0;
fsReader.dirCount = 0;