Skip to content

Commit 4358caf

Browse files
andris9claude
andcommitted
refactor: remove dead checks flagged by Code Quality analysis
Resolves the CodeQL code-quality findings shown in the Security and quality dashboard, with no behavior changes: - ses-transport: verify() assigned a fallback region that nothing read and passed a superfluous second argument to its single-parameter callback (js/useless-assignment-to-local, js/superfluous-trailing-arguments) - mime-types detectExtension(), smtp-connection _onData() and smtp-transport getAuth() rechecked values already guaranteed truthy by their guard clauses (js/trivial-conditional) Co-Authored-By: Claude Fable 5 <[email protected]>
1 parent cf5195c commit 4358caf

4 files changed

Lines changed: 7 additions & 9 deletions

File tree

‎lib/mime-funcs/mime-types.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2087,7 +2087,7 @@ module.exports = {
20872087
if (!mimeType) {
20882088
return defaultExtension;
20892089
}
2090-
const parts = (mimeType || '').toLowerCase().trim().split('/');
2090+
const parts = mimeType.toLowerCase().trim().split('/');
20912091
const rootType = parts.shift().trim();
20922092
const subType = parts.join('/').trim();
20932093

‎lib/ses-transport/index.js‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -219,15 +219,13 @@ class SESTransport extends EventEmitter {
219219
}
220220
};
221221

222-
this.getRegion((err, region) => {
223-
if (err || !region) {
224-
region = 'us-east-1';
225-
}
226-
222+
// the region value is not used for anything when verifying, but the lookup
223+
// exercises the client configuration the same way as send() does
224+
this.getRegion(() => {
227225
const command = new this.ses.SendEmailCommand(sesMessage);
228226
const sendPromise = this.ses.sesClient.send(command);
229227

230-
sendPromise.then(data => cb(null, data)).catch(err => cb(err));
228+
sendPromise.then(() => cb(null)).catch(err => cb(err));
231229
});
232230

233231
return promise;

‎lib/smtp-connection/index.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,7 @@ class SMTPConnection extends EventEmitter {
838838
return;
839839
}
840840

841-
let data = (chunk || '').toString('binary');
841+
let data = chunk.toString('binary');
842842
let lines = (this._remainder + data).split(/\r?\n/);
843843
let lastline;
844844

‎lib/smtp-transport/index.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class SMTPTransport extends EventEmitter {
8383
const authData = Object.assign(
8484
{},
8585
this.options.auth && typeof this.options.auth === 'object' ? this.options.auth : {},
86-
authOpts && typeof authOpts === 'object' ? authOpts : {}
86+
typeof authOpts === 'object' ? authOpts : {}
8787
);
8888

8989
if (Object.keys(authData).length === 0) {

0 commit comments

Comments
 (0)