Function sync
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
export async function sync(obj, type, { force } = { force: false }) {
if (config.ENVIRONMENT !== "production" && !force) {
logger.debug("no sync brevo");
return;
}
- 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 sendTemplate
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
export async function sendTemplate(id: string, { params, emailTo, cc, bcc, attachment }: SendMailParameters, options: SendTemplateOptions = {}) {
try {
if (!id) throw new Error("No template id provided");
if (!options.force && config.get("MAIL_TRANSPORT") === "SMTP") {
- 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 sendEmail
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export async function sendEmail(to: Email[], subject: string, htmlContent, { params, attachment, cc, bcc }: Omit<SendMailParameters, "emailTo"> = {}) {
try {
if (config.get("MAIL_TRANSPORT") === "SMTP") {
await sendMailCatcher(subject, htmlContent, { emailTo: to, cc, bcc, attachment });
return;
- 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 api
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const api = async (path, options: any = {}, force?: boolean) => {
try {
if (!config.ENABLE_SENDINBLUE && !force) {
logger.warn("Not possible to use BREVO api as ENABLE_SENDINBLUE is disabled");
return;
- 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"