pankod/refine

View on GitHub

Showing 812 of 823 total issues

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

  const textFields = (field: InferField) => {
    if (field.type === "text") {
      imports.push(
        ["TagField", "@refinedev/chakra-ui"],
        ["TextField", "@refinedev/chakra-ui"],
Severity: Minor
Found in packages/inferencer/src/inferencers/chakra-ui/show.tsx - About 1 hr to fix

    Function imageFields has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      const imageFields = (field: InferField) => {
        if (field.type === "image") {
          if (field.multiple) {
            const val = accessor("item", undefined, field.accessor);
    
    
    Severity: Minor
    Found in packages/inferencer/src/inferencers/mui/show.tsx - About 1 hr to fix

      Function sorterToSorters has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const sorterToSorters = (j: JSCodeshift, source: Collection) => {
        const willCheckHooks = ["useExport"];
      
        willCheckHooks.forEach((hookName) => {
          const useListHooks = source.find(j.CallExpression, {
      Severity: Minor
      Found in packages/codemod/src/transformations/v4/fix-v4-deprecations.ts - About 1 hr to fix

        Function ThemedHeader has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const ThemedHeader: React.FC<RefineThemedLayoutHeaderProps> = () => {
          const theme = useMantineTheme();
        
          const authProvider = useActiveAuthProvider();
          const { data: user } = useGetIdentity({
        Severity: Minor
        Found in packages/mantine/src/components/themedLayout/header/index.tsx - About 1 hr to fix

          Function resourceNametoResource has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const resourceNametoResource = (j: JSCodeshift, source: Collection) => {
            const willCheckHooks = ["useExport", "useImport"];
          
            willCheckHooks.forEach((hookName) => {
              const useListHooks = source.find(j.CallExpression, {
          Severity: Minor
          Found in packages/codemod/src/transformations/v4/fix-v4-deprecations.ts - About 1 hr to fix

            Function mapped has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              const mapped: Array<InferField> = fields.map((field) => {
                if (
                  !field.relation &&
                  (field.type === "text" ||
                    field.type === "richtext" ||
            Severity: Minor
            Found in packages/inferencer/src/field-transformers/basic-to-relation.ts - About 1 hr to fix

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

                const booleanFields = (field: InferField) => {
                  if (field.type === "boolean") {
                    imports.push(["Checkbox", "@mantine/core"]);
              
                    initialValues = {
              Severity: Minor
              Found in packages/inferencer/src/inferencers/mantine/edit.tsx - About 1 hr to fix

                Function richtextFields has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  const richtextFields = (field: InferField) => {
                    if (field.type === "richtext") {
                      imports.push(["Textarea", "@mantine/core"]);
                
                      initialValues = {
                Severity: Minor
                Found in packages/inferencer/src/inferencers/mantine/edit.tsx - About 1 hr to fix

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

                      .map((field) => {
                        if (field?.relation && !field.fieldable && field.resource) {
                          imports.push(["GetManyResponse", "@refinedev/core"]);
                          imports.push(["useMany", "@refinedev/core"]);
                  
                  
                  Severity: Minor
                  Found in packages/inferencer/src/inferencers/mantine/list.tsx - About 1 hr to fix

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

                        .map((field) => {
                          if (field?.relation && !field.fieldable && field.resource) {
                            imports.push(["GetManyResponse", "@refinedev/core"]);
                            imports.push(["useMany", "@refinedev/core"]);
                    
                    
                    Severity: Minor
                    Found in packages/inferencer/src/inferencers/headless/list.tsx - About 1 hr to fix

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

                        const textFields = (field: InferField) => {
                          if (field.type === "text") {
                            if (field.multiple) {
                              const val = accessor("item", undefined, field.accessor);
                              return jsx`
                      Severity: Minor
                      Found in packages/inferencer/src/inferencers/headless/show.tsx - About 1 hr to fix

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

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

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

                              .map((field) => {
                                if (field?.relation && !field.fieldable && field.resource) {
                                  imports.push(["GetManyResponse", "@refinedev/core"]);
                                  imports.push(["useMany", "@refinedev/core"]);
                          
                          
                          Severity: Minor
                          Found in packages/inferencer/src/inferencers/chakra-ui/list.tsx - About 1 hr to fix

                            Function placement has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              const placement = React.useMemo(() => {
                                const tooltipBaseSize = { width: 22, height: 22 };
                                const nameWidth = name.length * 7.5;
                                const tooltipSize = {
                                  width: tooltipBaseSize.width + nameWidth,
                            Severity: Minor
                            Found in packages/devtools/src/components/selectable-elements.tsx - About 1 hr to fix

                              Function CommandBar has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export const CommandBar: React.FC = () => {
                                const searchStyle = {
                                  padding: "12px 16px",
                                  fontSize: "16px",
                                  width: "100%",
                              Severity: Minor
                              Found in packages/kbar/src/components/commandBar/index.tsx - About 1 hr to fix

                                Function useRefineContext has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                export const useRefineContext = () => {
                                  const {
                                    Footer,
                                    Header,
                                    Layout,
                                Severity: Minor
                                Found in packages/core/src/hooks/refine/useRefineContext.ts - About 1 hr to fix

                                  Function transformCrudFiltersToFilterModel has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  export const transformCrudFiltersToFilterModel = (
                                    crudFilters: CrudFilters,
                                    columnsType?: Record<string, string>,
                                  ): GridFilterModel | undefined => {
                                    const gridFilterItems: GridFilterItem[] = [];
                                  Severity: Minor
                                  Found in packages/mui/src/definitions/dataGrid/index.ts - About 1 hr to fix

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

                                    export const generateFilter = (filter: CrudFilter, deep = 10): string => {
                                      const nextDeep = deep - 1;
                                    
                                      if (nextDeep < 0) {
                                        throw new Error("Max deep reached");
                                    Severity: Minor
                                    Found in packages/appwrite/src/utils/generateFilter.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 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 SelectableElement has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                    const SelectableElement = ({
                                      element,
                                      name,
                                      onSelect,
                                    }: {
                                    Severity: Minor
                                    Found in packages/devtools/src/components/selectable-elements.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

                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language