Showing 96 of 188 total issues
Function crawlStream
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
export const crawlStream = async (
req: FastifyContext["request"],
res: FastifyContext["reply"],
slim?: boolean
) => {
- 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 getUserFromApiScan
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const getUserFromApiScan = async (
token: string = "",
_req: FastifyContext["request"],
res: FastifyContext["reply"]
): Promise<User> => {
Function validateEmail
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
export const validateEmail = async ({ code }) => {
if (code) {
const [user, collection] = await getUser({ emailConfirmCode: code });
if (user && isBefore(new Date(), new Date(user?.emailExpDate))) {
- 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 websiteWatch
has a Cognitive Complexity of 12 (exceeds 5 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;
- 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 allowedNext
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const allowedNext = (
token: string,
req: FastifyContext["request"],
res: FastifyContext["reply"],
mediaType?: "html" | "json"
Function registerApp
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const registerApp = async (app: FastifyInstance) => {
await app.register(cors, {
origin: true,
});
Function onAuthGithub
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
const onAuthGithub = (requestToken: string): Promise<any> => {
return new Promise((resolve, reject) => {
// TODO: shape with ttsc
const data = JSON.stringify({
client_id: clientID,
Function createServer
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const createServer = async () => {
const websiteProto = await loadProto(); // crawler handling proto
const coreProto = await loadProto("apicore.proto");
server = new Server();
Function getAnalyticsPaging
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
export const getAnalyticsPaging = async (
params,
chain?: boolean
): Promise<[Analytic[], Collection<Document>] | Analytic[]> => {
const { userId, domain, limit = 20, offset = 0, all = false } = params ?? {};
- 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 runUserChecks
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
export const runUserChecks = 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 verifyUserSend
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
export const verifyUserSend = async ({
userId,
confirmedOnly = false, // confirmed only requires user id - non marketing sending.
sendEmail = false, // conditional to determine email sending. Without having to use conditionals.
}: VerifySend) => {
- 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 setDnsVerifyRoutes
has a Cognitive Complexity of 11 (exceeds 5 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
- 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 getUserFromApiScan
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
export const getUserFromApiScan = async (
token: string = "",
_req: FastifyContext["request"],
res: FastifyContext["reply"]
): Promise<User> => {
- 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 coreCrawl
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
export const coreCrawl = async (call: ServerCallStreaming) => {
const { authorization, url, subdomains, tld, sitemap } = call.request;
const userNext = getUserFromToken(authorization); // get current user
const userId = userNext?.payload?.keyid;
- 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 a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
export const getWebsiteReport = async (
req: FastifyContext["request"],
res: FastifyContext["reply"]
) => {
const download = paramParser(req, "download");
- 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 sendMailMultiPage
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
const sendMailMultiPage = async ({
userId,
data,
domain,
sendEmail = 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 coreCrawl
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const coreCrawl = async (call: ServerCallStreaming) => {
const { authorization, url, subdomains, tld, sitemap } = call.request;
const userNext = getUserFromToken(authorization); // get current user
const userId = userNext?.payload?.keyid;
Function getWebParams
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const getWebParams = (req: FastifyContext["request"]) => {
const url = paramParser(req, "url");
const customHeaders = paramParser(req, "customHeaders");
const mobile = paramParser(req, "mobile");
const pageInsights = paramParser(req, "pageInsights");
Function getPageActionsPaging
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export const getPageActionsPaging = async (
{
userId,
domain,
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 crawlWebsite
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
crawlWebsite: async (_, { url }, context) => {
if (!url) {
return {
website: null,
code: StatusCode.NotFound,
- 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"