Showing 166 of 237 total issues
Identical blocks of code found in 2 locations. Consider refactoring. Open
try {
var reader = fs.createReadStream(data.bagItFile.absSourcePath);
reader.on('error', function(err) {
data.errFn(err);
- 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
Similar blocks of code found in 3 locations. Consider refactoring. Open
constructor(params) {
super(params, 'Jobs');
this.model = Job;
this.job = Job.find(this.params.get('id'));
}
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (data.action == 'fileAdded') {
let shortName = Util.trimToLength(data.msg, 80, 'middle');
detailDiv.text(Context.y18n.__('Added file %s', shortName));
this.setProgressBar(progressBar, data);
} else if (data.action == 'completed') {
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (data.action == 'checksum') {
let shortName = Util.trimToLength(data.msg, 80, 'middle');
detailDiv.text(Context.y18n.__('Validating %s', shortName));
this.setProgressBar(progressBar, data);
} else if (data.action == 'completed') {
- 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
Similar blocks of code found in 3 locations. Consider refactoring. Open
constructor(params) {
super(params, 'Jobs');
this.model = Job;
this.job = Job.find(this.params.get('id'));
}
- 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
Similar blocks of code found in 3 locations. Consider refactoring. Open
constructor(params) {
super(params, 'Jobs');
this.model = Job;
this.job = Job.find(this.params.get('id'));
}
- 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
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
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,