Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
benzekrimaha committed Jan 9, 2025
1 parent e3c7e33 commit 76539d6
Show file tree
Hide file tree
Showing 92 changed files with 780 additions and 621 deletions.
5 changes: 3 additions & 2 deletions .github/dockerfiles/mongodb/conf/initReplicaSet.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* eslint-disable no-undef */
rs.initiate({
_id: "rs0",
members: [{ _id: 0, host: "127.0.0.1:27018" }]
_id: 'rs0',
members: [{ _id: 0, host: '127.0.0.1:27018' }]
});
2 changes: 1 addition & 1 deletion bin/backbeat.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict'; // eslint-disable-line strict
'use strict';

const werelogs = require('werelogs');

Expand Down
48 changes: 33 additions & 15 deletions .eslintrc → eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,28 @@
{
"extends": "scality",
"parserOptions": {
"ecmaVersion": 2020
import mocha from "eslint-plugin-mocha";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});

export default [...compat.extends("scality"), {
plugins: {
mocha,
},
"plugins": [
"mocha"
],
"rules": {

languageOptions: {
ecmaVersion: 2020,
sourceType: "script",
},

rules: {
"object-curly-newline": "off",
"import/newline-after-import": "off",
"import/order": "off",
Expand Down Expand Up @@ -37,13 +53,15 @@
"no-undef-init": "off",
"newline-per-chained-call": "off",
"no-useless-escape": "off",
"no-redeclare":"off",
"mocha/no-exclusive-tests": "error"
},
"settings": {
"import/resolver": {
"node": {
"paths": ["/backbeat/node_modules", "node_modules"]
}

settings: {
'import/resolver': {
node: {
paths: ["/backbeat/node_modules", "node_modules"]
}
}
}
}
},
}];
2 changes: 1 addition & 1 deletion extensions/gc/GarbageCollector.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict'; // eslint-disable-line
'use strict';

const { EventEmitter } = require('events');

Expand Down
2 changes: 1 addition & 1 deletion extensions/gc/GarbageCollectorProducer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict'; // eslint-disable-line strict
'use strict';

const { Logger } = require('werelogs');

Expand Down
2 changes: 1 addition & 1 deletion extensions/gc/service.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict'; // eslint-disable-line
'use strict';

const { errors } = require('arsenal');
const werelogs = require('werelogs');
Expand Down
2 changes: 1 addition & 1 deletion extensions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fs.readdirSync(__dirname).forEach(moduleDir => {
try {
indexStat = fs.statSync(
path.join(__dirname, moduleDir, 'index.js'));
} catch (err) {} // eslint-disable-line no-empty
} catch {} // eslint-disable-line no-empty
if (indexStat) {
extensions[moduleDir] = require(`./${moduleDir}`);
}
Expand Down
2 changes: 1 addition & 1 deletion extensions/ingestion/IngestionQueuePopulator.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class IngestionQueuePopulator extends QueuePopulatorExtension {
try {
const metaHeaders = JSON.parse(userMD);
existingIDHeader = metaHeaders[zenkoIDHeader];
} catch (err) {
} catch {
this.log.trace('malformed user metadata', {
method: 'IngestionQueuePopulator.filter',
bucket: entry.bucket,
Expand Down
2 changes: 1 addition & 1 deletion extensions/ingestion/constants.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict'; // eslint-disable-line
'use strict';

const testIsOn = process.env.CI === 'true';

Expand Down
2 changes: 1 addition & 1 deletion extensions/lifecycle/LifecycleQueuePopulator.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const { mpuBucketPrefix } = constants;
const QueuePopulatorExtension =
require('../../lib/queuePopulator/QueuePopulatorExtension');
const { authTypeAssumeRole } = require('../../lib/constants');
const uuid = require('uuid/v4');
const { v4: uuid } = require('uuid');
const safeJsonParse = require('./util/safeJsonParse');
const { LifecycleMetrics } = require('./LifecycleMetrics');
const LIFECYCLE_BUCKETS_ZK_PATH = '/data/buckets';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict'; // eslint-disable-line
'use strict';

const async = require('async');
const { Logger } = require('werelogs');
Expand Down
2 changes: 1 addition & 1 deletion extensions/lifecycle/bucketProcessor/task.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict'; // eslint-disable-line
'use strict';

const async = require('async');
const werelogs = require('werelogs');
Expand Down
2 changes: 1 addition & 1 deletion extensions/lifecycle/conductor/LifecycleConductor.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict'; // eslint-disable-line
'use strict';

const async = require('async');
const schedule = require('node-schedule');
Expand Down
2 changes: 1 addition & 1 deletion extensions/lifecycle/conductor/service.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict'; // eslint-disable-line
'use strict';

const async = require('async');
const werelogs = require('werelogs');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict'; // eslint-disable-line
'use strict';

const LifecycleObjectProcessor = require('./LifecycleObjectProcessor');
const LifecycleDeleteObjectTask =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict'; // eslint-disable-line
'use strict';

const { EventEmitter } = require('events');
const Logger = require('werelogs').Logger;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict'; // eslint-disable-line
'use strict';
const assert = require('assert');
const async = require('async');

Expand Down
2 changes: 1 addition & 1 deletion extensions/lifecycle/objectProcessor/task.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict'; // eslint-disable-line
'use strict';

const async = require('async');
const werelogs = require('werelogs');
Expand Down
2 changes: 1 addition & 1 deletion extensions/lifecycle/tasks/LifecycleRequeueTask.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict'; // eslint-disable-line
'use strict';

const async = require('async');

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict'; // eslint-disable-line
'use strict';

const { LifecycleRequeueTask } = require('./LifecycleRequeueTask');

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict'; // eslint-disable-line
'use strict';

const { LifecycleRequeueTask } = require('./LifecycleRequeueTask');

Expand Down
2 changes: 1 addition & 1 deletion extensions/lifecycle/tasks/LifecycleTask.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict'; // eslint-disable-line
'use strict';

const async = require('async');
const { errors, versioning } = require('arsenal');
Expand Down
2 changes: 1 addition & 1 deletion extensions/lifecycle/tasks/LifecycleTaskV2.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict'; // eslint-disable-line
'use strict';

const async = require('async');
const { errors } = require('arsenal');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ class LifecycleUpdateTransitionTask extends BackbeatTask {
}
try {
assert.notDeepStrictEqual(oldLocation, newLocation);
} catch (err) {
} catch {
log.info('duplicate location update, skipping',
Object.assign({
method:
Expand Down
2 changes: 1 addition & 1 deletion extensions/mongoProcessor/MongoQueueProcessor.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict'; // eslint-disable-line
'use strict';

const async = require('async');

Expand Down
2 changes: 1 addition & 1 deletion extensions/mongoProcessor/constants.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict'; // eslint-disable-line
'use strict';


const constants = {
Expand Down
2 changes: 1 addition & 1 deletion extensions/mongoProcessor/mongoProcessorTask.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict'; // eslint-disable-line
'use strict';

const werelogs = require('werelogs');
const { errors } = require('arsenal');
Expand Down
2 changes: 1 addition & 1 deletion extensions/mongoProcessor/utils/BucketMemState.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict'; // eslint-disable-line
'use strict';

// get Bucket Info from Mongo for given location every 1 minute per consumer
const REFRESH_TIMER = 60000;
Expand Down
2 changes: 1 addition & 1 deletion extensions/mongoProcessor/utils/contentTypeHelper.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict'; // eslint-disable-line
'use strict';

function _getDataContent(entry) {
const contentLength = entry.getContentLength();
Expand Down
2 changes: 1 addition & 1 deletion extensions/notification/queueProcessor/QueueProcessor.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict'; // eslint-disable-line
'use strict';

const { EventEmitter } = require('events');
const Logger = require('werelogs').Logger;
Expand Down
2 changes: 1 addition & 1 deletion extensions/notification/queueProcessor/task.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict'; // eslint-disable-line
'use strict';
const assert = require('assert');
const { errors } = require('arsenal');
const async = require('async');
Expand Down
2 changes: 1 addition & 1 deletion extensions/notification/utils/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function getAuthFilePath(fileName) {
try {
fs.accessSync(path, fs.F_OK | fs.R_OK);
return path;
} catch (e) {
} catch {
return null;
}
}
Expand Down
2 changes: 1 addition & 1 deletion extensions/oplogPopulator/OplogPopulatorTask.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict'; // eslint-disable-line
'use strict';

const werelogs = require('werelogs');
const { errors } = require('arsenal');
Expand Down
2 changes: 1 addition & 1 deletion extensions/oplogPopulator/modules/Connector.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class Connector extends EventEmitter {
* @returns {undefined}
*/
updatePartitionName() {
this._config['offset.partition.name'] = `partition-${uuid.v4()}`;
this._config['offset.partition.name'] = `partition-${uuid()}`;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion extensions/oplogPopulator/modules/ConnectorsManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class ConnectorsManager extends EventEmitter {
* @returns {string} generated connector name
*/
_generateConnectorName() {
return `${this._prefix}${constants.defaultConnectorName}-${uuid.v4()}`;
return `${this._prefix}${constants.defaultConnectorName}-${uuid()}`;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion extensions/replication/constants.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict'; // eslint-disable-line
'use strict';

const testIsOn = process.env.CI === 'true';

Expand Down
2 changes: 1 addition & 1 deletion extensions/replication/failedCRR/FailedCRRConsumer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict'; // eslint-disable-line strict
'use strict';

const { StatsModel } = require('arsenal').metrics;
const Logger = require('werelogs').Logger;
Expand Down
2 changes: 1 addition & 1 deletion extensions/replication/failedCRR/FailedCRRProducer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict'; // eslint-disable-line strict
'use strict';

const { Logger } = require('werelogs');

Expand Down
2 changes: 1 addition & 1 deletion extensions/replication/queueProcessor/QueueProcessor.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict'; // eslint-disable-line
'use strict';

const async = require('async');
const { EventEmitter } = require('events');
Expand Down
2 changes: 1 addition & 1 deletion extensions/replication/queueProcessor/task.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict'; // eslint-disable-line
'use strict';
const async = require('async');
const assert = require('assert');
const werelogs = require('werelogs');
Expand Down
2 changes: 1 addition & 1 deletion extensions/replication/replay/ReplayProducer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict'; // eslint-disable-line strict
'use strict';

const { Logger } = require('werelogs');

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict'; // eslint-disable-line
'use strict';

const async = require('async');

Expand Down
2 changes: 1 addition & 1 deletion extensions/replication/replicationStatusProcessor/task.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict'; // eslint-disable-line
'use strict';

const werelogs = require('werelogs');

Expand Down
4 changes: 2 additions & 2 deletions extensions/replication/tasks/CopyLocationTask.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const async = require('async');
const uuid = require('uuid/v4');
const { v4: uuid } = require('uuid');

const { errors, jsutil, models } = require('arsenal');
const { ObjectMD } = models;
Expand Down Expand Up @@ -227,7 +227,7 @@ class CopyLocationTask extends BackbeatTask {
});
attachReqUids(sourceReq, log);
sourceReq.on('error', err => {
// eslint-disable-next-line no-param-reassign
if (err.statusCode === 404) {
log.error('the source object was not found', Object.assign({
method: 'CopyLocationTask._getAndPutObjectOnce',
Expand Down
2 changes: 1 addition & 1 deletion extensions/replication/tasks/MultipleBackendTask.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const async = require('async');
const uuid = require('uuid/v4');
const { v4: uuid } = require('uuid');

const errors = require('arsenal').errors;
const jsutil = require('arsenal').jsutil;
Expand Down
2 changes: 1 addition & 1 deletion extensions/replication/tasks/UpdateReplicationStatus.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ class UpdateReplicationStatus extends BackbeatTask {
const soureEntryTags = sourceEntry.getTags();
const refreshedEntryTags = refreshedEntry.getTags();
assert.deepStrictEqual(soureEntryTags, refreshedEntryTags);
} catch (e) {
} catch {
return refreshedEntry.toPendingEntry(sourceEntry.getSite());
}
return refreshedEntry.toCompletedEntry(sourceEntry.getSite());
Expand Down
4 changes: 2 additions & 2 deletions lib/BackbeatConsumer.js
Original file line number Diff line number Diff line change
Expand Up @@ -808,8 +808,8 @@ class BackbeatConsumer extends EventEmitter {
const self = this;
let lastBootstrapId;
let producer; // eslint-disable-line prefer-const
let producerTimer; // eslint-disable-line prefer-const
let consumerTimer; // eslint-disable-line prefer-const
let producerTimer;
let consumerTimer;
function consumeCb(err, messages) {
if (err) {
return undefined;
Expand Down
2 changes: 1 addition & 1 deletion lib/CircuitBreaker.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict'; // eslint-disable-line
'use strict';
/* eslint no-param-reassign: 0 */

const { ZenkoMetrics } = require('arsenal').metrics;
Expand Down
2 changes: 1 addition & 1 deletion lib/Config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict'; // eslint-disable-line
'use strict';

const assert = require('assert');
const { EventEmitter } = require('events');
Expand Down
Loading

0 comments on commit 76539d6

Please sign in to comment.