Showing 580 of 800 total issues
Function urlFields
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const urlFields = (field: InferField) => {
if (field.type === "url") {
imports.push(["UrlField", "@refinedev/chakra-ui"]);
const id = `id: "${field.key}"`;
Function booleanFields
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const booleanFields = (field: InferField) => {
if (field?.type === "boolean") {
const id = `id: "${field.key}"`;
const accessorKey = getAccessorKey(field);
const header = `header: ${translatePrettyString({
Function dateFields
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const dateFields = (field: InferField) => {
if (field.type === "date") {
imports.push(["DateField", "@refinedev/chakra-ui"]);
const id = `id: "${field.key}"`;
Function dateFields
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const dateFields = (field: InferField) => {
if (field.type === "date") {
imports.push(["DateField", "@refinedev/mantine"]);
const id = `id: "${field.key}"`;
Function booleanFields
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const booleanFields = (field: InferField) => {
if (field?.type === "boolean") {
imports.push(["BooleanField", "@refinedev/chakra-ui"]);
const id = `id: "${field.key}"`;
Function booleanFields
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const booleanFields = (field: InferField) => {
if (field?.type === "boolean") {
imports.push(["BooleanField", "@refinedev/mantine"]);
const id = `id: "${field.key}"`;
Function LoadingComponent
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
() => {
const [dots, setDots] = React.useState(0);
React.useEffect(() => {
if (typeof window !== "undefined") {
Function ReadyPage
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const ReadyPage: React.FC<RefineReadyPageProps> = () => {
return (
<Row align="middle" justify="center" style={styles.root}>
<Col style={{ textAlign: "center" }}>
<img
Function postTransform
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export async function postTransform(files: any, flags: any) {
const rootDir = path.join(process.cwd(), files[0]);
const packageJsonPath = path.join(rootDir, "package.json");
const useYarn = checkPackageLock(rootDir) === "yarn.lock";
let packageJsonData;
Function richtextFields
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const richtextFields = (field: InferField) => {
if (field?.type === "richtext") {
imports.push(["MarkdownField", "@refinedev/mantine"]);
const id = `id: "${field.key}"`;
Function richtextFields
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const richtextFields = (field: InferField) => {
if (field?.type === "richtext") {
imports.push(["MarkdownField", "@refinedev/chakra-ui"]);
const id = `id: "${field.key}"`;
Function dateFields
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const dateFields = (field: InferField) => {
if (field.type === "date") {
imports.push(["DateField", "@refinedev/mui"]);
const fieldProperty = `field: "${field.key}"`;
Function richtextFields
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const richtextFields = (field: InferField) => {
if (field?.type === "richtext") {
imports.push(["MarkdownField", "@refinedev/mui"]);
const fieldProperty = `field: "${field.key}"`;
Function renderSection
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const renderSection = (key: keyof Filters) => {
const value = filters[key];
const mapValue = typeof value === "string" ? [value] : value;
if (!value || value.length === 0) {
Function addBreadcrumb
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const addBreadcrumb = (parentName: string | IResourceItem) => {
const parentResource =
typeof parentName === "string"
? pickResource(parentName, resources, routerType === "legacy") ?? {
name: parentName,
Function renameUseFormQueryResultAndMutationResult
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const renameUseFormQueryResultAndMutationResult = (
j: JSCodeshift,
source: Collection,
) => {
const renameProperties = (prop) => {
Function transformRefineOptions
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const transformRefineOptions = (
j: JSCodeshift,
root: Collection<any>,
projectId: string,
) => {
Function useNotificationProvider
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const useNotificationProvider = (): NotificationProvider => {
const { notification: notificationFromContext } = App.useApp();
const notification =
"open" in notificationFromContext
? notificationFromContext
Function useQuerySubscription
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
: (queryClient: QueryClient) => {
const { ws } = useContext(DevToolsContext);
const queryCacheSubscription = React.useRef<() => void>();
const mutationCacheSubscription = React.useRef<() => void>();
Function ProjectIdFixBanner
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
Open
export const ProjectIdFixBanner = () => {
const [projectId, setProjectId] = React.useState<string | null>(null);
const [modalVisible, setModalVisible] = React.useState(false);
const [status, setStatus] = React.useState<
"hidden" | "warning" | "fixing" | "success"
- 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"