Showing 580 of 800 total issues
Function SelectableElement
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
const SelectableElement = ({
element,
name,
onSelect,
}: {
- 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 ProjectIdFixModal
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
export const ProjectIdFixModal = ({ visible, onClose, projectId }: Props) => {
const [copied, setCopied] = React.useState(false);
const onCopy = React.useCallback(() => {
if (projectId) {
- 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 useNavigationButton
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
export function useNavigationButton(
props: NavigationButtonProps,
): NavigationButtonValues {
const navigation = useNavigation();
const routerType = useRouterType();
- 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 defaultLayout
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
const defaultLayout = (j: JSCodeshift, root: Collection<any>) => {
const refineElement = root.find(j.JSXElement, {
openingElement: {
name: {
name: "Refine",
Function relationHooksCode
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
.map((field) => {
if (field?.relation && !field.fieldable && field.resource) {
imports.push(["useSelect", "@refinedev/core"]);
let val = accessor(recordName, field.key, field.accessor, false);
Function relationHooksCode
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
.map((field) => {
if (field?.relation && !field.fieldable && field.resource) {
imports.push(["useSelect", "@refinedev/core"]);
let val = accessor(recordName, field.key, field.accessor, false);
Function imageFields
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
const imageFields = (field: InferField) => {
if (field.type === "image") {
imports.push(["Image", "@mantine/core"]);
if (field.multiple) {
Function dateFields
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
const dateFields = (field: InferField) => {
if (field.type === "date") {
imports.push(["DateField", "@refinedev/mantine"]);
if (field.multiple) {
Function urlFields
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
const urlFields = (field: InferField) => {
if (field.type === "url") {
imports.push(
["TagField", "@refinedev/antd"],
["UrlField", "@refinedev/antd"],
Function booleanFields
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
const booleanFields = (field: InferField) => {
if (field.type === "boolean") {
imports.push(
["TagField", "@refinedev/antd"],
["BooleanField", "@refinedev/antd"],
Function Onboarding
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const Onboarding = () => {
return (
<div
className={clsx(
"re-min-h-screen re-w-full",
Function Login
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const Login = () => {
return (
<div
className={clsx(
"re-min-h-screen re-w-full",
Function subscribe
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
subscribe({ callback, params, meta }) {
const { resource, subscriptionType } = params ?? {};
if (!meta || !subscriptionType || !resource) {
throw new Error(
Function textFields
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
const textFields = (field: InferField) => {
if (field.type === "text") {
imports.push(
["TagField", "@refinedev/antd"],
["TextField", "@refinedev/antd"],
Function paginationProperties
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
(prop) => {
const property = (
p.node.arguments[0] as ObjectExpression
).properties.find(
(p: Property) => (p.key as Identifier).name === prop,
Function booleanFields
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
const booleanFields = (field: InferField) => {
if (field.type === "boolean") {
imports.push(["Checkbox", "@chakra-ui/react"]);
if (field.multiple) {
Function mergedImports
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
([importPath, importMatches]) => {
// example: A
const defaultImport = importMatches.find(
(importMatch) => importMatch.defaultImport,
);
Function gitInit
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function gitInit(root: string, message: string) {
let didInit = false;
try {
execa.commandSync("git --version", { stdio: "ignore", cwd: root });
Function generateDefaultDocumentTitle
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function generateDefaultDocumentTitle(
translate: ReturnType<typeof useTranslate>,
resource?: IResourceItem,
action?: string,
id?: string,
Function serveWs
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const serveWs = (
server: http.Server<typeof http.IncomingMessage, typeof http.ServerResponse>,
onError: () => void,
) => {
const ws = new WebSocket.Server({ server }).on("error", (error: any) => {