Showing 166 of 237 total issues
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;
Similar blocks of code found in 2 locations. Consider refactoring. Open
$('#container').on('click', 'table tr.repository-clickable-row', function(e) {
let url = $(this).data('url');
electron.shell.openExternal(url);
e.stopPropagation();
});
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 66.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
$('#container').on('click', 'div.local-file', function(e) {
let uri = $(this).data('url');
electron.shell.showItemInFolder(uri);
e.stopPropagation();
})
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 66.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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;
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;
Similar blocks of code found in 3 locations. Consider refactoring. Open
$('#dropZone').on('dragleave', function(e) {
e.preventDefault();
e.stopPropagation();
$(e.currentTarget).removeClass('drop-zone-over');
return false;
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 64.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
$('#dropZone').on('dragover', function(e) {
e.preventDefault();
e.stopPropagation();
$(e.currentTarget).addClass('drop-zone-over');
return false;
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 64.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
$('#dropZone').on('dragend', function(e) {
e.preventDefault();
e.stopPropagation();
$(e.currentTarget).removeClass('drop-zone-over');
return false;
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 64.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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?
Identical blocks of code found in 2 locations. Consider refactoring. Open
try {
_writeIntoArchive(data, done);
} catch (err) {
Context.logger.error(err);
Context.logger.error(err.stack);
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 61.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76