Skip to content

Commit

Permalink
Remove comments where they echoed adjacent naming
Browse files Browse the repository at this point in the history
  • Loading branch information
danyalaytekin committed Nov 8, 2023
1 parent 9bcefa1 commit 8736afb
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 26 deletions.
1 change: 0 additions & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ const {MongoClient} = require('mongodb');

module.exports = initApp;

// Initialise the application
function initApp(config, callback) {

const app = {
Expand Down
10 changes: 2 additions & 8 deletions model/result.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ module.exports = function(app, callback) {
});
},

// Default filter options

_defaultFilterOpts(opts) {
const now = Date.now();
const thirtyDaysAgo = now - (1000 * 60 * 60 * 24 * 30);
Expand All @@ -57,7 +57,7 @@ module.exports = function(app, callback) {
};
},

// Get results

_getFiltered(opts) {
opts = model._defaultFilterOpts(opts);
const filter = {
Expand All @@ -84,13 +84,11 @@ module.exports = function(app, callback) {
});
},

// Get results for all tasks
getAll(opts) {
delete opts.task;
return model._getFiltered(opts);
},

// Get a result by ID
getById(id, full) {
const prepare = (full ? model.prepareForFullOutput : model.prepareForOutput);
try {
Expand All @@ -112,13 +110,11 @@ module.exports = function(app, callback) {
});
},

// Get results for a single task
getByTaskId(id, opts) {
opts.task = id;
return model._getFiltered(opts);
},

// Delete results for a single task
deleteByTaskId(id) {
try {
id = new ObjectID(id);
Expand All @@ -134,7 +130,6 @@ module.exports = function(app, callback) {
});
},

// Get a result by ID and task ID
getByIdAndTaskId(id, task, opts) {
const prepare = (opts.full ? model.prepareForFullOutput : model.prepareForOutput);

Expand Down Expand Up @@ -162,7 +157,6 @@ module.exports = function(app, callback) {
});
},

