pankod/refine

View on GitHub

Showing 561 of 707 total issues

Function renderRelationFields has 112 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`;
      const variableIsLoading = getVariableName(field.key, "IsLoading");

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

    Function renderRelationFields has 111 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/antd/show.tsx - About 4 hrs to fix

      Function LoginForm has 111 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const LoginForm = (props: { className?: string }) => {
        const { ws } = React.useContext(DevToolsContext);
        const [searchParams] = useSearchParams();
        const [flowData, setFlowData] = React.useState<LoginFlow | null>(null);
      
      
      Severity: Major
      Found in packages/devtools-ui/src/pages/login.tsx - About 4 hrs to fix

        Function renderRelationFields has 108 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/chakra-ui/list.tsx - About 4 hrs to fix

          Function reorderImports has 108 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const reorderImports = (content: string): string => {
            let newContent = content;
            // imports can have comments before them, we need to preserve those comments and import statements.
            // so we need to filter out the imports with comments before.
            const allImports = getImports(content);
          Severity: Major
          Found in packages/cli/src/utils/swizzle/import.ts - About 4 hrs to fix

            Function renderRelationFields has 107 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/mantine/list.tsx - About 4 hrs to fix

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

              const Preview: NextPage = () => {
                const [ready, setReady] = React.useState(false);
                const {
                  code,
                  css,
              Severity: Major
              Found in packages/live-previews/pages/preview.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 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 useSelector has 99 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export const useSelector = (active: boolean) => {
                            const { devtoolsUrl } = React.useContext(DevToolsContext);
                            const [selectableElements, setSelectableElements] = React.useState<
                              SelectableElement[]
                            >([]);
                          Severity: Major
                          Found in packages/devtools/src/utilities/use-selector.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 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 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 Authenticated has a Cognitive Complexity of 27 (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

                              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
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language