Showing 96 of 188 total issues
Function setDnsVerifyRoutes
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const setDnsVerifyRoutes = (app: FastifyInstance) => {
app.get("/api/website/dns", async (req, res) => {
const userId = validateUserRequest(req);
// check to see if dns if verified
File auth.ts
has 272 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { request } from "https";
import { createUser } from "../../core/controllers/users/set";
import {
cancelSubscription,
runUserChecks,
Function getDataUntil
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
const getDataUntil = async (
baseProps: ScoreProps & { resolve: Resolver },
offset?: number,
prevIssuesInfo?: any
): Promise<void> => {
Function getReport
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
export const getReport = async (url: string, userId?: number) => {
if (!url) {
return { website: undefined };
}
const authenticated = typeof userId !== "undefined";
- 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 crawlPage
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
export const crawlPage = async (
crawlConfig: CrawlConfig,
sendEmail?: boolean, // determine if email should be sent based on results
blockEvent?: boolean // block event from emitting to protect crawl interfere
): Promise<ResponseModel> => {
- 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 verifyUser
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
const verifyUser = async ({
password,
email,
googleId,
githubId,
- 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 stripeHook
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
export const stripeHook = async (req, res) => {
let event: Stripe.Event;
try {
event = await stripe.webhooks.constructEventAsync(
- 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 priceHandler
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const priceHandler = (plan: string, yearly?: boolean) => {
const q = (plan && typeof plan === "string" && plan.toUpperCase()) || "";
let price = 0;
switch (q) {
Function downloadToExcel
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
const downloadToExcel = async (
_req: FastifyContext["request"],
res: FastifyContext["reply"],
data: Issue | any
) => {
Function roleHandler
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const roleHandler = (plan: string) => {
const q = (plan && typeof plan === "string" && plan.toUpperCase()) || "";
let role = 0;
switch (q) {
Function crawlStream
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const crawlStream = async (
req: FastifyContext["request"],
res: FastifyContext["reply"],
slim?: boolean
) => {
Function crawlHttpStreamSlim
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const crawlHttpStreamSlim = (
props: CrawlParams,
res: FastifyContext["reply"],
removeTrailing: boolean = true
): Promise<boolean> => {
Function updateScanAttempt
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
export const updateScanAttempt = async ({
userId,
user,
collection,
}: {
- 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 scanWebsite
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
scanWebsite: async (parent, args, context, info) => {
const { url } = args;
const { keyid } = context.user?.payload || defaultPayload;
const unauth = typeof keyid === "undefined";
- 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 getWebsiteReport
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const getWebsiteReport = async (
req: FastifyContext["request"],
res: FastifyContext["reply"]
) => {
const download = paramParser(req, "download");
Function scanWebsite
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
scanWebsite: async (parent, args, context, info) => {
const { url } = args;
const { keyid } = context.user?.payload || defaultPayload;
const unauth = typeof keyid === "undefined";
Function pageUpdate
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const pageUpdate = async (
call: ServerWritableStream<
{ domain: string; url: string; user_id: number; insight: any },
{}
>,
Function scanSimple
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const scanSimple = async (
req: FastifyContext["request"],
res: FastifyContext["reply"]
) => {
const baseUrl = paramParser(req, "websiteUrl") || paramParser(req, "url");
Function websiteWatch
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function websiteWatch(pages: Website[] = []): Promise<void> {
for (const website of pages) {
const { userId, url, subdomains, tld, ua, proxy, monitoringEnabled } =
website;
Function getPagesPaging
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
export const getPagesPaging = async (
{
userId,
domain,
limit = 5,
- 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"