Showing 51 of 75 total issues
Function exports
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = (job, settings) => {
settings.logger.log(`[${job.uid}] setting up job...`);
try {
assert(validate(job) == true)
Function upload
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
const upload = (job, settings, src, params) => {
if (!params.host) throw new Error('FTP Host not provided.')
if (!params.port) throw new Error('FTP Port not provided.')
if (!params.user) throw new Error('FTP Username not provided.')
if (!params.password) throw new Error('FTP Password not provided.')
Consider simplifying this complex logical expression. Open
if (event == 'Job Cleanup') {
const events = Object.keys(cache.data)
for (let i = 0; i < events.length; i++) {
const combinedEvent = events[i]
Function exports
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = (job, settings, options/*, type */) => {
settings.logger.log(`[${job.uid}] starting action-encode action (ffmpeg)`)
return new Promise((resolve, reject) => {
const params = constructParams(job, settings, options);
Function validate
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
const validate = job => {
assert(job.uid, 'job must have uid');
assert(job.state, 'job must have state');
assert(job.template, 'job must have template object defined');
Function withEventEmitter
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
const withEventEmitter = (wrappedFetch, job, polling = NEXRENDER_JOB_POLLING) => {
const emitter = new EventEmitter();
const interval = setInterval(async () => {
try {
const updatedJob = await wrappedFetch(`/jobs/${job.uid}/status`)
- 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 wrappedFetch
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
const wrappedFetch = async (path, options) => {
options = options || {}
const defaultHeaders = {};
if (headers) {
Function exports
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = async (req, res) => {
const release = await mutex.acquire();
try{
console.log(`fetching a pickup job for a worker`)
Function buildParameterConfigurator
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
EnhancedScript.prototype.buildParameterConfigurator = function () {
const defaultGlobalValue = this.getStringifiedDefaultValue( this.defaults.global );
// const defaultFnValue = this.getDefaultValue( this.defaults.function );
const createParameterConfigurator = () => `
function ParameterConfigurator () {
Function exports
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = (job, settings) => {
settings.logger.log(`[${job.uid}] running script assemble...`);
const data = [];
const base = job.workpath;
Function init
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
const init = (settings) => {
settings = Object.assign({}, settings);
settings.logger = settings.logger || console;
settings.track = (...args) => track(settings, ...args);
settings.trackCombined = (event, params) => track(settings, event, { combined: true, ...params });
- 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 exports
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
module.exports = (job, settings) => {
settings.logger.log(`[${job.uid}] setting up job...`);
try {
assert(validate(job) == 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
Function constructParams
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
const constructParams = (job, settings, { preset, input, output, params }) => {
input = input || job.output;
if (!path.isAbsolute(output)) output = path.join(job.workpath, output);
- 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 uriDigitalOcean
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function uriDigitalOcean(src) {
const parsed = url.parse(src)
const result = parsed.host.match(/(([^.]+)\.)?([^.]+)\.digitaloceanspaces\.com/)
if (!result) {
Function upload
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
const upload = (job, settings, src, params) => {
if (!params.host) throw new Error("SFTP Host not provided.");
if (!params.port) throw new Error("SFTP Port not provided.");
if (!params.user) throw new Error("SFTP Username not provided.");
if (!params.password) throw new Error("SFTP Password not provided.");
Function upload
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
const upload = async (job, settings, src, params) => {
if (!params.url) throw new Error('Provider NX: URL not provided.')
const file = fs.createReadStream(src);
const fileSize = fs.statSync(src).size;
Function upload
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const upload = (job, settings, src, params, onProgress, onComplete) => {
const file = fs.createReadStream(src);
if (!params.endpoint && !params.region) {
return Promise.reject(new Error('S3 region or endpoint not provided.'))
- 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 parse
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
const parse = (data) => {
const string = ('' + data).replace(/;/g, ':'); /* sanitize string */
// Only execute startRegex if project start hasnt been found
const matchStart = isNaN(parseInt(projectStart)) ? startRegex.exec(string) : false;
Function EnhancedScript
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
dest,
src,
parameters = [],
keyword = "NX",
defaults = {
Function exports
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
module.exports = async (req, res) => {
const release = await mutex.acquire();
try{
console.log(`fetching a pickup job for a worker`)
- 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"