pankod/refine

View on GitHub

Showing 959 of 983 total issues

Function Create has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

export const Create: React.FC<CreateProps> = (props) => {
  const {
    children,
    saveButtonProps: saveButtonPropsFromProps,
    isLoading,
Severity: Minor
Found in packages/chakra-ui/src/components/crud/create/index.tsx - About 4 hrs to fix

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 checkPackage has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

export const checkPackage = (code = "") => {
  const set = new Set<string>();

  const hasAntd =
    code.includes("@refinedev/antd") ||
Severity: Minor
Found in packages/live-previews/src/utils/check-package.ts - About 4 hrs to fix

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 useTable has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

export function useTable<
  TQueryFnData extends BaseRecord = BaseRecord,
  TError extends HttpError = HttpError,
  TData extends BaseRecord = TQueryFnData,
>({
Severity: Minor
Found in packages/core/src/hooks/useTable/index.ts - About 4 hrs to fix

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 useForgotPassword has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

export function useForgotPassword<TVariables = {}>({
  v3LegacyAuthProviderCompatible,
  mutationOptions,
}:
  | UseForgotPasswordProps<TVariables>
Severity: Minor
Found in packages/core/src/hooks/auth/useForgotPassword/index.ts - About 4 hrs to fix

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 LoginPage has 105 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const LoginPage: React.FC<LoginPageProps> = () => {
  const [form] = Form.useForm<ILoginForm>();
  const translate = useTranslate();

  const authProvider = useActiveAuthProvider();
Severity: Major
Found in packages/antd/src/components/pages/login/index.tsx - About 4 hrs to fix

    Function renderCrud has 104 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        const renderCrud = () => {
          switch (action) {
            case undefined:
              return (
                <CanAccess
    Severity: Major
    Found in packages/react-router-v6/src/legacy/routeProvider.tsx - About 4 hrs to fix

      Function useModalForm has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

      export const useModalForm = <
        TQueryFnData extends BaseRecord = BaseRecord,
        TError extends HttpError = HttpError,
        TVariables = Record<string, unknown>,
        TTransformed = TVariables,
      Severity: Minor
      Found in packages/mantine/src/hooks/form/useModalForm/index.ts - About 4 hrs to fix

      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 ThemedSider has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

      export const ThemedSider: React.FC<RefineThemedLayoutSiderProps> = ({
        Title: TitleFromProps,
        render,
        meta,
      }) => {
      Severity: Minor
      Found in packages/antd/src/components/themedLayout/sider/index.tsx - About 4 hrs to fix

      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 useForm has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

      export const useForm = <
        TQueryFnData extends BaseRecord = BaseRecord,
        TError extends HttpError = HttpError,
        TVariables = {},
        TData extends BaseRecord = TQueryFnData,
      Severity: Minor
      Found in packages/antd/src/hooks/form/useForm.ts - About 4 hrs to fix

      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 useDrawerForm has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

      export const useDrawerForm = <
        TQueryFnData extends BaseRecord = BaseRecord,
        TError extends HttpError = HttpError,
        TVariables = {},
        TData extends BaseRecord = TQueryFnData,
      Severity: Minor
      Found in packages/antd/src/hooks/form/useDrawerForm/useDrawerForm.ts - About 4 hrs to fix

      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 useInferFetch has 101 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const useInferFetch = (
        type: "list" | "show" | "edit" | "create",
        resourceNameOrRouteName?: string,
        idFromProps?: string | number,
        meta?: InferencerComponentProps["meta"],
      Severity: Major
      Found in packages/inferencer/src/use-infer-fetch/index.tsx - About 4 hrs to fix

        Function ReadyPage has 101 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const ReadyPage: React.FC<RefineReadyPageProps> = () => {
          const renderCode = (text: string) => (
            <Typography
              sx={{
                backgroundColor: (theme) => theme.palette.secondary.contrastText,
        Severity: Major
        Found in packages/mui/src/components/pages/ready/index.tsx - About 4 hrs to fix

          Function basicInputFields has 100 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            const basicInputFields = (field: InferField) => {
              if (
                field.type === "text" ||
                field.type === "url" ||
                field.type === "email" ||
          Severity: Major
          Found in packages/inferencer/src/inferencers/mui/edit.tsx - About 4 hrs to fix

            Function renderTreeView has 99 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              const renderTreeView = (tree: ITreeMenu[]) => {
                return tree.map((item) => {
                  const { label, route, name, icon, children } = item;
            
                  const isSelected = item.key === selectedKey;
            Severity: Major
            Found in packages/chakra-ui/src/components/themedLayoutV2/sider/index.tsx - About 3 hrs to fix

              Function basicInputFields has 99 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                const basicInputFields = (field: InferField) => {
                  if (
                    field.type === "text" ||
                    field.type === "url" ||
                    field.type === "email" ||
              Severity: Major
              Found in packages/inferencer/src/inferencers/headless/edit.tsx - About 3 hrs to fix

                Function FeatureSlide has 99 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export const FeatureSlide = (props: { className?: string }) => {
                  const slideTimeout = useRef<NodeJS.Timeout | null | undefined>(undefined);
                  const [slideIndex, setSlideIndex] = useState(0);
                
                  useEffect(() => {
                Severity: Major
                Found in packages/devtools-ui/src/components/feature-slide.tsx - About 3 hrs to fix

                  Function OnboardingForm has 99 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const OnboardingForm = () => {
                    const [values, setValues] = React.useState<MeUpdateVariables>({
                      name: "",
                      jobTitle: "",
                      company: "",
                  Severity: Major
                  Found in packages/devtools-ui/src/pages/onboarding.tsx - About 3 hrs to fix

                    Function createResources has 99 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export const createResources = async (
                      params: { actions?: string; path?: string },
                      resources: string[],
                    ) => {
                      const destinationPath =

                      Function useInferFetch has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export const useInferFetch = (
                        type: "list" | "show" | "edit" | "create",
                        resourceNameOrRouteName?: string,
                        idFromProps?: string | number,
                        meta?: InferencerComponentProps["meta"],
                      Severity: Minor
                      Found in packages/inferencer/src/use-infer-fetch/index.tsx - About 3 hrs to fix

                      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 liveProvider has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export const liveProvider = (
                        supabaseClient: SupabaseClient<any, any, any>,
                      ): LiveProvider => {
                        return {
                          subscribe: ({
                      Severity: Minor
                      Found in packages/supabase/src/liveProvider/index.ts - About 3 hrs to fix

                      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

                      Severity
                      Category
                      Status
                      Source
                      Language