Showing 96 of 188 total issues
Function createIframe
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const createIframe = async (
req: FastifyContext["request"],
res: FastifyContext["reply"]
) => {
const baseUrl = req.query["url"] || req.query["websiteUrl"];
- 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 getWebsitesPaging
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export const getWebsitesPaging = async (
{ userId, limit = 3, offset = 0, insights = false },
chain?: boolean
): Promise<Website[] | [Website[], any]> => {
const webPages = (await websitesCollection
- 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 collectionUpsert
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export const collectionUpsert = async (
source: any,
[collection, shouldUpdate, shouldDelete]: [
Collection<Document>,
boolean | "upsert" | "many",
- 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 downloadToExcel
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const downloadToExcel = async (
_req: FastifyContext["request"],
res: FastifyContext["reply"],
data: Issue | any
) => {
- 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 scanSimple
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export const scanSimple = async (
req: FastifyContext["request"],
res: FastifyContext["reply"]
) => {
const baseUrl = paramParser(req, "websiteUrl") || paramParser(req, "url");
- 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 getUserFromToken
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export const getUserFromToken = (
bearerToken?: string
):
| null
| (Jwt & {
- 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
Avoid too many return
statements within this function. Open
return user;
Avoid too many return
statements within this function. Open
return res.status(200).send(verifiedProps);
Avoid too many return
statements within this function. Open
return await collection.updateOne(
queryParams,
{ $set: source },
{
upsert: shouldUpdate === "upsert",
Function setAuthRoutes
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const setAuthRoutes = (app: FastifyInstance) => {
app.post("/api/register", registerLimiter, async (req, res) => {
const allowed = await allowedNext(
req?.headers?.authorization || req.cookies.jwt,
req,
- 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 getServerConfig
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const getServerConfig = (
extra?: ApolloServerFastifyConfig
): ApolloServerFastifyConfig => {
const schema = createScheme();
- 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 initDbConnection
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const initDbConnection = async (dbconnection?: string) => {
client = await createClient(dbconnection);
if (client) {
try {
- 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 responseWrap
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const responseWrap = async (res: FastifyContext["reply"], source) => {
const { callback, userId } = source ?? {};
let message = HttpMessage.Ok;
let code = StatusCode.Ok;
- 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 watcherCrawl
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const watcherCrawl = async (
{
url,
userId,
scan = false,
- 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 getHostName
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const getHostName = (url: string) => {
if (!url) {
return "";
}
let q = decodeURIComponent(url);
- 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 statusBadge
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const statusBadge = async (
req: FastifyContext["request"],
res: FastifyContext["reply"]
) => {
const domain = (req.params as any)?.domain?.replace(".svg", "");
- 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"