Function knownHostsTransport
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
const knownHostsTransport = function (settings = undefined, url = undefined) {
let service, user, password;
const hasSettings = settings && Object.keys(settings).length;
Function getTransport
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
const getTransport = function () {
const packageSettings = Meteor.settings.packages?.email || {};
// We delay this check until the first call to Email.send, in case someone
// set process.env.MAIL_URL in startup code. Then we store in a cache until
// process.env.MAIL_URL changes.
- 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 sendAsync
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Email.sendAsync = async function (options) {
const email = options.mailComposer ? options.mailComposer.mail : options;
let send = true;
Consider simplifying this complex logical expression. Open
if (
(packageSettings.service && wellKnow(packageSettings.service)) ||
(url && wellKnow(new URL(url).hostname)) ||
wellKnow(url?.split(':')[0] || '')
) {
Function knownHostsTransport
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const knownHostsTransport = function (settings = undefined, url = undefined) {
let service, user, password;
const hasSettings = settings && Object.keys(settings).length;
- 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 sendAsync
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Email.sendAsync = async function (options) {
const email = options.mailComposer ? options.mailComposer.mail : options;
let send = 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 makeTransport
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const makeTransport = function (mailUrlString) {
const mailUrl = new URL(mailUrlString);
if (mailUrl.protocol !== 'smtp:' && mailUrl.protocol !== 'smtps:') {
throw new Error(
- 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"