pankod/refine

View on GitHub

Showing 750 of 983 total issues

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

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

                  const action = async ({
                    port,
                    target,
                    domain,
                    rewriteUrl,
                  Severity: Minor
                  Found in packages/cli/src/commands/proxy/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

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

                  export const useForm = <
                    TQueryFnData extends BaseRecord = BaseRecord,
                    TError extends HttpError = HttpError,
                    TVariables extends FieldValues = FieldValues,
                    TContext extends object = {},
                  Severity: Minor
                  Found in packages/react-hook-form/src/useForm/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

                  Function renderRelationFields has 95 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    const renderRelationFields = (field: InferField) => {
                      if (field.relation && field.resource) {
                        imports.push(
                          ["Autocomplete", "@mui/material"],
                          ["Controller", "react-hook-form"],
                  Severity: Major
                  Found in packages/inferencer/src/inferencers/mui/create.tsx - About 3 hrs to fix

                    Function renderRelationFields has 95 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      const renderRelationFields = (field: InferField) => {
                        if (field.relation && field.resource) {
                          imports.push(
                            ["Autocomplete", "@mui/material"],
                            ["Controller", "react-hook-form"],
                    Severity: Major
                    Found in packages/inferencer/src/inferencers/mui/edit.tsx - About 3 hrs to fix

                      Function HeaderAuthStatus has 95 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export const HeaderAuthStatus = () => {
                        const [me, setMe] = React.useState<MeResponse | null>(null);
                        const [logoutVisible, setLogoutVisible] = React.useState(false);
                        const buttonRef = React.useRef<HTMLButtonElement>(null);
                        const navigate = useNavigate();
                      Severity: Major
                      Found in packages/devtools-ui/src/components/header-auth-status.tsx - About 3 hrs to fix

                        Function basicInputFields has 94 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/chakra-ui/edit.tsx - About 3 hrs to fix

                          Function Preview has 94 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          const Preview: NextPage = () => {
                            const [ready, setReady] = React.useState(false);
                            const { code, css, hasQuery, isReady, disableScroll, useTailwind } =
                              useCode();
                            const [scope, setScope] = React.useState({ ...RefineCommonScope });
                          Severity: Major
                          Found in packages/live-previews/pages/preview.tsx - About 3 hrs to fix

                            Function ConfigSuccessPage has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                            Open

                            export const ConfigSuccessPage: React.FC = () => {
                              const isTablet = useMediaQuery("(max-width: 1010px)");
                              const isMobile = useMediaQuery("(max-width: 650px)");
                            
                              const getGridTemplateColumns = () => {
                            Severity: Minor
                            Found in packages/core/src/components/pages/config-success/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 Authenticated has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                            Open

                            export function Authenticated({
                              redirectOnFail = true,
                              appendCurrentPathToQuery = true,
                              children,
                              fallback: fallbackContent,
                            Severity: Minor
                            Found in packages/core/src/components/authenticated/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

                            Severity
                            Category
                            Status
                            Source
                            Language