// Prepare a result for output
prepareForOutput(result) {
result = model.prepareForFullOutput(result);
delete result.results;
Expand Down
9 changes: 0 additions & 9 deletions model/task.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ const {grey} = require('kleur');
const {ObjectID} = require('mongodb');
const pa11y = require('pa11y');

// Task model
module.exports = function(app, callback) {
app.db.collection('tasks', async (errors, collection) => {
await collection.createIndex({
Expand All @@ -33,7 +32,6 @@ module.exports = function(app, callback) {

collection,

// Create a task
create: function(newTask) {

Check warning on line 35 in model/task.js

View workflow job for this annotation

GitHub Actions / test (18)

Expected method shorthand

Check warning on line 35 in model/task.js

View workflow job for this annotation

GitHub Actions / test (20)

Expected method shorthand
newTask.headers = model.sanitizeHeaderInput(newTask.headers);

Expand All @@ -47,7 +45,6 @@ module.exports = function(app, callback) {
});
},

// Get all tasks
getAll: () => {
return collection
.find()
Expand All @@ -66,7 +63,6 @@ module.exports = function(app, callback) {
});
},

// Get a task by ID
getById: id => {
try {
id = new ObjectID(id);
Expand All @@ -86,7 +82,6 @@ module.exports = function(app, callback) {
});
},

// Edit a task by ID
editById: function(id, edits) {

Check warning on line 85 in model/task.js

View workflow job for this annotation

GitHub Actions / test (18)

Expected method shorthand

Check warning on line 85 in model/task.js

View workflow job for this annotation

GitHub Actions / test (20)

Expected method shorthand
const idString = id;
try {
Expand Down Expand Up @@ -136,7 +131,6 @@ module.exports = function(app, callback) {
});
},

// Add an annotation to a task
addAnnotationById: function(id, annotation) {

Check warning on line 134 in model/task.js

View workflow job for this annotation

GitHub Actions / test (18)

Expected method shorthand

Check warning on line 134 in model/task.js

View workflow job for this annotation

GitHub Actions / test (20)

Expected method shorthand
return model.getById(id)
.then(task => {
Expand All @@ -156,7 +150,6 @@ module.exports = function(app, callback) {
});
},

// Delete a task by ID
deleteById: function(id) {

Check warning on line 153 in model/task.js

View workflow job for this annotation

GitHub Actions / test (18)

Expected method shorthand

Check warning on line 153 in model/task.js

View workflow job for this annotation

GitHub Actions / test (20)

Expected method shorthand
try {
id = new ObjectID(id);
Expand All @@ -175,7 +168,6 @@ module.exports = function(app, callback) {
});
},

// Run a task by ID
runById: function(id) {

Check warning on line 171 in model/task.js

View workflow job for this annotation

GitHub Actions / test (18)

Expected method shorthand

Check warning on line 171 in model/task.js

View workflow job for this annotation

GitHub Actions / test (20)

Expected method shorthand
return model.getById(id).then(async task => {

Check warning on line 172 in model/task.js

View workflow job for this annotation

GitHub Actions / test (18)

Async arrow function has a complexity of 10. Maximum allowed is 6

Check warning on line 172 in model/task.js

View workflow job for this annotation

GitHub Actions / test (20)

Async arrow function has a complexity of 10. Maximum allowed is 6
const pa11yOptions = {
Expand Down Expand Up @@ -223,7 +215,6 @@ module.exports = function(app, callback) {
});
},

// Prepare a task for output
prepareForOutput: function(task) {

Check warning on line 218 in model/task.js

View workflow job for this annotation

GitHub Actions / test (18)

Expected method shorthand

Check warning on line 218 in model/task.js

View workflow job for this annotation

GitHub Actions / test (18)

Method 'prepareForOutput' has too many statements (19). Maximum allowed is 15

Check warning on line 218 in model/task.js

View workflow job for this annotation

GitHub Actions / test (20)

Expected method shorthand

Check warning on line 218 in model/task.js

View workflow job for this annotation

GitHub Actions / test (20)

Method 'prepareForOutput' has too many statements (19). Maximum allowed is 15
if (!task) {
return null;
Expand Down
3 changes: 0 additions & 3 deletions task/pa11y.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ const {CronJob} = require('cron');
module.exports = initTask;
exports.runPa11yOnTasks = runPa11yOnTasks;

// Initialise the task
function initTask(config, app) {
if (!config.cron) {
config.cron = '0 30 0 * * *'; // 00:30 daily
Expand All @@ -30,7 +29,6 @@ function initTask(config, app) {
job.start();
}

// Runs the task
async function taskRunner(app) {
console.log('');
console.log(grey('Starting to run task @ %s'), new Date());
Expand All @@ -45,7 +43,6 @@ async function taskRunner(app) {
}
}

// Runs an array of pa11y tasks
function runPa11yOnTasks(tasks, app) {
if (tasks.length === 0) {
console.log('No pa11y tasks to run');
Expand Down
1 change: 0 additions & 1 deletion test/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';

// Clone the main config
const config = module.exports = JSON.parse(JSON.stringify(require('../.eslintrc')));

// We use `this` all over the integration tests
Expand Down
1 change: 0 additions & 1 deletion test/integration/helper/navigate.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const request = require('request');

module.exports = createNavigator;

// Create a navigate function
function createNavigator(baseUrl, store) {
return function(opts, callback) {

Expand Down
3 changes: 0 additions & 3 deletions test/integration/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ const request = require('request');

const errorCodeForNoService = 2;

// Run before all tests
before(function(done) {
this.baseUrl = `http://0.0.0.0:${config.port}/`;
this.app = null;
Expand All @@ -38,12 +37,10 @@ before(function(done) {
});
});

// Run after each test
afterEach(done => {
loadFixtures('test', config, done);
});

// Check that the test application is running, and exit if not
function assertTestAppIsRunning(baseUrl, done) {
request(baseUrl, error => {
if (error) {
Expand Down

0 comments on commit 8736afb

Please sign in to comment.