Showing 291 of 291 total issues
Function EcMaker
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.EcMaker = function () {
var fs = require('fs-extra');
var path = require('path');
var ecmaker = require('../../lib/ecmake.js');
var outpath;
Function exports
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function (logFormat, laxist) {
var usedProperties = [];
var parameters = {
'%h': {property: 'host', regexp: '([a-zA-Z0-9.\\-:]+(?:, ?[a-zA-Z0-9.\\-:]+)*)'},
'%u': {property: 'login', regexp: '([a-zA-Z0-9@.\\-_%,=]+)'},
Function exports
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function (logFormat, laxist) {
var usedProperties = [];
var parameters = {
'%h': {property: 'host', regexp: '([a-zA-Z0-9.\\-:]+(?:, ?[a-zA-Z0-9.\\-:]+)*)'},
'%l': {property: 'identd', regexp: '([a-zA-Z0-9\\-]+)'},
Function Writer
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
var Writer = function (outputStream, outputFields) {
var self = this;
outputFields = outputFields || [];
outputStream.on('drain', function () {
- 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 getHeaders
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
function getHeaders (settings) {
if (!settings) { return {}; }
const headers = {};
if (settings.outputFormat) { headers['Accept'] = settings.outputFormat; }
- 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 csvExtractor
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.csvExtractor = function () {
var csvextractor = require('../../lib/csvextractor.js');
var yargs = require('yargs')
.usage('Parse a csv source into json.' +
'\n Usage: $0 [-sc] [-f string | -d string | -k string] [--no-header]')
Function logExtractor
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.logExtractor = function () {
var Lazy = require('lazy');
var fs = require('fs-extra');
var parser = require('../logparser.js');
Similar blocks of code found in 2 locations. Consider refactoring. Open
helpers.post('/', upmcLogFile, headers, function (err, res, body) {
if (!res) { throw new Error('ezPAARSE is not running'); }
if (err) { throw err; }
res.statusCode.should.equal(400, 'expected a status code of 400, got ' + res.statusCode);
- 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 82.
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
helpers.post('/', upmcLogFile, headers, function (err, res, body) {
if (!res) { throw new Error('ezPAARSE is not running'); }
if (err) { throw err; }
res.statusCode.should.equal(200, 'expected a status code of 200, got ' + res.statusCode);
- 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 82.
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 nextPlatform
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
function nextPlatform() {
var item = items.shift();
if (!item) { return console.log('\nDone, %d scrapers executed', executed); }
fs.stat(path.join(platformsDir, item), function (err, stat) {
Function isValid
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
exports.isValid = function (ec, job) {
const validCodes = new Set(['200', '304']);
const deniedCodes = new Set(['401', '403']);
const filterRedirs = job.hasOwnProperty('filterRedirs') ? job.filterRedirs : true;
const filterStatus = job.hasOwnProperty('filterStatus') ? job.filterStatus : true;
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (iconv.encodingExists(resCharset)) {
job.logger?.info('Charset for response : ' + resCharset);
job.outputCharset = resCharset;
} else {
job.logger?.warn('(response) Charset is not supported');
- 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 80.
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 (iconv.encodingExists(reqCharset)) {
job.logger?.info('Charset for request : ' + reqCharset);
job.inputCharset = reqCharset;
} else {
job.logger?.warn('(request) Charset is not supported');
- 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 80.
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 getISBN
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
self.getISBN = function (rid) {
var product, rest, calculatedKey;
var isbn = rid.replace(blocSep, '');
var result = {
Function hostLocalize
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.hostLocalize = function () {
var csvextractor = require('../../lib/csvextractor.js');
var hostlocalize = require('../../lib/hostlocalize.js');
require('sugar'); // add more methods to Objects (like merge)
var yargs = require('yargs')
Function csvTotalizer
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.csvTotalizer = function () {
// get the command line argument
// platform
var yargs = require('yargs')
.usage('Totalize fields from a CSV stream\n' +
Function getISSN
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
self.getISSN = function (rid) {
var issn = rid;
var product, rest, calculatedKey;
var result = {
'rid': rid, // identifier value
Function cache
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
function cache(collectionName) {
const collection = mongo.db.collection(collectionName);
if (!collection) { return null; }
File deduplication-test.js
has 256 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*eslint max-len: 0*/
/*global describe, it*/
'use strict';
var fs = require('fs');
Function PROCESS
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
async PROCESS ({ commit, rootState, dispatch }, formData) {
const headers = await dispatch('settings/GET_HEADERS', null, { root: true });
const abortController = new AbortController();
const jobID = uuidv1();