pankod/refine

View on GitHub

Showing 750 of 983 total issues

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

  const renderRelationFields = (field: InferField) => {
    if (field.relation && field.resource) {
      const variableName = getVariableName(field.key, "Data");
      const variableIsLoading = getVariableName(field.key, "IsLoading");

Severity: Major
Found in packages/inferencer/src/inferencers/mui/show.tsx - About 5 hrs to fix

    Function useExport has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
    Open

    export const useExport = <
      TData extends BaseRecord = BaseRecord,
      TVariables = any,
    >({
      resourceName,
    Severity: Minor
    Found in packages/core/src/hooks/export/index.ts - About 5 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 Header has 127 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const Header = () => {
      const [connectedApp, setConnectedApp] = React.useState<string | null>(null);
      const { ws } = React.useContext(DevToolsContext);
    
      const fetchConnectedApp = React.useCallback(async () => {
    Severity: Major
    Found in packages/devtools-ui/src/components/header.tsx - About 5 hrs to fix

      Function transformer has 127 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export default async function transformer(file: FileInfo, api: API) {
        const j = api.jscodeshift;
        const source = j(file.source);
      
        const hasRefineElement =
      Severity: Major
      Found in packages/cli/src/transformers/integrations/react-router.ts - About 5 hrs to fix

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

          const renderRelationFields = (field: InferField) => {
            if (field.relation && field.resource) {
              const variableName = getVariableName(field.key, "Data");
              const variableIsLoading = getVariableName(field.key, "IsLoading");
        
        
        Severity: Major
        Found in packages/inferencer/src/inferencers/headless/show.tsx - About 5 hrs to fix

          Function GitHubBanner has 124 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const GitHubBanner = () => {
            useEffect(() => {
              const styleTag = document.createElement("style");
              document.head.appendChild(styleTag);
              CSSRules.forEach((rule) =>
          Severity: Major
          Found in packages/core/src/components/gh-banner/index.tsx - About 4 hrs to fix

            Function Sider has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
            Open

            export const Sider: React.FC<RefineLayoutSiderProps> = ({
              Title: TitleFromProps,
              render,
              meta,
            }) => {
            Severity: Minor
            Found in packages/antd/src/components/layout/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 ThemedSiderV2 has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
            Open

            export const ThemedSiderV2: React.FC<RefineThemedLayoutV2SiderProps> = ({
              Title: TitleFromProps,
              render,
              meta,
              fixed,
            Severity: Minor
            Found in packages/antd/src/components/themedLayoutV2/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 useUpdatePassword has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
            Open

            export function useUpdatePassword<
              TVariables extends UpdatePasswordFormTypes = {},
            >({
              v3LegacyAuthProviderCompatible,
              mutationOptions,
            Severity: Minor
            Found in packages/core/src/hooks/auth/useUpdatePassword/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 RemixRouteComponent has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
            Open

            export function RemixRouteComponent(
              this: { initialRoute?: string },
              { children: _children, ...rest }: PropsWithChildren<RemixRouteComponentProps>,
            ): React.ReactNode {
              const loaderData = useLoaderData<any>();
            Severity: Minor
            Found in packages/remix/src/legacy/routeComponent.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 renderRelationFields has 121 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              const renderRelationFields = (field: InferField) => {
                if (field.relation && field.resource) {
                  const variableName = getVariableName(field.key, "Data");
                  const variableIsLoading = getVariableName(field.key, "IsLoading");
            
            
            Severity: Major
            Found in packages/inferencer/src/inferencers/mantine/show.tsx - About 4 hrs to fix

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

                const renderRelationFields = (field: InferField) => {
                  if (field.relation && field.resource) {
                    const variableName = getVariableName(field.key, "Data");
                    const variableIsLoading = getVariableName(field.key, "IsLoading");
              
              
              Severity: Major
              Found in packages/inferencer/src/inferencers/chakra-ui/show.tsx - About 4 hrs to fix

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

                  const renderRelationFields = (field: InferField) => {
                    if (field.relation && field.resource) {
                      const variableName = `${getVariableName(field.key, "Data")}?.data`;
                
                      if (Array.isArray(field.accessor)) {
                Severity: Major
                Found in packages/inferencer/src/inferencers/headless/list.tsx - About 4 hrs to fix

                  Function dataProvider has 117 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const dataProvider = (
                    apiKey: string,
                    baseId: string,
                    airtableClient?: AirtableBase,
                  ): Required<DataProvider> => {
                  Severity: Major
                  Found in packages/airtable/src/dataProvider.ts - About 4 hrs to fix

                    Function transformer has 116 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export default async function transformer(file: FileInfo, api: API) {
                      const j = api.jscodeshift;
                      const source = j(file.source);
                    
                      const refineElement = source.find(j.JSXElement, {
                    Severity: Major
                    Found in packages/cli/src/transformers/integrations/ant-design.ts - About 4 hrs to fix

                      Function serveApi has 115 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export const serveApi = (app: Express, db: Data) => {
                        app.use("/api", json());
                      
                        app.get("/api/connected-app", (_, res) => {
                          res.json({ url: db.connectedApp });
                      Severity: Major
                      Found in packages/devtools-server/src/serve-api.ts - About 4 hrs to fix

                        Function runTests has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
                        Open

                        const runTests = async () => {
                          const examplesToRun = await getProjectsWithE2E();
                        
                          if (examplesToRun.length === 0) {
                            return { success: true, empty: true };
                        Severity: Minor
                        Found in .github/workflows/e2e-examples.js - 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 convertToLegacy has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function convertToLegacy(segments: KeySegment[]) {
                          // for `list`, `many` and `one`
                          if (segments[0] === "data") {
                            // [data, dpName, resource, action, ...];
                            const newSegments = segments.slice(1);
                        Severity: Minor
                        Found in packages/core/src/definitions/helpers/keys/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 separateImports has 114 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export function separateImports(payload: {
                          j: JSCodeshift;
                          source: Collection<any>;
                          imports: string[];
                          renameImports: { [key: string]: string };
                        Severity: Major
                        Found in packages/codemod/src/helpers/separate-imports.ts - About 4 hrs to fix

                          Function Create has 114 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

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