pankod/refine

View on GitHub

Showing 580 of 800 total issues

Function ResizablePane has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

export const ResizablePane = ({ placement, visible, children }: Props) => {
  const [hover, setHover] = React.useState(false);
  const [resizing, setResizing] = React.useState<
    "lx" | "rx" | "ty" | "by" | null
  >(null);
Severity: Minor
Found in packages/devtools/src/components/resizable-pane.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 OnboardingForm has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

const OnboardingForm = () => {
  const [loading, setLoading] = React.useState(false);
  const { handleSubmit, control, setValue, setError, formState } =
    useForm<MeUpdateVariables>({
      defaultValues: {
Severity: Minor
Found in packages/devtools-ui/src/pages/onboarding.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 useResourceParams has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

export function useResourceParams(props?: Props): ResourceParams {
  const { select, identifier: inferredIdentifier } = useResource();
  const resourceToCheck = props?.resource ?? inferredIdentifier;
  const { identifier = undefined, resource = undefined } = resourceToCheck
    ? select(resourceToCheck, true)
Severity: Minor
Found in packages/core/src/hooks/use-resource-params/index.ts - 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 printImports has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const printImports = (imports: Array<ImportElement>) => {
  const byModule = imports.reduce(
    (acc, [element, module, isDefault]) => {
      if (!acc[module]) {
        acc[module] = [] as Array<
Severity: Minor
Found in packages/inferencer/src/utilities/print-imports/index.ts - About 1 hr to fix

    Function emailFields has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      const emailFields = (field: InferField) => {
        if (field.type === "email") {
          imports.push(
            ["TagField", "@refinedev/antd"],
            ["EmailField", "@refinedev/antd"],
    Severity: Minor
    Found in packages/inferencer/src/inferencers/antd/list.tsx - About 1 hr to fix

      Function urlFields has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        const urlFields = (field: InferField) => {
          if (field.type === "url") {
            imports.push(
              ["UrlField", "@refinedev/antd"],
              ["TagField", "@refinedev/antd"],
      Severity: Minor
      Found in packages/inferencer/src/inferencers/antd/list.tsx - About 1 hr to fix

        Function booleanFields has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          const booleanFields = (field: InferField) => {
            if (field.type === "boolean") {
              if (field.multiple) {
                return undefined;
              }
        Severity: Minor
        Found in packages/inferencer/src/inferencers/headless/create.tsx - About 1 hr to fix

          Function printFiles has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            const printFiles = () => {
              const chalks = [];
          
              chalks.push(chalk.dim(`File${files.length > 1 ? "s" : ""} created:`));
              chalks.push(
          Severity: Minor
          Found in packages/cli/src/components/swizzle-message/index.tsx - About 1 hr to fix

            Function getAllVersionsOfPackage has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export const getAllVersionsOfPackage = async (
              packageName: string,
            ): Promise<string[]> => {
              const pm = "npm";
            
            
            Severity: Minor
            Found in packages/cli/src/utils/package/index.ts - About 1 hr to fix

              Function useResourceParams has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function useResourceParams(props?: Props): ResourceParams {
                const { select, identifier: inferredIdentifier } = useResource();
                const resourceToCheck = props?.resource ?? inferredIdentifier;
                const { identifier = undefined, resource = undefined } = resourceToCheck
                  ? select(resourceToCheck, true)
              Severity: Minor
              Found in packages/core/src/hooks/use-resource-params/index.ts - About 1 hr to fix

                Function useGetToPath has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export const useGetToPath = (): GetToPathFn => {
                  const routerType = useRouterType();
                  const { resource: resourceFromRoute, resources } = useResource();
                  const parsed = useParsed();
                
                
                Severity: Minor
                Found in packages/core/src/hooks/router/use-get-to-path/index.ts - About 1 hr to fix

                  Function useGo has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const useGo = () => {
                    const routerContext = useContext(RouterContext);
                    const { select: resourceSelect } = useResource();
                    const getToPath = useGetToPath();
                  
                  
                  Severity: Minor
                  Found in packages/core/src/hooks/router/use-go/index.tsx - About 1 hr to fix

                    Function queryKeys has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export const queryKeys = (
                      resource?: string,
                      dataProviderName?: string,
                      meta?: MetaQuery,
                      /**
                    Severity: Minor
                    Found in packages/core/src/definitions/helpers/queryKeys/index.ts - About 1 hr to fix

                      Function assertDocumentTitle has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export const assertDocumentTitle = (resource: string, action?: IAction) => {
                        switch (action) {
                          case "list":
                            cy.document()
                              .its("title")
                      Severity: Minor
                      Found in cypress/support/commands/document-title-handler.ts - About 1 hr to fix

                        Function textFields has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          const textFields = (field: InferField) => {
                            if (
                              field.type === "text" ||
                              field.type === "email" ||
                              field.type === "date" ||
                        Severity: Minor
                        Found in packages/inferencer/src/inferencers/mantine/create.tsx - About 1 hr to fix

                          Function relationHooksCode has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              .map((field) => {
                                if (field?.relation && !field.fieldable && field.resource) {
                                  imports.push(["useAutocomplete", "@refinedev/mui"]);
                                  let val = accessor(recordName, field.key, field.accessor, false);
                          
                          
                          Severity: Minor
                          Found in packages/inferencer/src/inferencers/mui/edit.tsx - About 1 hr to fix

                            Function UnsavedPrompt has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            const UnsavedPrompt: React.FC = () => {
                              const { Prompt } = useRouterContext();
                            
                              const translate = useTranslate();
                            
                            
                            Severity: Minor
                            Found in packages/core/src/components/layoutWrapper/index.tsx - About 1 hr to fix

                              Function useRedirectionAfterSubmission has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                () => {
                                  const { show, edit, list, create } = useNavigation();
                              
                                  const handleSubmitWithRedirect = useCallback(
                                    ({
                              Severity: Minor
                              Found in packages/core/src/hooks/redirection/index.ts - About 1 hr to fix

                                Function useRefreshButton has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                export function useRefreshButton(
                                  props: RefreshButtonProps,
                                ): RefreshButtonValues {
                                  const translate = useTranslate();
                                  const { keys, preferLegacyKeys } = useKeys();
                                Severity: Minor
                                Found in packages/core/src/hooks/button/refresh-button/index.tsx - About 1 hr to fix

                                  Function transform has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      transform: (content) => {
                                        let newContent = content;
                                        const imports = getImports(content);
                                  
                                        imports.map((importItem) => {
                                  Severity: Minor
                                  Found in packages/mantine/refine.config.js - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language