pankod/refine

View on GitHub

Showing 756 of 987 total issues

Function CodeModal has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

const CodeModal = ({
  visible,
  onClose,
  code = "",
}: {
Severity: Minor
Found in packages/inferencer/src/components/shared-code-viewer/index.tsx - About 1 hr 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 createResourcePathWithAction has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

export const createResourcePathWithAction = (
  resource: ResourceProps,
  action: Action,
) => {
  const { name, list, create, show, edit } = resource;
Severity: Minor
Found in packages/react-router-v6/src/create-resource-routes.tsx - About 1 hr 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 Monitor has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

export const Monitor = () => {
  const { ws } = React.useContext(DevToolsContext);
  const [activities, setActivities] = React.useState<Activity[]>([]);
  const [searchParams] = useSearchParams();

Severity: Minor
Found in packages/devtools-ui/src/pages/monitor.tsx - About 1 hr 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 go has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  go: () => {
    const { search: existingSearch, hash: existingHash } = useLocation();
    const navigate = useNavigate();

    const fn = useCallback(
Severity: Minor
Found in packages/react-router-v6/src/bindings.tsx - About 1 hr 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 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) {
Severity: Minor
Found in packages/devtools-ui/src/components/project-id-fix-modal.tsx - About 1 hr 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 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();
Severity: Minor
Found in packages/core/src/hooks/button/navigation-button/index.tsx - About 1 hr 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 AuthBindingsContextProvider has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

> = ({ children, isProvided, ...authBindings }) => {
  const handleLogin = async (params: unknown) => {
    try {
      const result = await authBindings.login?.(params);

Severity: Minor
Found in packages/core/src/contexts/auth/index.tsx - About 1 hr 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 List has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

export const List: React.FC<ListProps> = ({
  title,
  canCreate,
  children,
  createButtonProps: createButtonPropsFromProps,
Severity: Minor
Found in packages/mui/src/components/crud/list/index.tsx - About 1 hr 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 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",
Severity: Minor
Found in packages/codemod/src/transformations/refine2-to-refine3.ts - About 1 hr to fix

    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"],
    Severity: Minor
    Found in packages/inferencer/src/inferencers/antd/show.tsx - About 1 hr to fix

      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"],
      Severity: Minor
      Found in packages/inferencer/src/inferencers/antd/show.tsx - About 1 hr to fix

        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) {
        Severity: Minor
        Found in packages/inferencer/src/inferencers/mantine/show.tsx - About 1 hr to fix

          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) {
          Severity: Minor
          Found in packages/inferencer/src/inferencers/mantine/show.tsx - About 1 hr to fix

            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);
            
            
            Severity: Minor
            Found in packages/inferencer/src/inferencers/headless/edit.tsx - About 1 hr to fix

              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);
              
              
              Severity: Minor
              Found in packages/inferencer/src/inferencers/chakra-ui/edit.tsx - About 1 hr to fix

                Function onMutationError has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    onMutationError: (error, _variables, _context) => {
                      if (disableServerSideValidation) {
                        refineCoreProps?.onMutationError?.(error, _variables, _context);
                        return;
                      }
                Severity: Minor
                Found in packages/react-hook-form/src/useForm/index.ts - About 1 hr to fix

                  Function Success has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const Success = () => {
                    const { ws } = React.useContext(DevToolsContext);
                  
                    React.useEffect(() => {
                      if (ws) {
                  Severity: Minor
                  Found in packages/devtools-ui/src/pages/after-login.tsx - About 1 hr to fix

                    Function data has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      const data = React.useMemo(() => {
                        let filtered = [...activities];
                    
                        if (filters.scope && filters.scope.length > 0) {
                          const allowedHooks: RefineHook[] = [];
                    Severity: Minor
                    Found in packages/devtools-ui/src/pages/monitor.tsx - About 1 hr to fix

                      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",
                      Severity: Minor
                      Found in packages/devtools-ui/src/pages/onboarding.tsx - About 1 hr to fix

                        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",
                        Severity: Minor
                        Found in packages/devtools-ui/src/pages/login.tsx - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language