Showing 812 of 823 total issues
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 getProjectType
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
export const getProjectType = (platform?: ProjectTypes): ProjectTypes => {
if (platform) {
return platform;
}
// read dependencies from package.json
- 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 mergedImports
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
([importPath, importMatches]) => {
// example: A
const defaultImport = importMatches.find(
(importMatch) => importMatch.defaultImport,
);
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,