Showing 163 of 230 total issues
Function Sider
has 364 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const Sider: React.FC = () => {
const [collapsed, setCollapsed] = useState(false);
const [opened, setOpened] = useState(false);
const drawerWidth = () => {
Function dataProvider
has 297 lines of code (exceeds 25 allowed). Consider refactoring. Open
const dataProvider = (client: NhostClient): DataProvider => {
client;
return {
getOne: async ({ resource, id, metaData }) => {
const operation = `${metaData?.operation ?? resource}_by_pk`;
Function LoginPage
has 190 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const LoginPage: React.FC = () => {
const {
register,
handleSubmit,
formState: { errors },
Function dataProvider
has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring. Open
const dataProvider = (supabaseClient: SupabaseClient): DataProvider => {
return {
getList: async ({ resource, pagination, filters, sort, metaData }) => {
const current = pagination?.current || 1;
const pageSize = pagination?.pageSize || 10;
- 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 dataProvider
has 159 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const dataProvider = (appwriteClient: Appwrite): DataProvider => {
return {
//TODO: Fix typing
getList: async ({ resource, pagination, filters, sort }) => {
const current = pagination?.current ?? 1;
Function Sider
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
export const Sider: React.FC = () => {
const [collapsed, setCollapsed] = useState(false);
const [opened, setOpened] = useState(false);
const drawerWidth = () => {
- 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 ResourceComponentWrapper
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
export const ResourceComponentWrapper: React.FC<{ route: string }> = ({
route,
}) => {
const { catchAll } = useRefineContext();
const { useParams } = useRouterContext();
- 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 ResourceComponent
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
const ResourceComponent: React.FC<{ route: string }> = ({ route }) => {
const { catchAll } = useRefineContext();
const { useParams } = useRouterContext();
const { resources } = useResource();
- 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 renderTreeView
has 127 lines of code (exceeds 25 allowed). Consider refactoring. Open
const renderTreeView = (tree: ITreeMenu[], selectedKey: string) => {
return tree.map((item: ITreeMenu) => {
const { icon, label, route, name, children, parentName } = item;
const isOpen = open[route || ""] || false;
Function RouteHandler
has 127 lines of code (exceeds 25 allowed). Consider refactoring. Open
const RouteHandler = (val: IResourceItem): void => {
const { list, create, edit, show, canDelete, route, name, options } =
val;
const ListComponent = list;
Function LoginPage
has 125 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const LoginPage: React.FC = () => {
const [form] = Form.useForm<ILoginForm>();
const translate = useTranslate();
const { mutate: login, isLoading } = useLogin<ILoginForm>();
Function ReadyPage
has 112 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const ReadyPage: React.FC = () => {
const renderCode = (text: string) => (
<Typography
sx={{
backgroundColor: (theme) =>
Function useSelect
has 111 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const useSelect = <
TData extends BaseRecord = BaseRecord,
TError extends HttpError = HttpError,
>(
props: UseSelectProps<TData, TError>,
Function RouteProvider
has 110 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const RouteProvider = () => {
const { resources } = useResource();
const { catchAll, DashboardPage, LoginPage } = useRefineContext();
const { routes: customRoutes }: { routes: RouteProps[] } =
Function Sider
has 102 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const Sider: React.FC = () => {
const [collapsed, setCollapsed] = useState<boolean>(false);
const isExistAuthentication = useIsExistAuthentication();
const { Link } = useRouterContext();
const { mutate: logout } = useLogout();
Function renderCrud
has 98 lines of code (exceeds 25 allowed). Consider refactoring. Open
const renderCrud = () => {
switch (action) {
case undefined:
return (
<CanAccess
Function renderCrud
has 96 lines of code (exceeds 25 allowed). Consider refactoring. Open
const renderCrud = () => {
switch (action) {
default:
return (
<CanAccess
Function addRouterProvider
has 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
function addRouterProvider(j: JSCodeshift, root: Collection<any>) {
const routerProviderImports = root.find(j.ImportDeclaration, {
source: {
value: "@pankod/refine-react-router",
},
Function useMenu
has 89 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const useMenu: () => useMenuReturnType = () => {
const { resources } = useResource();
const translate = useTranslate();
const { useLocation, useParams } = useRouterContext();
Function RouteProviderBase
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
const RouteProviderBase: React.FC = () => {
const { resources } = useResource();
const { catchAll, DashboardPage, LoginPage } = useRefineContext();
const { routes: customRoutes }: { routes: RouteProps[] } =
- 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"