Showing 58 of 116 total issues
Function setup
has 331 lines of code (exceeds 25 allowed). Consider refactoring. Open
async setup(
{ flags, resources, fullStatic, fallback, paywall, seo, isViewable: isViewablePath, previewParagraph },
nuxt,
) {
const resolver = createResolver(import.meta.url)
File module.ts
has 541 lines of code (exceeds 250 allowed). Consider refactoring. Open
import process from 'node:process'
import type { Resolver } from '@nuxt/kit'
import {
addComponent,
addComponentsDir,
Function bundle
has 118 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function bundle(path: string, vuefileName: string, layoutName: string, dir: string, ssr?: boolean) {
process.env.NODE_ENV = 'production'
const name = snakeCase(basename(vuefileName, '.vue'))
const rollupOptions = createConfig(name, dir, ssr)
const config = await loadNuxtConfigOnce()
Function useArticleLoader
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
export function useArticleLoader<UseChunk extends false | number>({
chunk,
condition: conditionInput = usePageMetaAsCondition(),
preload = chunk || 0,
exclude = usePageMetaAsExclude(),
- 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
File article.ts
has 343 lines of code (exceeds 250 allowed). Consider refactoring. Open
import util from 'node:util'
import type { ZodError } from 'zod'
import { gql } from '@apollo/client/core/index.js'
import type { SearchResponse } from '@storipress/typesense-xior'
Function setup
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
async setup(
{ flags, resources, fullStatic, fallback, paywall, seo, isViewable: isViewablePath, previewParagraph },
nuxt,
) {
const resolver = createResolver(import.meta.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 createStoripressBaseClient
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function createStoripressBaseClient(
apollo: Apollo,
getHeaders: () => Record<string, string | null | undefined>,
uri: string,
opt: CreateBaseClientInput = {},
Function convertToOption
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
export function convertToOption(
resource: Resources,
parts: URLPart[],
staticParams = {},
): ResourcePage<BaseMeta, RouteOptionsContext> {
- 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
File parser.spec.ts
has 277 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { expect, it } from 'vitest'
import { parse, toRoute } from '../parser'
it('parse url work', () => {
expect(parse('/posts/{slug}')).toMatchInlineSnapshot(`
Function getDefineArticle
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getDefineArticle(pageMeta: PageMeta, site: Site) {
const siteConfig = useSiteConfig()
const siteUrl = withoutTrailingSlash(siteConfig.url)
const article: Article = pageMeta.meta
const authors = article.authors.map((author) => {
File seo-preset.spec.ts
has 260 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { expect, it } from 'vitest'
import { identity, reduce } from 'remeda'
import type { SEOContext } from '../seo-preset'
import { resolveSEOPresets } from '../seo-preset'
import type { BaseMeta, ResourcePage } from '../../types'
Function useResourceList
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function useResourceList<Type extends Resources, Return = ResourceIDWithURL<Type>>(
resource: Type,
opt: UseResourceListOptions<Type, Return> = {},
): AsyncData<Return[], true | null> {
if (opt.withoutAsyncData) {
File front-page.ts
has 258 lines of code (exceeds 250 allowed). Consider refactoring. Open
import type { Ref } from 'vue'
import { warn } from 'vue'
import { hash } from 'ohash'
import type { MaybeRef } from '@vueuse/core'
import type { Promisable } from 'type-fest'
Function normalizeArticle
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function normalizeArticle(article: RawArticleLike | TypesenseArticleLike) {
const {
title,
blurb,
seo,
Function tapClient
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
const tapClient = new ApolloLink((operation, forward) => {
const id = crypto.randomUUID()
operation.setContext({
karbonTracing: id,
Function useRenderEditorBlock
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
export function useRenderEditorBlock(blocks: Record<string, Component>) {
return {
async render(fields: Record<string, unknown[]>, { uuid, name }: { uuid: string; name: string }) {
const element = document.querySelector(`div[data-uuid="${uuid}"]`)
if (element && !Reflect.get(element, IS_RENDERED)) {
- 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 useLoadMore
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
export function useLoadMore<T>(GeneratorSource: () => AsyncGenerator<T>, option?: LoadMoreOptions) {
const { preload } = option ?? {}
const loading = ref(false)
const isDone = ref(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 useLoadMore
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function useLoadMore<T>(GeneratorSource: () => AsyncGenerator<T>, option?: LoadMoreOptions) {
const { preload } = option ?? {}
const loading = ref(false)
const isDone = ref(false)
Function compress
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function compress() {
await fs.remove(siteTemplateName)
const files = await globby(
[
Function convertToOption
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function convertToOption(
resource: Resources,
parts: URLPart[],
staticParams = {},
): ResourcePage<BaseMeta, RouteOptionsContext> {